diff --git a/contrib/autocomplete/main.php b/contrib/autocomplete/main.php index 461dbd6f..cee08e4e 100644 --- a/contrib/autocomplete/main.php +++ b/contrib/autocomplete/main.php @@ -4,6 +4,9 @@ * Author: Shish * License: GPLv2 * Description: Auto-complete for search and upload tags + * Documentation: + * Just enable and things should start autocompleting as if + * by magic. That is, if this extension actually worked... */ class AutoComplete implements Extension { diff --git a/contrib/ban_words/main.php b/contrib/ban_words/main.php index be86d052..d03ae3be 100644 --- a/contrib/ban_words/main.php +++ b/contrib/ban_words/main.php @@ -4,6 +4,19 @@ * Author: Shish * License: GPLv2 * Description: For stopping spam and other comment abuse + * Documentation: + * Allows an administrator to ban certain words + * from comments. This can be a very simple but effective way + * of stopping spam; just add "viagra", "porn", etc to the + * banned words list. + *

Regex bans are also supported, allowing more complicated + * bans like /http:.*\.cn\// to block links to + * chinese websites, or /.*?http.*?http.*?http.*?http.*?/ + * to block comments with four (or more) links in. + *

Note that for non-regex matches, only whole words are + * matched, eg banning "sex" would block the comment "get free + * sex call this number", but allow "This is a photo of Bob + * from Essex" */ class BanWords implements Extension { diff --git a/contrib/bulk_add/main.php b/contrib/bulk_add/main.php index 283e5938..14640627 100644 --- a/contrib/bulk_add/main.php +++ b/contrib/bulk_add/main.php @@ -4,6 +4,13 @@ * Author: Shish * License: GPLv2 * Description: Bulk add server-side images + * Documentation: + * Upload the images into a new directory via ftp or similar, + * go to shimmie's admin page and put that directory in the + * bulk add box. If there are subdirectories, they get used + * as tags (eg if you upload into /home/bob/uploads/holiday/2008/ + * and point shimmie ad /home/bob/uploads, then images will be + * tagged "holiday 2008") */ class BulkAdd implements Extension { diff --git a/contrib/emoticons/main.php b/contrib/emoticons/main.php index 9cc1d34f..faa7721e 100644 --- a/contrib/emoticons/main.php +++ b/contrib/emoticons/main.php @@ -3,7 +3,13 @@ * Name: Emoticon Filter * Author: Shish * License: GPLv2 - * Description: Turn :smile: into a link to smile.gif + * Description: Lets users use graphical smilies + * Documentation: + * This extension will turn colon-something-colon into a link + * to an image with that something as the name, eg :smile: + * becomes a link to smile.gif + *

Images are stored in /ext/emoticons/default/, and you can + * add more emoticons by uploading images into that folder. */ class Emoticons extends FormatterExtension { diff --git a/contrib/et/main.php b/contrib/et/main.php index 4ca4ef96..02b0a4de 100644 --- a/contrib/et/main.php +++ b/contrib/et/main.php @@ -3,7 +3,13 @@ * Name: System Info * Author: Shish * License: GPLv2 - * Description: Show various bits of system information, for debugging + * Description: Show various bits of system information + * Documentation: + * Knowing the information that this extension shows can be + * very useful for debugging. There's also an option to send + * your stats to my database, so I can get some idea of how + * shimmie is used, which servers I need to support, which + * versions of PHP I should test with, etc. */ class ET implements Extension { diff --git a/contrib/featured/main.php b/contrib/featured/main.php index 089afcbc..6344fea7 100644 --- a/contrib/featured/main.php +++ b/contrib/featured/main.php @@ -4,6 +4,11 @@ * Author: Shish * License: GPLv2 * Description: Bring a specific image to the users' attentions + * Documentation: + * Once enabled, a new "feature this" button will appear next + * to the other image control buttons (delete, rotate, etc). + * Clicking it will set the image as the site's current feature, + * which will be shown in the side bar of the post list. */ class Featured implements Extension { diff --git a/contrib/handle_archive/main.php b/contrib/handle_archive/main.php index 71499a5e..b5baf990 100644 --- a/contrib/handle_archive/main.php +++ b/contrib/handle_archive/main.php @@ -3,6 +3,11 @@ * Name: Archive File Handler * Author: Shish * Description: Allow users to upload archives (zip, etc) + * Documentation: + * Note: requires exec() access and an external unzip command + *

Any command line unzipper should work, some examples: + *

unzip: unzip -d "%d" "%f" + *
7-zip: 7zr x -o"%d" "%f" */ class ArchiveFileHandler implements Extension { diff --git a/contrib/home/main.php b/contrib/home/main.php index 64c291e6..ec03fee5 100644 --- a/contrib/home/main.php +++ b/contrib/home/main.php @@ -1,11 +1,17 @@ * License: GPLv2 -* Description: Extension adds a page "home" containing user specified -* links and a counter showing total number of posts. The -* page is accessed via /home. +* Description: Displays a front page with logo, search box and image count +* Documentation: +* Once enabled, the page will show up at the URL "home", so if you want +* this to be the front page of your site, you should go to "Board Config" +* and set "Front Page" to "home". +*

The images used for the numbers can be changed from the board config +* page. If you want to use your own numbers, upload them into a new folder +* in /ext/home/counters, and they'll become available +* alongside the default choices. */ class Home implements Extension { diff --git a/contrib/ipban/main.php b/contrib/ipban/main.php index 2c804dc8..72f58c96 100644 --- a/contrib/ipban/main.php +++ b/contrib/ipban/main.php @@ -4,7 +4,11 @@ * Author: Shish * License: GPLv2 * Description: Ban IP addresses - * Link: http://trac.shishnet.org/shimmie2/wiki/Contrib/Extensions/IPBan + * Documentation: + * Adding a Ban + *
IP: Can be a single IP (eg. 123.234.210.21), or a CIDR block (eg. 152.23.43.0/24) + *
Reason: Any text, for the admin to remember why the ban was put in place + *
Until: Either a date in YYYY-MM-DD format, or an offset like "3 days" */ // RemoveIPBanEvent {{{ diff --git a/contrib/link_image/main.php b/contrib/link_image/main.php index 919539ef..3137d795 100644 --- a/contrib/link_image/main.php +++ b/contrib/link_image/main.php @@ -10,8 +10,8 @@ class LinkImage implements Extension { public function receive_event(Event $event) { if(is_null($this->theme)) $this->theme = get_theme_object($this); if(($event instanceof DisplayingImageEvent)) { - global $config; - $data_href = get_base_href(); + global $config; + $data_href = get_base_href(); $event->page->add_header("",0); $this->theme->links_block($event->page,$this->data($event->image)); @@ -21,11 +21,11 @@ class LinkImage implements Extension { $sb->add_text_option("ext_link-img_text-link_format", "Text Link Format: "); $event->panel->add_block($sb); } - if($event instanceof InitExtEvent) { - global $config; - //just set default if empty. + if($event instanceof InitExtEvent) { + global $config; + //just set default if empty. $config->set_default_string("ext_link-img_text-link_format", - '$title - $id ($ext $size $filesize)'); + '$title - $id ($ext $size $filesize)'); } } private function data($image) { diff --git a/contrib/news/main.php b/contrib/news/main.php index b6262a8d..efa13eaa 100644 --- a/contrib/news/main.php +++ b/contrib/news/main.php @@ -3,7 +3,9 @@ * Name: News * Author: Shish * License: GPLv2 - * Description: Show a short amonut of text in a block on the post list + * Description: Show a short amount of text in a block on the post list + * Documentation: + * Any HTML is allowed */ class News implements Extension { diff --git a/contrib/notes/main.php b/contrib/notes/main.php index 09a8b3d8..dd1483fa 100644 --- a/contrib/notes/main.php +++ b/contrib/notes/main.php @@ -4,6 +4,8 @@ * Author: Shish * License: GPLv2 * Description: Adds notes overlaid on the images + * Documentation: + * This is quite broken :( */ class Notes implements Extension { diff --git a/contrib/numeric_score/main.php b/contrib/numeric_score/main.php index 36e51a9f..41892c81 100644 --- a/contrib/numeric_score/main.php +++ b/contrib/numeric_score/main.php @@ -4,6 +4,9 @@ * Author: Shish * License: GPLv2 * Description: Allow users to score images + * Documentation: + * Each registered user may vote an image +1 or -1, the + * image's score is the sum of all votes. */ class NumericScoreSetEvent extends Event { diff --git a/contrib/piclens/main.php b/contrib/piclens/main.php index c1a2ca32..679ac7a2 100644 --- a/contrib/piclens/main.php +++ b/contrib/piclens/main.php @@ -4,6 +4,11 @@ * Author: Shish * License: GPLv2 * Description: Adds a link to piclensify the gallery + * Documentation: + * This extension only provides a button to the javascript + * version of the gallery; the "RSS for Images" extension + * is piclens-compatible to start with. (And that extension + * must be active for this one to do anything useful) */ class PicLens implements Extension { public function receive_event(Event $event) { diff --git a/contrib/pm/main.php b/contrib/pm/main.php index 20426f73..9ee63db8 100644 --- a/contrib/pm/main.php +++ b/contrib/pm/main.php @@ -4,6 +4,10 @@ * Author: Shish * License: GPLv2 * Description: Allow users to send messages to eachother + * Documentation: + * PMs show up on a user's profile page, readable by that user + * as well as board admins. To send a PM, visit another user's + * profile page and a box will be shown. */ class SendPMEvent extends Event { diff --git a/contrib/random_image/main.php b/contrib/random_image/main.php index b067ba0d..5e78c8b0 100644 --- a/contrib/random_image/main.php +++ b/contrib/random_image/main.php @@ -4,7 +4,19 @@ * Author: Shish * License: GPLv2 * Description: Do things with a random image - * Link: http://trac.shishnet.org/shimmie2/wiki/Contrib/Extensions/RandomImage + * Documentation: + * Viewing a random image + *
Visit /random_image/view + *

Downloading a random image + *
Link to /random_image/download. This will give + * the raw data for an image (no HTML). This is useful so that you + * can set your desktop wallpaper to be the download URL, refreshed + * every couple of hours. + *

Getting a random image from a subset + *
Adding a slash and some search terms will get a random image + * from those results. This can be useful if you want a specific size + * of random image, or from a category. You could link to + * /random_image/download/size:1024x768+cute */ class RandomImage implements Extension { diff --git a/contrib/rating/main.php b/contrib/rating/main.php index f879b692..63e4023f 100644 --- a/contrib/rating/main.php +++ b/contrib/rating/main.php @@ -3,7 +3,7 @@ * Name: Image Ratings * Author: Shish * License: GPLv2 - * Description: Allow users to rate images + * Description: Allow users to rate images "safe", "questionable" or "explicit" */ class RatingSetEvent extends Event { diff --git a/contrib/regen_thumb/main.php b/contrib/regen_thumb/main.php index 0b312396..c94f3e4b 100644 --- a/contrib/regen_thumb/main.php +++ b/contrib/regen_thumb/main.php @@ -4,6 +4,12 @@ * Author: Shish * License: GPLv2 * Description: Regenerate a thumbnail image + * Documentation: + * This adds a button in the image control section on an + * image's view page, which allows an admin to regenerate + * an image's thumbnail; useful for instance if the first + * attempt failed due to lack of memory, and memory has + * since been increased. */ class RegenThumb implements Extension { diff --git a/contrib/site_description/main.php b/contrib/site_description/main.php index d76117fb..486e59a2 100644 --- a/contrib/site_description/main.php +++ b/contrib/site_description/main.php @@ -3,8 +3,10 @@ * Name: Site Description * Author: Shish * License: GPLv2 - * Description: Sets the "description" meta-info in the page header, for - * eg search engines to read + * Description: A description for search engines + * Documentation: + * This extension sets the "description" meta tag in the header + * of pages so that search engines can pick it up */ class SiteDescription implements Extension { public function receive_event(Event $event) { diff --git a/contrib/svn_update/main.php b/contrib/svn_update/main.php index 2739851d..f4d02b51 100644 --- a/contrib/svn_update/main.php +++ b/contrib/svn_update/main.php @@ -4,6 +4,12 @@ * Author: Shish * License: GPLv2 * Description: Provides a button to check for updates + * Documentation: + * This is a very risky idea, implemented without safeguards. + * If you've done a clean SVN checkout, then updating will + * normally work fine; but if you've made changes in one way, + * and SVN has changed something in a different way, then there + * will be conflicts and the site will die :( */ class SVNUpdate implements Extension { diff --git a/contrib/text_score/main.php b/contrib/text_score/main.php index 236bc27f..0dd663de 100644 --- a/contrib/text_score/main.php +++ b/contrib/text_score/main.php @@ -4,6 +4,11 @@ * Author: Shish * License: GPLv2 * Description: Allow users to score images + * Documentation: + * Similar to the Image Scores (Numeric) extension, but this one + * uses an average rather than the sum of all votes, which means + * that the score will be [-2 .. +2], and each integer in that + * range has a label attached. */ class TextScoreSetEvent extends Event { diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index 6795e3c2..61156100 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -8,7 +8,7 @@ */ class ExtensionInfo { // {{{ - var $ext_name, $name, $link, $author, $email, $description; + var $ext_name, $name, $link, $author, $email, $description, $documentation; function ExtensionInfo($main) { $matches = array(); @@ -25,6 +25,9 @@ class ExtensionInfo { // {{{ } if(preg_match("/Link: (.*)/", $line, $matches)) { $this->link = $matches[1]; + if($this->link[0] == "/") { + $this->link = make_link(substr($this->link, 1)); + } } if(preg_match("/Author: (.*) [<\(](.*@.*)[>\)]/", $line, $matches)) { $this->author = $matches[1]; @@ -33,12 +36,21 @@ class ExtensionInfo { // {{{ else if(preg_match("/Author: (.*)/", $line, $matches)) { $this->author = $matches[1]; } - if(preg_match("/(.*)Description: (.*)/", $line, $matches)) { + if(preg_match("/(.*)Description: ?(.*)/", $line, $matches)) { $this->description = $matches[2]; $start = $matches[1]." "; $start_len = strlen($start); while(substr($lines[$i+1], 0, $start_len) == $start) { - $this->description .= substr($lines[$i+1], $start_len); + $this->description .= " ".substr($lines[$i+1], $start_len); + $i++; + } + } + if(preg_match("/(.*)Documentation: ?(.*)/", $line, $matches)) { + $this->documentation = $matches[2]; + $start = $matches[1]." "; + $start_len = strlen($start); + while(substr($lines[$i+1], 0, $start_len) == $start) { + $this->documentation .= " ".substr($lines[$i+1], $start_len); $i++; } } @@ -46,6 +58,9 @@ class ExtensionInfo { // {{{ break; } } + if(is_null($this->link) && !is_null($this->documentation)) { + $this->link = make_link("ext_doc/{$this->ext_name}"); + } } private function is_enabled($fname) { @@ -81,6 +96,12 @@ class ExtManager implements Extension { } } + if(($event instanceof PageRequestEvent) && $event->page_matches("ext_doc")) { + $ext = $event->get_arg(0); + $info = new ExtensionInfo("contrib/$ext/main.php"); + $this->theme->display_doc($event->page, $info); + } + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("Extension Manager", make_link("ext_manager")); diff --git a/ext/ext_manager/theme.php b/ext/ext_manager/theme.php index f8292c12..187e0000 100644 --- a/ext/ext_manager/theme.php +++ b/ext/ext_manager/theme.php @@ -43,5 +43,13 @@ class ExtManagerTheme extends Themelet { $page->add_block(new NavBlock()); $page->add_block(new Block("Extension Manager", $html)); } + + public function display_doc(Page $page, ExtensionInfo $info) { + $html = "

".$info->documentation."
"; + $page->set_title("Documentation for ".html_escape($info->name)); + $page->set_heading(html_escape($info->name)); + $page->add_block(new NavBlock()); + $page->add_block(new Block("Documentation", $html)); + } } ?> diff --git a/themes/default/style.css b/themes/default/style.css index 329c3cac..45d8d28a 100644 --- a/themes/default/style.css +++ b/themes/default/style.css @@ -33,6 +33,10 @@ TD { vertical-align: top; text-align: center; } +CODE { + background: #DEDEDE; + font-size: 0.8em; +} #subtitle { width: 256px; font-size: 0.75em;