From 5335aa9418fedffeb85d4eeae7e449d22e341871 Mon Sep 17 00:00:00 2001 From: shish Date: Sun, 9 Dec 2007 04:16:51 +0000 Subject: [PATCH] remove old git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.1@647 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/link_image/_style.css | 41 ------- contrib/link_image/main.php | 40 ------- contrib/link_image/readme.txt | 82 -------------- contrib/link_image/theme.php | 71 ------------ contrib/tag_history/main.php | 204 ---------------------------------- contrib/tag_history/theme.php | 18 --- 6 files changed, 456 deletions(-) delete mode 100644 contrib/link_image/_style.css delete mode 100644 contrib/link_image/main.php delete mode 100644 contrib/link_image/readme.txt delete mode 100644 contrib/link_image/theme.php delete mode 100644 contrib/tag_history/main.php delete mode 100644 contrib/tag_history/theme.php diff --git a/contrib/link_image/_style.css b/contrib/link_image/_style.css deleted file mode 100644 index 472620f6..00000000 --- a/contrib/link_image/_style.css +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file may not be distributed without its readme.txt -**/ - -/* * * Link to Image * * */ -#Link_to_Image { - /* allows borders to encompass the content; */ - overflow:hidden; -} - -#Link_to_Image fieldset { - width: 32%; - float:left; - min-width:25em; -} - -#Link_to_Image input, #Link_to_Image label { - display:block; - width:66%; - float:left; - margin-bottom:2.5px; -} - -#Link_to_Image label { - width:30%; - text-align:left; - padding-right:2%; - cursor:pointer; -} -#Link_to_Image input { - font-size:0.7em; - font-family:courier, fixed, monospace; -} - -#Link_to_Image br { - clear:both; -} - -#Link_to_Image label:hover { - border-bottom:1px dashed; -} \ No newline at end of file diff --git a/contrib/link_image/main.php b/contrib/link_image/main.php deleted file mode 100644 index 27d410e6..00000000 --- a/contrib/link_image/main.php +++ /dev/null @@ -1,40 +0,0 @@ -theme)) $this->theme = get_theme_object("link_image", "LinkImageTheme"); - if(is_a($event, 'DisplayingImageEvent')) { - global $config; - $data_href = get_base_href(); - $event->page->add_header("",0); - - $this->theme->links_block($event->page,$this->data($event->image)); - } - if(is_a($event, 'SetupBuildingEvent')) { - $sb = new SetupBlock("Link to Image"); - $sb->add_text_option("ext_link-img_text-link_format", "Text Link Format: "); - $event->panel->add_block($sb); - } - if(is_a($event, 'InitExtEvent')) { - global $config; - //just set default if empty. - $config->set_default_string("ext_link-img_text-link_format", - '$title - $id ($ext $size $filesize)'); - } - } - private function data($image) { - global $config; - - $text_link = $image->parse_link_template($config->get_string("ext_link-img_text-link_format")); - $text_link = $text_link==" "? null : $text_link; // null blank setting so the url gets filled in on the text links. - - return array( - 'thumb_src' => $image->get_thumb_link(), - 'image_src' => $image->get_image_link(), - 'post_link' => $image->get_short_link(), - 'text_link' => $text_link); - } -} -add_event_listener(new LinkImage()); -?> diff --git a/contrib/link_image/readme.txt b/contrib/link_image/readme.txt deleted file mode 100644 index 6051103a..00000000 --- a/contrib/link_image/readme.txt +++ /dev/null @@ -1,82 +0,0 @@ -Link to Image adds BBCode and HTML link codes to the image view. Offers code for a customizable text link, thumbnail links, and full image inline. - -Author: Erik Youngren - -License: GPLv2 - -Submit a Bug Report or Suggestion for Link to Image: - * http://trac.shishnet.org/shimmie2/newticket?owner=artanis.00@gmail.com&component=third%20party%20extensions&keywords=link_to_image - -= Use = -There is one option in Board Config: Text Link Format. -It takes the following arguments as well as plain text. -|| arguments || replacement || -|| $id || The image ID. || -|| $hash || The MD5 hash of the image. || -|| $tags || The image's tag list. || -|| $base || The base HREF as set in Config. || -|| $ext || The image's extension. || -|| $size || The image's display size. || -|| $filesize || The image's size in KB. || -|| $filename || The image's original filename. || -|| $title || The site title as set in Config. || -Link to Image will default this option to '$title - $id ($ext $size $filesize)'. -To reset to the default, simply clear the current setting. Link to Image will then fill in the default value after the save. - -To leave the setting blank for any reason, leave a space (' ') in it. - -= Install = - 1. Copy the folder {{{contrib/link_image/}}} to {{{ext/}}}. - 2. In the Config panel, make sure Base URL is set (you may as well set Data URL while you're there, if you haven't already.) - 3. Make sure Image Link, Thumb Link, and Short Link all contain the full path ("http://" and onward,) either by using $base or plain text. Link to Image will not be able to retrieve the correct paths without these variables. - -= Change Log = -== Version 0.3.0 == - * Moved Link to Image over to the official theme engine. This functions basically the same as what the prototype was, but it's more thought out and nicer. - * Cleaned up the insides a bit. - -== Version 0.2.0 == - * Changed the HTML generation to use a prototype theme engine. All HTML generation is now contained within {{{link_image.html.php}}}, which may be copied to the current theme folder and edited from there. - -== Version 0.1.4 - 20070510 == - * Style changes. - * Added output containing only the locations of the thumb, image and post. - * Added a link to wikipedia's HTML page, just as BBCode has a wikipedia link. - -== Version 0.1.3b - 20070509 == - * Renamed style.css to _style.css to avoid the auto loader. - -== Version 0.1.3 - 20070508 == - * Created Readme.txt - * Merged 0.1.2 into 0.1.2b - * Removed uneeded documentation from main.php - * Rewrote the css to be unique. Previously used CSS I wrote for elsewhere. Styled to reduce space consumption. - * Added code to insert the CSS import. - * Updated Nice URLs to allow access to the /ext/ folder. (Why is my stylesheet returning HTML instead of CSS?) - * First SVN update. - -== Version 0.1.2b - 20070507 == -(fairly simultaneous with 0.1.2) - * shish: - * Updated to new extension format - * Created folder link_image in trunk/contrib - * Renamed link_image.ext.php to main.php and moved to /link_image/ - * Created style.css {{{ /* 404'd :|*/ }}}. - * Documentation (different from mine.) - * Changed add_text_option() and added add_label() in SetupBuildingEvent because I was using an edited version of the function that shish didn't know about. It was a wonder that didn't throw massive errors. - * Published on SVN. - -== Version 0.1.2 - 20070506 == - * Textboxes now select-all when they gain focus. - * Commenting and documentation. - -== Version 0.1.1 - 20070506 == - * Fixed HTML thumbnail link code. (image tag was being html_escaped twice, resulting in "$gt;" and "<" from the first escape becoming "&gt;" and "&lt;") It turns out that html_escape was completely unnecessary, all I had to do was replace the single-quotes around the attributes with escaped double-quotes ('\"'.) - -== Version 0.1.0 - 20070506 == - * Release. - -= Links = - * http://trac.shishnet.org/shimmie2/wiki/Contrib/Extensions/LinkToImage - Home - * http://forum.shishnet.org/viewtopic.php?p=153 - Discussion - * http://trac.shishnet.org/shimmie2/browser/trunk/contrib/link_image - Shimmie2 Trac SVN diff --git a/contrib/link_image/theme.php b/contrib/link_image/theme.php deleted file mode 100644 index 48e68cd2..00000000 --- a/contrib/link_image/theme.php +++ /dev/null @@ -1,71 +0,0 @@ -add_block( new Block( - "Link to Image", - "
". - "BBCode". - $this->link_code("Text Link",$this->url($post_link, $text_link,"ubb"),"ubb_text-link"). - $this->link_code("Thumbnail Link",$this->url($post_link, $this->img($thumb_src,"ubb"),"ubb"),"ubb_thumb-link"). - $this->link_code("Inline Image", $this->img($image_src,"ubb"), "ubb_full-img"). - "
". - - "
". - "HTML". - $this->link_code("Text Link", $this->url($post_link, $text_link,"html"), "html_text-link"). - $this->link_code("Thumbnail Link", $this->url($post_link,$this->img($thumb_src,"html"),"html"), "html_thumb-link"). - $this->link_code("Inline Image", $this->img($image_src,"html"), "html_full-image"). - "
". - - "
". - "Plain Text". - $this->link_code("Post URL",$post_link,"text_post-link"). - $this->link_code("Thumbnail URL",$thumb_src,"text_thumb-url"). - $this->link_code("Image URL",$image_src,"text_image-src"). - "
", - "main", - 50)); - } - - protected function url ($url,$content,$type) { - if ($content == NULL) {$content=$url;} - - switch ($type) { - case "html": - $text = "".$content.""; - break; - case "ubb": - $text = "[url=".$url."]".$content."[/url]"; - break; - default: - $text = $link." - ".$content; - } - return $text; - } - - protected function img ($src,$type) { - switch ($type) { - case "html": - $text = ""; - break; - case "ubb": - $text = "[img]".$src."[/img]"; - break; - default: - $text = $src; - } - return $text; - } - - protected function link_code($label,$content,$id=NULL) { - return "\n". - "\n
\n"; - } -} -?> diff --git a/contrib/tag_history/main.php b/contrib/tag_history/main.php deleted file mode 100644 index f7b38aaf..00000000 --- a/contrib/tag_history/main.php +++ /dev/null @@ -1,204 +0,0 @@ -theme)) $this->theme = get_theme_object("tag_history", "Tag_HistoryTheme"); - - if(is_a($event, 'InitExtEvent')) { - // shimmie is being installed so call install to create the table. - global $config; - if($config->get_int("ext_tag_history_version") < 1) { - $this->install(); - } - } - - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tag_history")) - { - if($event->get_arg(0) == "revert") - { - // this is a request to revert to a previous version of the tags - $this->process_revert_request($_POST['image_id'], $_POST['revert']); - } - else - { - // must be an attempt to view a tag history - $image_id = int_escape($event->get_arg(0)); - $this->theme->display_history_page($event->page, $image_id, $this->build_tag_history($image_id)); - } - } - if(is_a($event, 'DisplayingImageEvent')) - { - // handle displaying a link on the view page - $this->theme->display_history_link($event->page, $event->image->id); - } - if(is_a($event, 'ImageDeletionEvent')) - { - // handle removing of history when an image is deleted - $this->delete_all_tag_history($event->image->id); - } - if(is_a($event, 'SetupBuildingEvent')) { - $sb = new SetupBlock("Tag History"); - $sb->add_label("Limit to "); - $sb->add_int_option("history_limit"); - $sb->add_label(" entires per image"); - $event->panel->add_block($sb); - } - if(is_a($event, 'TagSetEvent')) { - $this->add_tag_history($event->image_id); - } - } - - protected function install() - { - global $database; - global $config; - $database->Execute("CREATE TABLE tag_histories - ( - id integer NOT NULL auto_increment PRIMARY KEY, - image_id integer NOT NULL, - tags text NOT NULL - )"); - $config->set_int("ext_tag_history_version", 1); - } - - private function process_revert_request($image_id, $revert_id) - { - // this function is called when a revert request is received - global $page; - // check for the nothing case - if($revert_id=="nothing") - { - // tried to set it too the same thing so ignore it (might be a bot) - // go back to the index page with you - $page->set_mode("redirect"); - $page->set_redirect(make_link()); - return; - } - - $revert_id = int_escape($revert_id); - $image_id = int_escape($image_id); - - // lets get this revert id assuming it exists - $result = $this->get_tag_history_from_revert($revert_id); - - if($result==null) - { - // there is no history entry with that id so either the image was deleted - // while the user was viewing the history, someone is playing with form - // variables or we have messed up in code somewhere. - die("Error: No tag history with specified id was found."); - } - - // lets get the values out of the result - $stored_result_id = $result->fields['id']; - $stored_image_id = $result->fields['image_id']; - $stored_tags = $result->fields['tags']; - - if($image_id!=$stored_image_id) - { - // wth is going on there ids should be the same otherwise we are trying - // to edit another image... banhammer this user... j/k - die("Error: Mismatch in history image ids."); - } - - // all should be ok so we can revert by firing the SetUserTags event. - send_event(new TagSetEvent($image_id, $stored_tags)); - - // all should be done now so redirect the user back to the image - $page->set_mode("redirect"); - $page->set_redirect(make_link("post/view/$image_id")); - } - - - - private function build_tag_history($image_id) - { - // this function is called when user tries to view tag history of an image - // check if the image exists - global $database; - $image = $database->get_image($image_id); - if($image==null)return "No image with the specified id currently exists"; - - // get the current images tags - $current_tags = html_escape(implode(' ', $image->get_tag_array())); - //$current_tags = $image->cached_tags; - - // get any stored tag histories - $result = $this->get_tag_history_from_id($image_id); - $html = "
"; - $html .= "
\n"; - $html .= "\n"; - $html .= "
    \n"; - $html .= "
  • $current_tags (current)
  • \n"; - - $end_string = "
"; - // check for no stored history - if($result==null) return $html.$end_string; - - // process each one - while(!$result->EOF) - { - $fields = $result->fields; - $current_id = $fields['id']; - $current_tags = $fields['tags']; - $html .= "
  • $current_tags
  • \n"; - $result->MoveNext(); - } - $html .= $end_string; - - // now return the finished html - return $html; - } - - public function get_tag_history_from_revert($revert_id) - { - global $database; - $row = $database->execute( "SELECT * FROM tag_histories WHERE id = ?", array($revert_id)); - return ($row ? $row : null); - } - - public function get_tag_history_from_id($image_id) - { - global $database; - $row = $database->execute( "SELECT * FROM tag_histories WHERE image_id = ? ORDER BY id DESC", array($image_id)); - return ($row ? $row : null); - } - - private function delete_all_tag_history($image_id) - { - // this function is called when an image has been deleted - global $database; - $database->execute("DELETE FROM tag_histories WHERE image_id = ?", array($image_id)); - } - - private function add_tag_history($image_id) - { - // this function is called just before an images tag are changed - global $database; - global $config; - - // get the old tags - $image = $database->get_image($image_id); - $tags = $image->get_tag_array(); - if(count($tags)==0)return; - $tags = implode(' ',$tags); - - // add a history entry - $allowed = $config->get_int("history_limit",10); - if($allowed<=0)return; - $row = $database->execute("INSERT INTO tag_histories(image_id, tags) VALUES (?, ?)", array($image_id, $tags)); - $entries = $database->db->GetOne("SELECT COUNT(*) FROM `tag_histories` WHERE image_id = ?", array($image_id)); - - // if needed remove oldest one - if($entries > $allowed) - { - // TODO: Make these queries better - $min_id = $database->db->GetOne("SELECT MIN(id) FROM tag_histories WHERE image_id = ?", array($image_id)); - $database->execute("DELETE FROM tag_histories WHERE id = ?", array($min_id)); - } - } -} -add_event_listener(new Tag_History(), 40); // early, so that old tags can be archived before new ones are set -?> diff --git a/contrib/tag_history/theme.php b/contrib/tag_history/theme.php deleted file mode 100644 index 6e337d95..00000000 --- a/contrib/tag_history/theme.php +++ /dev/null @@ -1,18 +0,0 @@ -set_title("Image $image_id Tag History"); - $page->set_heading($page_heading); - - $page->add_block(new NavBlock()); - $page->add_block(new Block("Tag History", $history, "main", 10)); - } - - public function display_history_link($page, $image_id) { - $link = "Tag History\n"; - $page->add_block(new Block(null, $link, "main", 5)); - } -} -?>