From ce8d6f71fd44417accbb1c56391e591da3bb6bf0 Mon Sep 17 00:00:00 2001 From: shish Date: Fri, 11 Apr 2008 06:14:59 +0000 Subject: [PATCH] and 2.2 git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@811 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/ban_words/main.php | 1 - contrib/bulk_add/main.php | 6 +++ contrib/downtime/main.php | 6 +++ contrib/emoticons/main.php | 1 - contrib/et/main.php | 6 +++ contrib/event_log/main.php | 1 - contrib/home/main.php | 1 - contrib/ipban/main.php | 6 +++ contrib/news/main.php | 6 +++ contrib/numeric_score/main.php | 1 - contrib/regen_thumb/main.php | 6 +++ contrib/report_image/main.php | 1 - contrib/res_limit/main.php | 1 - contrib/rss_comments/main.php | 1 - contrib/rss_images/main.php | 7 +++ contrib/site_description/main.php | 1 - contrib/tagger/main.php | 12 ++--- contrib/wiki/main.php | 4 +- contrib/word_filter/main.php | 1 - contrib/zoom/main.php | 6 +++ ext/ext_manager/main.php | 78 ++++++++++++++++--------------- ext/ext_manager/theme.php | 14 +++--- 22 files changed, 104 insertions(+), 63 deletions(-) diff --git a/contrib/ban_words/main.php b/contrib/ban_words/main.php index b85292a4..57a2727e 100644 --- a/contrib/ban_words/main.php +++ b/contrib/ban_words/main.php @@ -2,7 +2,6 @@ /** * Name: Comment Word Ban * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: For stopping spam and other comment abuse */ diff --git a/contrib/bulk_add/main.php b/contrib/bulk_add/main.php index 89bd891c..0acf5b3d 100644 --- a/contrib/bulk_add/main.php +++ b/contrib/bulk_add/main.php @@ -1,4 +1,10 @@ + * License: GPLv2 + * Description: Bulk add server-side images + */ class BulkAdd extends Extension { var $theme; diff --git a/contrib/downtime/main.php b/contrib/downtime/main.php index 35f4b5f1..79cbf96f 100644 --- a/contrib/downtime/main.php +++ b/contrib/downtime/main.php @@ -1,4 +1,10 @@ + * License: GPLv2 + * Description: Show a "down for maintenance" page + */ class Downtime extends Extension { var $theme; diff --git a/contrib/emoticons/main.php b/contrib/emoticons/main.php index d2f2359a..cfa9ca87 100644 --- a/contrib/emoticons/main.php +++ b/contrib/emoticons/main.php @@ -2,7 +2,6 @@ /** * Name: Emoticon Filter * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: Turn :smile: into a link to smile.gif */ diff --git a/contrib/et/main.php b/contrib/et/main.php index acf46dc7..c9116196 100644 --- a/contrib/et/main.php +++ b/contrib/et/main.php @@ -1,4 +1,10 @@ + * License: GPLv2 + * Description: Show various bits of system information, for debugging + */ class ET extends Extension { var $theme; diff --git a/contrib/event_log/main.php b/contrib/event_log/main.php index cb03873d..d7f66f55 100644 --- a/contrib/event_log/main.php +++ b/contrib/event_log/main.php @@ -2,7 +2,6 @@ /** * Name: EventLog * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: A log of things that happen, for abuse tracking */ diff --git a/contrib/home/main.php b/contrib/home/main.php index 34884a25..f5e21413 100644 --- a/contrib/home/main.php +++ b/contrib/home/main.php @@ -2,7 +2,6 @@ /** * Name: Home Extension * Author: Bzchan -* Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: Extension adds a page "home" containing user specified * links and a counter showing total number of posts. The diff --git a/contrib/ipban/main.php b/contrib/ipban/main.php index 33c18397..df42b5b3 100644 --- a/contrib/ipban/main.php +++ b/contrib/ipban/main.php @@ -1,4 +1,10 @@ + * License: GPLv2 + * Description: Ban IP addresses + */ // RemoveIPBanEvent {{{ class RemoveIPBanEvent extends Event { diff --git a/contrib/news/main.php b/contrib/news/main.php index 43011f8e..a7ef041f 100644 --- a/contrib/news/main.php +++ b/contrib/news/main.php @@ -1,4 +1,10 @@ + * License: GPLv2 + * Description: Show a short amonut of text in a block on the post list + */ class News extends Extension { var $theme; diff --git a/contrib/numeric_score/main.php b/contrib/numeric_score/main.php index d5c30396..f1e1c8d6 100644 --- a/contrib/numeric_score/main.php +++ b/contrib/numeric_score/main.php @@ -2,7 +2,6 @@ /** * Name: Image Scores (Numeric) * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: Allow users to score images */ diff --git a/contrib/regen_thumb/main.php b/contrib/regen_thumb/main.php index b847880a..9e6ded78 100644 --- a/contrib/regen_thumb/main.php +++ b/contrib/regen_thumb/main.php @@ -1,4 +1,10 @@ + * License: GPLv2 + * Description: Regenerate a thumbnail image + */ class RegenThumb extends Extension { var $theme; diff --git a/contrib/report_image/main.php b/contrib/report_image/main.php index 1621eb37..6096e379 100755 --- a/contrib/report_image/main.php +++ b/contrib/report_image/main.php @@ -1,5 +1,4 @@ diff --git a/contrib/res_limit/main.php b/contrib/res_limit/main.php index b7141f3a..26479966 100644 --- a/contrib/res_limit/main.php +++ b/contrib/res_limit/main.php @@ -2,7 +2,6 @@ /** * Name: Resolution Limiter * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: Allows the admin to set min / max image dimentions */ diff --git a/contrib/rss_comments/main.php b/contrib/rss_comments/main.php index edf8c196..969a74bc 100644 --- a/contrib/rss_comments/main.php +++ b/contrib/rss_comments/main.php @@ -2,7 +2,6 @@ /** * Name: RSS for Comments * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: Self explanitory */ diff --git a/contrib/rss_images/main.php b/contrib/rss_images/main.php index 63044335..453f46f4 100644 --- a/contrib/rss_images/main.php +++ b/contrib/rss_images/main.php @@ -1,4 +1,11 @@ + * License: GPLv2 + * Description: Self explanitory + */ + class RSS_Images extends Extension { // event handling {{{ diff --git a/contrib/site_description/main.php b/contrib/site_description/main.php index 3753d2ef..aa1bdc93 100644 --- a/contrib/site_description/main.php +++ b/contrib/site_description/main.php @@ -2,7 +2,6 @@ /** * Name: Site Description * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: Sets the "description" meta-info in the page header, for * eg search engines to read diff --git a/contrib/tagger/main.php b/contrib/tagger/main.php index 1dd6331a..3981747b 100644 --- a/contrib/tagger/main.php +++ b/contrib/tagger/main.php @@ -1,10 +1,10 @@ * - * Do not remove this notice. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/** + * Name: Tagger + * Description: Advanced Tagging v2 + * Author: Artanis (Erik Youngren) + * Do not remove this notice. + */ class Tagger extends Extension { var $theme; diff --git a/contrib/wiki/main.php b/contrib/wiki/main.php index 1139c8f7..38ce433f 100644 --- a/contrib/wiki/main.php +++ b/contrib/wiki/main.php @@ -2,10 +2,8 @@ /** * Name: Simple Wiki * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 - * Description: A simple wiki, for those who don't want the - * hugeness of mediawiki + * Description: A simple wiki, for those who don't want the hugeness of mediawiki */ // WikiUpdateEvent {{{ diff --git a/contrib/word_filter/main.php b/contrib/word_filter/main.php index 8a44b534..b1980f0d 100644 --- a/contrib/word_filter/main.php +++ b/contrib/word_filter/main.php @@ -2,7 +2,6 @@ /** * Name: Word Filter * Author: Shish - * Link: http://trac.shishnet.org/shimmie2/ * License: GPLv2 * Description: Simple search and replace */ diff --git a/contrib/zoom/main.php b/contrib/zoom/main.php index f8193e52..221e7907 100644 --- a/contrib/zoom/main.php +++ b/contrib/zoom/main.php @@ -1,4 +1,10 @@ + * License: GPLv2 + * Description: Scales down too-large images using browser based scaling + */ class Zoom extends Extension { var $theme; diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index 317da020..af50e1c3 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -7,6 +7,40 @@ * Description: A thing for point & click extension management */ +class ExtensionInfo { // {{{ + var $ext_name, $name, $link, $author, $email, $description; + + function ExtensionInfo($main) { + $matches = array(); + $data = file_get_contents($main); + preg_match("#contrib/(.*)/main.php#", $main, $matches); + $this->ext_name = $matches[1]; + $this->name = $matches[1]; + + if(preg_match("/Name: (.*)/", $data, $matches)) { + $this->name = $matches[1]; + } + if(preg_match("/Link: (.*)/", $data, $matches)) { + $this->link = $matches[1]; + } + if(preg_match("/Author: (.*) [<\(](.*@.*)[>\)]/", $data, $matches)) { + $this->author = $matches[1]; + $this->email = $matches[2]; + } + else if(preg_match("/Author: (.*)/", $data, $matches)) { + $this->author = $matches[1]; + } + if(preg_match("/Description: (.*)/", $data, $matches)) { + $this->description = $matches[1]; + } + $this->enabled = $this->is_enabled($this->ext_name); + } + + private function is_enabled($fname) { + return file_exists("ext/$fname"); + } +} // }}} + class ExtManager extends Extension { var $theme; @@ -42,37 +76,11 @@ class ExtManager extends Extension { private function get_extensions() { $extensions = array(); foreach(glob("contrib/*/main.php") as $main) { - $extension = array(); - $matches = array(); - $data = file_get_contents($main); - preg_match("#contrib/(.*)/main.php#", $main, $matches); - $extension["ext_name"] = $matches[1]; - if(preg_match("/Name: (.*)/", $data, $matches)) { - $extension["name"] = $matches[1]; - } - if(preg_match("/Link: (.*)/", $data, $matches)) { - $extension["link"] = $matches[1]; - } - if(preg_match("/Author: (.*) [<\(](.*@.*)[>\)]/", $data, $matches)) { - $extension["author"] = $matches[1]; - $extension["email"] = $matches[2]; - } - else if(preg_match("/Author: (.*)/", $data, $matches)) { - $extension["author"] = $matches[1]; - } - if(preg_match("/Description: (.*)/", $data, $matches)) { - $extension["description"] = $matches[1]; - } - $extension["enabled"] = $this->is_enabled($extension["ext_name"]); - $extensions[] = $extension; + $extensions[] = new ExtensionInfo($main); } return $extensions; } - private function is_enabled($fname) { - return file_exists("ext/$fname"); - } - private function set_things($settings) { foreach(glob("contrib/*/main.php") as $main) { $matches = array(); @@ -88,7 +96,12 @@ class ExtManager extends Extension { if($enabled) { // enable if currently disabled if(!file_exists("ext/$fname")) { - $this->enable_extension($fname); + if(function_exists("symlink")) { + symlink("../contrib/$fname", "ext/$fname"); + } + else { + full_copy("contrib/$fname", "ext/$fname"); + } } } else { @@ -98,15 +111,6 @@ class ExtManager extends Extension { } } } - - private function enable_extension($fname) { - if(function_exists("symlink")) { - symlink("../contrib/$fname", "ext/$fname"); - } - else { - full_copy("contrib/$fname", "ext/$fname"); - } - } } add_event_listener(new ExtManager()); ?> diff --git a/ext/ext_manager/theme.php b/ext/ext_manager/theme.php index 6faaace8..8de6f4b3 100644 --- a/ext/ext_manager/theme.php +++ b/ext/ext_manager/theme.php @@ -8,13 +8,13 @@ class ExtManagerTheme extends Themelet { NameAuthorDescriptionEnabled "; foreach($extensions as $extension) { - $ext_name = $extension["ext_name"]; - $h_name = empty($extension["name"]) ? $ext_name : html_escape($extension["name"]); - $h_email = html_escape($extension["email"]); - $h_link = isset($extension["link"]) ? html_escape($extension["link"]) : ""; - $h_author = html_escape($extension["author"]); - $h_description = html_escape($extension["description"]); - $h_enabled = $extension["enabled"] ? " checked='checked'" : ""; + $ext_name = $extension->ext_name; + $h_name = empty($extension->name) ? $ext_name : html_escape($extension->name); + $h_email = html_escape($extension->email); + $h_link = isset($extension->link) ? html_escape($extension->link) : ""; + $h_author = html_escape($extension->author); + $h_description = html_escape($extension->description); + $h_enabled = $extension->enabled ? " checked='checked'" : ""; $html .= " " . (