git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@811 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2008-04-11 06:14:59 +00:00
parent 1fd2fe084b
commit ce8d6f71fd
22 changed files with 104 additions and 63 deletions

View File

@ -2,7 +2,6 @@
/**
* Name: Comment Word Ban
* Author: Shish <webmaster@shishnet.org>
* Link: http://trac.shishnet.org/shimmie2/
* License: GPLv2
* Description: For stopping spam and other comment abuse
*/

View File

@ -1,4 +1,10 @@
<?php
/**
* Name: Bulk Add
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Bulk add server-side images
*/
class BulkAdd extends Extension {
var $theme;

View File

@ -1,4 +1,10 @@
<?php
/**
* Name: Downtime
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Show a "down for maintenance" page
*/
class Downtime extends Extension {
var $theme;

View File

@ -2,7 +2,6 @@
/**
* Name: Emoticon Filter
* Author: Shish <webmaster@shishnet.org>
* Link: http://trac.shishnet.org/shimmie2/
* License: GPLv2
* Description: Turn :smile: into a link to smile.gif
*/

View File

@ -1,4 +1,10 @@
<?php
/**
* Name: System Info
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Show various bits of system information, for debugging
*/
class ET extends Extension {
var $theme;

View File

@ -2,7 +2,6 @@
/**
* Name: EventLog
* Author: Shish <webmaster@shishnet.org>
* Link: http://trac.shishnet.org/shimmie2/
* License: GPLv2
* Description: A log of things that happen, for abuse tracking
*/

View File

@ -2,7 +2,6 @@
/**
* Name: Home Extension
* Author: Bzchan <bzchan@animemahou.com>
* 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

View File

@ -1,4 +1,10 @@
<?php
/**
* Name: IP Ban
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Ban IP addresses
*/
// RemoveIPBanEvent {{{
class RemoveIPBanEvent extends Event {

View File

@ -1,4 +1,10 @@
<?php
/**
* Name: News
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Show a short amonut of text in a block on the post list
*/
class News extends Extension {
var $theme;

View File

@ -2,7 +2,6 @@
/**
* Name: Image Scores (Numeric)
* Author: Shish <webmaster@shishnet.org>
* Link: http://trac.shishnet.org/shimmie2/
* License: GPLv2
* Description: Allow users to score images
*/

View File

@ -1,4 +1,10 @@
<?php
/**
* Name: Regen Thumb
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Regenerate a thumbnail image
*/
class RegenThumb extends Extension {
var $theme;

View File

@ -1,5 +1,4 @@
<?php
/*
* Name: Report Images
* Author: ATravelingGeek <atg@atravelinggeek.com>

View File

@ -2,7 +2,6 @@
/**
* Name: Resolution Limiter
* Author: Shish <webmaster@shishnet.org>
* Link: http://trac.shishnet.org/shimmie2/
* License: GPLv2
* Description: Allows the admin to set min / max image dimentions
*/

View File

@ -2,7 +2,6 @@
/**
* Name: RSS for Comments
* Author: Shish <webmaster@shishnet.org>
* Link: http://trac.shishnet.org/shimmie2/
* License: GPLv2
* Description: Self explanitory
*/

View File

@ -1,4 +1,11 @@
<?php
/**
* Name: RSS for Images
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Self explanitory
*/
class RSS_Images extends Extension {
// event handling {{{

View File

@ -2,7 +2,6 @@
/**
* Name: Site Description
* Author: Shish <webmaster@shishnet.org>
* Link: http://trac.shishnet.org/shimmie2/
* License: GPLv2
* Description: Sets the "description" meta-info in the page header, for
* eg search engines to read

View File

@ -1,10 +1,10 @@
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Name: Tagger *
* Description: Advanced Tagging v2 *
* Author: Artanis (Erik Youngren) <artanis.00@gmail.com> *
* Do not remove this notice. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Name: Tagger
* Description: Advanced Tagging v2
* Author: Artanis (Erik Youngren) <artanis.00@gmail.com>
* Do not remove this notice.
*/
class Tagger extends Extension {
var $theme;

View File

@ -2,10 +2,8 @@
/**
* Name: Simple Wiki
* Author: Shish <webmaster@shishnet.org>
* 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 {{{

View File

@ -2,7 +2,6 @@
/**
* Name: Word Filter
* Author: Shish <webmaster@shishnet.org>
* Link: http://trac.shishnet.org/shimmie2/
* License: GPLv2
* Description: Simple search and replace
*/

View File

@ -1,4 +1,10 @@
<?php
/**
* Name: Image Zoom
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Scales down too-large images using browser based scaling
*/
class Zoom extends Extension {
var $theme;

View File

@ -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());
?>

View File

@ -8,13 +8,13 @@ class ExtManagerTheme extends Themelet {
<tr><th>Name</th><th>Author</th><th>Description</th><th>Enabled</th></tr>
";
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 .= "
<tr>
" . (