ExtensionInfo conversions what have I done

This commit is contained in:
Matthew Barbour 2019-08-07 14:53:59 -05:00 committed by matthew
parent 3d1b964812
commit de98e86938
212 changed files with 3449 additions and 1628 deletions

View file

@ -22,12 +22,11 @@ $tracer_enabled = constant('TRACE_FILE')!==null;
// load base files
$_tracer->begin("Bootstrap");
$_tracer->begin("Opening files");
$_tracer->begin("Opening core files");
$_shm_files = array_merge(
zglob("core/*.php"),
zglob("core/{".ENABLED_MODS."}/*.php"),
zglob("ext/{".ENABLED_EXTS."}/info.php"),
zglob("ext/{".ENABLED_EXTS."}/main.php")
zglob("ext/*/info.php")
);
foreach ($_shm_files as $_shm_filename) {
if (basename($_shm_filename)[0] != "_") {
@ -38,6 +37,22 @@ unset($_shm_files);
unset($_shm_filename);
$_tracer->end();
$_tracer->begin("Loading extension info");
ExtensionInfo::load_all_extension_info();
Extension::determine_enabled_extensions();
$_tracer->end();
$_tracer->begin("Opening enabled extension files");
$_shm_files = zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/main.php");
foreach ($_shm_files as $_shm_filename) {
if (basename($_shm_filename)[0] != "_") {
require_once $_shm_filename;
}
}
unset($_shm_files);
unset($_shm_filename);
$_tracer->end();
// connect to the database
$_tracer->begin("Connecting to DB");
$database = new Database();
@ -53,8 +68,7 @@ unset($themelet);
$page = class_exists("CustomPage") ? new CustomPage() : new Page();
$_tracer->end();
// hook up event handlers
$_tracer->begin("Loading extensions");
$_tracer->begin("Loading extensions/event listeners");
_load_event_listeners();
$_tracer->end();

View file

@ -83,32 +83,24 @@
*/
abstract class Extension
{
/** @var array which DBs this ext supports (blank for 'all') */
protected $db_support = [];
public $key;
/** @var Themelet this theme's Themelet object */
public $theme;
public $info;
public function __construct()
{
$class = get_called_class();
$this->theme = $this->get_theme_object($class);
$this->info = ExtensionInfo::get_for_extension($class);
}
private static $enabled_extensions = [];
public function is_supported(): bool
public function __construct($class = null)
{
if($this->info!=null) {
return $this->info->supported;
} else {
global $database;
return (
empty($this->db_support) ||
in_array($database->get_driver_name(), $this->db_support)
);
$class = $class ?? get_called_class();
$this->theme = $this->get_theme_object($class);
$this->info = ExtensionInfo::get_for_extension_class($class);
if($this->info===null) {
throw new Exception("Info class not found for extension $class");
}
$this->key = $this->info->key;
}
/**
@ -136,45 +128,183 @@ abstract class Extension
{
return 50;
}
public static function determine_enabled_extensions()
{
self::$enabled_extensions = [];
foreach(array_merge(ExtensionInfo::get_core_extensions(),
explode(",", EXTRA_EXTS)) as $key) {
$ext = ExtensionInfo::get_by_key($key);
if($ext===null) {
continue;
}
self::$enabled_extensions[] = $ext->key;
}
}
public static function is_enabled(string $key): ?bool
{
return in_array($key, self::$enabled_extensions);
}
public static function get_enabled_extensions(): array
{
return self::$enabled_extensions;
}
public static function get_enabled_extensions_as_string(): string
{
return implode(",",self::$enabled_extensions);
}
}
abstract class ExtensionInfo
{
// Every credit you get costs us RAM. It stops now.
public const SHISH_NAME = "Shish";
public const SHISH_EMAIL = "webmaster@shishnet.org";
public const SHIMMIE_URL = "http://code.shishnet.org/shimmie2/";
public const SHISH_AUTHOR = [self::SHISH_NAME=>self::SHISH_EMAIL];
public const LICENSE_GPLV2 = "GPLv2";
public const LICENSE_MIT = "MIT";
public const LICENSE_WTFPL = "WTFPL";
public const VISIBLE_ADMIN = "admin";
private const VALID_VISIBILITY = [self::VISIBLE_ADMIN];
public $key;
public $core = false;
public $beta = false;
public $name;
public $authors;
public $authors = [];
public $link;
public $license;
public $version;
public $visibility;
public $description;
public $documentation;
public $supported;
public $db_support;
public function __construct()
{
$this->supported = $this->is_supported();
}
/** @var array which DBs this ext supports (blank for 'all') */
public $db_support = [];
private $supported = null;
private $support_info = null;
public function is_supported(): bool
{
global $database;
return (
empty($this->db_support) ||
in_array($database->get_driver_name(), $this->db_support)
);
if($this->supported===null) {
$this->check_support();
}
return $this->supported;
}
public static function get_for_extension(string $base): ?ExtensionInfo
public function get_support_info(): string
{
if($this->supported===null) {
$this->check_support();
}
return $this->support_info;
}
private static $all_info_by_key = [];
private static $all_info_by_class = [];
private static $core_extensions = [];
protected function __construct()
{
if(empty($this->key)) {
throw new Exception("key field is required");
}
if(empty($this->name)) {
throw new Exception("name field is required for extension $this->key");
}
if(!empty($this->visibility)&&!in_array($this->visibility, self::VALID_VISIBILITY)) {
throw new Exception("Invalid visibility for extension $this->key");
}
if(!is_array($this->db_support)) {
throw new Exception("db_support has to be an array for extension $this->key");
}
if(!is_array($this->authors)) {
throw new Exception("authors has to be an array for extension $this->key");
}
}
public function is_enabled(): bool
{
return Extension::is_enabled($this->key);
}
private function check_support()
{
global $database;
$this->support_info = "";
if(!empty($this->db_support)&&!in_array($database->get_driver_name(), $this->db_support)) {
$this->support_info .= "Database not supported. ";
}
// Additional checks here as needed
$this->supported = empty($this->support_info);
}
public static function get_all(): array
{
return array_values(self::$all_info_by_key);
}
public static function get_all_keys(): array
{
return array_keys(self::$all_info_by_key);
}
public static function get_core_extensions(): array
{
return self::$core_extensions;
}
public static function get_by_key(string $key): ?ExtensionInfo
{
if(array_key_exists($key, self::$all_info_by_key)) {
return self::$all_info_by_key[$key];
} else {
return null;
}
}
public static function get_for_extension_class(string $base): ?ExtensionInfo
{
$normal = $base.'Info';
if (class_exists($normal)) {
return new $normal();
if (array_key_exists($normal, self::$all_info_by_class)) {
return self::$all_info_by_class[$normal];
} else {
return null;
}
}
public static function load_all_extension_info()
{
foreach (get_declared_classes() as $class) {
$rclass = new ReflectionClass($class);
if ($rclass->isAbstract()) {
// don't do anything
} elseif (is_subclass_of($class, "ExtensionInfo")) {
$extension_info = new $class();
if(array_key_exists($extension_info->key, self::$all_info_by_key)) {
throw new Exception("Extension Info $class with key $extension_info->key has already been loaded");
}
self::$all_info_by_key[$extension_info->key] = $extension_info;
self::$all_info_by_class[$class] = $extension_info;
if($extension_info->core===true) {
self::$core_extensions[] = $extension_info->key;
}
}
}
}
}
/**

View file

@ -468,7 +468,7 @@ class Page
/*** Generate CSS cache files ***/
$css_latest = $config_latest;
$css_files = array_merge(
zglob("ext/{" . ENABLED_EXTS . "}/style.css"),
zglob("ext/{" . Extension::get_enabled_extensions_as_string() . "}/style.css"),
zglob("themes/$theme_name/style.css")
);
foreach ($css_files as $css) {
@ -499,7 +499,7 @@ class Page
"vendor/bower-asset/js-cookie/src/js.cookie.js",
"ext/handle_static/modernizr-3.3.1.custom.js",
],
zglob("ext/{" . ENABLED_EXTS . "}/script.js"),
zglob("ext/{" . Extension::get_enabled_extensions_as_string() . "}/script.js"),
zglob("themes/$theme_name/script.js")
);
foreach ($js_files as $js) {

View file

@ -44,7 +44,7 @@ function _set_event_listeners(): void
$extension = new $class();
// skip extensions which don't support our current database
if (!$extension->is_supported()) {
if (!$extension->info->is_supported()) {
continue;
}
@ -88,16 +88,6 @@ function _dump_event_listeners(array $event_listeners, string $path): void
file_put_contents($path, $p);
}
function ext_is_live(string $ext_name): bool
{
if (class_exists($ext_name)) {
/** @var Extension $ext */
$ext = new $ext_name();
return $ext->is_supported();
}
return false;
}
/** @private */
global $_shm_event_count;

View file

@ -40,7 +40,6 @@ _d("SEARCH_ACCEL", false); // boolean use search accelerator
_d("WH_SPLITS", 1); // int how many levels of subfolders to put in the warehouse
_d("VERSION", '2.7-beta'); // string shimmie version
_d("TIMEZONE", null); // string timezone
_d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,handle_static,comment,tag_list,index,tag_edit,alias_editor,media,help_pages,system"); // extensions to always enable
_d("EXTRA_EXTS", ""); // string optional extra extensions
_d("BASE_URL", null); // string force a specific base URL (default is auto-detect)
_d("MIN_PHP_VERSION", '7.1');// string minimum supported PHP version
@ -53,4 +52,3 @@ _d("ENABLED_MODS", "imageboard");
* directly, only the things they're built from
*/
_d("SCORE_VERSION", 'develop/'.VERSION); // string SCore version
_d("ENABLED_EXTS", CORE_EXTS.",".EXTRA_EXTS);

33
ext/admin/info.php Normal file
View file

@ -0,0 +1,33 @@
<?php
/**
* Name: Admin Controls
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Various things to make admins' lives easier
* Documentation:
*/
class AdminPageInfo extends ExtensionInfo
{
public const KEY = "admin";
public $key = self::KEY;
public $name = "Admin Controls";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Various things to make admins' lives easier";
public $documentation =
"Various moderate-level tools for admins; for advanced, obscure, and possibly dangerous tools see the shimmie2-utils script set
<p>Lowercase all tags:
<br>Set all tags to lowercase for consistency
<p>Recount tag use:
<br>If the counts of images per tag get messed up somehow, this will reset them, and remove any unused tags
<p>Database dump:
<br>Download the contents of the database in plain text format, useful for backups.
<p>Image dump:
<br>Download all the images as a .zip file (Requires ZipArchive)";
}

View file

@ -1,24 +1,4 @@
<?php
/**
* Name: Admin Controls
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Various things to make admins' lives easier
* Documentation:
* Various moderate-level tools for admins; for advanced, obscure, and
* possibly dangerous tools see the shimmie2-utils script set
* <p>Lowercase all tags:
* <br>Set all tags to lowercase for consistency
* <p>Recount tag use:
* <br>If the counts of images per tag get messed up somehow, this will
* reset them, and remove any unused tags
* <p>Database dump:
* <br>Download the contents of the database in plain text format, useful
* for backups.
* <p>Image dump:
* <br>Download all the images as a .zip file (Requires ZipArchive)
*/
/**
* Sent when the admin page is ready to be added to

View file

@ -60,7 +60,7 @@ class AdminPageTheme extends Themelet
public function dbq_html($terms)
{
if(ext_is_live("Trash")) {
if(Extension::is_enabled(TrashInfo::KEY)) {
$warning = "This delete method will bypass the trash<br/>";
}
if (class_exists("ImageBan")) {

24
ext/alias_editor/info.php Normal file
View file

@ -0,0 +1,24 @@
<?php
/**
* Name: Alias Editor
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Edit the alias list
* Documentation:
*/
class AliasEditorInfo extends ExtensionInfo
{
public const KEY = "alias_editor";
public $key = self::KEY;
public $name = "Alias Editor";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Edit the alias list";
public $documentation = 'The list is visible at <a href="$site/alias/list">/alias/list</a>; only site admins can edit it, other people can view and download it';
public $core = true;
}

View file

@ -1,14 +1,4 @@
<?php
/**
* Name: Alias Editor
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Edit the alias list
* Documentation:
* The list is visible at <a href="$site/alias/list">/alias/list</a>; only
* site admins can edit it, other people can view and download it
*/
class AddAliasEvent extends Event
{

View file

@ -0,0 +1,23 @@
<?php
/**
* Name: Arrow Key Navigation
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com/
* License: GPLv2
* Description: Allows viewers no navigate between images using the left & right arrow keys.
* Documentation:
* Simply enable this extention in the extention manager to enable arrow key navigation.
*/
class ArrowkeyNavigationInfo extends ExtensionInfo
{
public const KEY = "arrowkey_navigation";
public $key = self::KEY;
public $name = "Arrow Key Navigation";
public $url = "http://www.drudexsoftware.com/";
public $authors = ["Drudex Software"=>"support@drudexsoftware.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Allows viewers no navigate between images using the left & right arrow keys.";
public $documentation =
"Simply enable this extension in the extension manager to enable arrow key navigation.";
}

View file

@ -1,13 +1,5 @@
<?php
/**
* Name: Arrow Key Navigation
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com/
* License: GPLv2
* Description: Allows viewers no navigate between images using the left & right arrow keys.
* Documentation:
* Simply enable this extention in the extention manager to enable arrow key navigation.
*/
class ArrowkeyNavigation extends Extension
{
/**

23
ext/artists/info.php Normal file
View file

@ -0,0 +1,23 @@
<?php
/**
* Name: [Beta] Artists System
* Author: Sein Kraft <mail@seinkraft.info>
* Alpha <alpha@furries.com.ar>
* License: GPLv2
* Description: Simple artists extension
* Documentation:
*
*/
class ArtistsInfo extends ExtensionInfo
{
public const KEY = "artists";
public $key = self::KEY;
public $name = "Artists System";
public $url = self::SHIMMIE_URL;
public $authors = ["Sein Kraft"=>"mail@seinkraft.info","Alpha"=>"alpha@furries.com.ar"];
public $license = self::LICENSE_GPLV2;
public $description = "Simple artists extension";
public $beta = true;
}

View file

@ -1,13 +1,5 @@
<?php
/**
* Name: [Beta] Artists System
* Author: Sein Kraft <mail@seinkraft.info>
* Alpha <alpha@furries.com.ar>
* License: GPLv2
* Description: Simple artists extension
* Documentation:
*
*/
class AuthorSetEvent extends Event
{
/** @var Image */

17
ext/autocomplete/info.php Normal file
View file

@ -0,0 +1,17 @@
<?php
/*
* Name: Autocomplete
* Author: Daku <admin@codeanimu.net>
* Description: Adds autocomplete to search & tagging.
*/
class AutoCompleteInfo extends ExtensionInfo
{
public const KEY = "autocomplete";
public $key = self::KEY;
public $name = "Autocomplete";
public $authors = ["Daku"=>"admin@codeanimu.net"];
public $description = "Adds autocomplete to search & tagging.";
}

View file

@ -1,9 +1,4 @@
<?php
/*
* Name: Autocomplete
* Author: Daku <admin@codeanimu.net>
* Description: Adds autocomplete to search & tagging.
*/
class AutoComplete extends Extension
{

36
ext/ban_words/info.php Normal file
View file

@ -0,0 +1,36 @@
<?php
/*
* Name: Comment Word Ban
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: For stopping spam and other comment abuse
* Documentation:
*
*/
class BanWordsInfo extends ExtensionInfo
{
public const KEY = "ban_words";
public $key = self::KEY;
public $name = "Comment Word Ban";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "For stopping spam and other comment abuse";
public $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.
<p>Regex bans are also supported, allowing more complicated
bans like <code>/http:.*\.cn\//</code> to block links to
chinese websites, or <code>/.*?http.*?http.*?http.*?http.*?/</code>
to block comments with four (or more) links in.
<p>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\"";
}

View file

@ -1,24 +1,4 @@
<?php
/*
* Name: Comment Word Ban
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* 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.
* <p>Regex bans are also supported, allowing more complicated
* bans like <code>/http:.*\.cn\//</code> to block links to
* chinese websites, or <code>/.*?http.*?http.*?http.*?http.*?/</code>
* to block comments with four (or more) links in.
* <p>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 extends Extension
{

40
ext/bbcode/info.php Normal file
View file

@ -0,0 +1,40 @@
<?php
/**
* Name: BBCode
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Turns BBCode into HTML
*/
class BBCodeInfo extends ExtensionInfo
{
public const KEY = "bbcode";
public $key = self::KEY;
public $name = "BBCode";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $core = true;
public $description = "Turns BBCode into HTML";
public $documentation =
" Supported tags:
<ul>
<li>[img]url[/img]
<li>[url]<a href=\"{self::SHIMMIE_URL}\">http://code.shishnet.org/</a>[/url]
<li>[email]<a href=\"mailto:{self::SHISH_EMAIL}\">webmaster@shishnet.org</a>[/email]
<li>[b]<b>bold</b>[/b]
<li>[i]<i>italic</i>[/i]
<li>[u]<u>underline</u>[/u]
<li>[s]<s>strikethrough</s>[/s]
<li>[sup]<sup>superscript</sup>[/sup]
<li>[sub]<sub>subscript</sub>[/sub]
<li>[[wiki article]]
<li>[[wiki article|with some text]]
<li>[quote]text[/quote]
<li>[quote=Username]text[/quote]
<li>&gt;&gt;123 (link to image #123)
</ul>";
}

View file

@ -1,29 +1,5 @@
<?php
/**
* Name: BBCode
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Turns BBCode into HTML
* Documentation:
* Supported tags:
* <ul>
* <li>[img]url[/img]
* <li>[url]<a href="http://code.shishnet.org/shimmie2/">http://code.shishnet.org/</a>[/url]
* <li>[email]<a href="mailto:webmaster@shishnet.org">webmaster@shishnet.org</a>[/email]
* <li>[b]<b>bold</b>[/b]
* <li>[i]<i>italic</i>[/i]
* <li>[u]<u>underline</u>[/u]
* <li>[s]<s>strikethrough</s>[/s]
* <li>[sup]<sup>superscript</sup>[/sup]
* <li>[sub]<sub>subscript</sub>[/sub]
* <li>[[wiki article]]
* <li>[[wiki article|with some text]]
* <li>[quote]text[/quote]
* <li>[quote=Username]text[/quote]
* <li>&gt;&gt;123 (link to image #123)
* </ul>
*/
class BBCode extends FormatterExtension
{

21
ext/blocks/info.php Normal file
View file

@ -0,0 +1,21 @@
<?php
/*
* Name: Generic Blocks
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Add HTML to some space (News, Ads, etc)
*/
class BlocksInfo extends ExtensionInfo
{
public const KEY = "blocks";
public $key = self::KEY;
public $name = "Generic Blocks";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Add HTML to some space (News, Ads, etc)";
}

View file

@ -1,11 +1,4 @@
<?php
/*
* Name: Generic Blocks
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Add HTML to some space (News, Ads, etc)
*/
class Blocks extends Extension
{

22
ext/blotter/info.php Normal file
View file

@ -0,0 +1,22 @@
<?php
/*
* Name: Blotter
* Author: Zach Hall <zach@sosguy.net> [http://seemslegit.com/]
* License: GPLv2
* Description:
*/
class BlotterInfo extends ExtensionInfo
{
public const KEY = "blotter";
public $key = self::KEY;
public $name = "Blotter";
public $url = "http://seemslegit.com/";
public $authors = ["Zach Hall"=>"zach@sosguy.net"];
public $license = self::LICENSE_GPLV2;
public $description = "Displays brief updates about whatever you want on every page.
Colors and positioning can be configured to match your site's design.
Development TODO at http://github.com/zshall/shimmie2/issues";
}

View file

@ -1,13 +1,5 @@
<?php
/*
* Name: Blotter
* Author: Zach Hall <zach@sosguy.net> [http://seemslegit.com/]
* License: GPLv2
* Description: Displays brief updates about whatever you want on every page.
* Colors and positioning can be configured to match your site's design.
*
* Development TODO at http://github.com/zshall/shimmie2/issues
*/
class Blotter extends Extension
{
public function onInitExt(InitExtEvent $event)

View file

@ -0,0 +1,30 @@
<?php
/*
* Name: Browser Search
* Author: ATravelingGeek <atg@atravelinggeek.com>
* Some code (and lots of help) by Artanis (Erik Youngren <artanis.00@gmail.com>) from the 'tagger' extention - Used with permission
* Link: http://atravelinggeek.com/
* License: GPLv2
* Description: Allows the user to add a browser 'plugin' to search the site with real-time suggestions
* Version: 0.1c, October 26, 2007
* Documentation:
*
*/
class BrowserSearchInfo extends ExtensionInfo
{
public const KEY = "browser_search";
public $key = self::KEY;
public $name = "Browser Search";
public $url = "http://atravelinggeek.com/";
public $authors = ["ATravelingGeek"=>"atg@atravelinggeek.com"];
public $license = self::LICENSE_GPLV2;
public $version = "0.1c, October 26, 2007";
public $description = "Allows the user to add a browser 'plugin' to search the site with real-time suggestions";
public $documentation =
"Once installed, users with an opensearch compatible browser should see their search box light up with whatever \"click here to add a search engine\" notification they have
Some code (and lots of help) by Artanis (Erik Youngren <artanis.00@gmail.com>) from the 'tagger' extension - Used with permission";
}

View file

@ -1,17 +1,4 @@
<?php
/*
* Name: Browser Search
* Author: ATravelingGeek <atg@atravelinggeek.com>
* Some code (and lots of help) by Artanis (Erik Youngren <artanis.00@gmail.com>) from the 'tagger' extention - Used with permission
* Link: http://atravelinggeek.com/
* License: GPLv2
* Description: Allows the user to add a browser 'plugin' to search the site with real-time suggestions
* Version: 0.1c, October 26, 2007
* Documentation:
* Once installed, users with an opensearch compatible browser should see
* their search box light up with whatever "click here to add a search
* engine" notification they have
*/
class BrowserSearch extends Extension
{

23
ext/bulk_actions/info.php Normal file
View file

@ -0,0 +1,23 @@
<?php
/*
* Name: Bulk Actions
* Author: Matthew Barbour
* License: WTFPL
* Description: Provides query and selection-based bulk action support
* Documentation: Provides bulk action section in list view. Allows performing actions against a set of images based on query or manual selection.
* Based on Mass Tagger by Christian Walde <walde.christian@googlemail.com>, contributions by Shish and Agasa.
*/
class BulkActionsInfo extends ExtensionInfo
{
public const KEY = "bulk_actions";
public $key = self::KEY;
public $name = "Bulk Actions";
public $authors = ["Matthew Barbour"=>"matthew@darkholme.net"];
public $license = self::LICENSE_WTFPL;
public $description = "Provides query and selection-based bulk action support";
public $documentation = "Provides bulk action section in list view. Allows performing actions against a set of images based on query or manual selection. Based on Mass Tagger by Christian Walde <walde.christian@googlemail.com>, contributions by Shish and Agasa.";
}

View file

@ -1,13 +1,4 @@
<?php
/*
* Name: Bulk Actions
* Author: Matthew Barbour
* License: WTFPL
* Description: Provides query and selection-based bulk action support
* Documentation: Provides bulk action section in list view. Allows performing actions against a set of images based on query or manual selection.
* Based on Mass Tagger by Christian Walde <walde.christian@googlemail.com>, contributions by Shish and Agasa.
*/
class BulkActionBlockBuildingEvent extends Event
{

31
ext/bulk_add/info.php Normal file
View file

@ -0,0 +1,31 @@
<?php
/*
* Name: Bulk Add
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Bulk add server-side images
* Documentation:
*/
class BulkAddInfo extends ExtensionInfo
{
public const KEY = "builk_add";
public $key = self::KEY;
public $name = "Bulk Add";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Bulk add server-side images";
public $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 <code>/home/bob/uploads/holiday/2008/</code> and point
shimmie at <code>/home/bob/uploads</code>, then images will be
tagged \"holiday 2008\")
<p><b>Note:</b> requires the \"admin\" extension to be enabled
";
}

View file

@ -1,19 +1,4 @@
<?php
/*
* Name: Bulk Add
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* 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 <code>/home/bob/uploads/holiday/2008/</code> and point
* shimmie at <code>/home/bob/uploads</code>, then images will be
* tagged "holiday 2008")
* <p><b>Note:</b> requires the "admin" extension to be enabled
*/
class BulkAddEvent extends Event
{

34
ext/bulk_add_csv/info.php Normal file
View file

@ -0,0 +1,34 @@
<?php
/*
* Name: Bulk Add CSV
* Author: velocity37 <velocity37@gmail.com>
* License: GPLv2
* Description: Bulk add server-side images with metadata from CSV file
* Documentation:
*
*
*/
class BulkAddCSVInfo extends ExtensionInfo
{
public const KEY = "bulk_add_csv";
public $key = self::KEY;
public $name = "Bulk Add CSV";
public $url = self::SHIMMIE_URL;
public $authors = ["velocity37"=>"velocity37@gmail.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Bulk add server-side images with metadata from CSV file";
public $documentation =
"Modification of \"Bulk Add\" by Shish.<br><br>
Adds images from a CSV with the five following values: <br>
\"/path/to/image.jpg\",\"spaced tags\",\"source\",\"rating s/q/e\",\"/path/thumbnail.jpg\" <br>
<b>e.g.</b> \"/tmp/cat.png\",\"shish oekaki\",\"shimmie.shishnet.org\",\"s\",\"tmp/custom.jpg\" <br><br>
Any value but the first may be omitted, but there must be five values per line.<br>
<b>e.g.</b> \"/why/not/try/bulk_add.jpg\",\"\",\"\",\"\",\"\"<br><br>
Image thumbnails will be displayed at the AR of the full image. Thumbnails that are
normally static (e.g. SWF) will be displayed at the board's max thumbnail size<br><br>
Useful for importing tagged images without having to do database manipulation.<br>
<p><b>Note:</b> requires \"Admin Controls\" and optionally \"Image Ratings\" to be enabled<br><br>";
}

View file

@ -1,22 +1,4 @@
<?php
/*
* Name: Bulk Add CSV
* Author: velocity37 <velocity37@gmail.com>
* License: GPLv2
* Description: Bulk add server-side images with metadata from CSV file
* Documentation:
* Modification of "Bulk Add" by Shish.<br><br>
* Adds images from a CSV with the five following values: <br>
* "/path/to/image.jpg","spaced tags","source","rating s/q/e","/path/thumbnail.jpg" <br>
* <b>e.g.</b> "/tmp/cat.png","shish oekaki","shimmie.shishnet.org","s","tmp/custom.jpg" <br><br>
* Any value but the first may be omitted, but there must be five values per line.<br>
* <b>e.g.</b> "/why/not/try/bulk_add.jpg","","","",""<br><br>
* Image thumbnails will be displayed at the AR of the full image. Thumbnails that are
* normally static (e.g. SWF) will be displayed at the board's max thumbnail size<br><br>
* Useful for importing tagged images without having to do database manipulation.<br>
* <p><b>Note:</b> requires "Admin Controls" and optionally "Image Ratings" to be enabled<br><br>
*
*/
class BulkAddCSV extends Extension
{

23
ext/bulk_remove/info.php Normal file
View file

@ -0,0 +1,23 @@
<?php
/*
* Name: [Beta] Bulk Remove
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com/
* License: GPLv2
* Description: Allows admin to delete many images at once through Board Admin.
* Documentation:
*
*/
class BulkRemoveInfo extends ExtensionInfo
{
public const KEY = "bulk_remove";
public $key = self::KEY;
public $name = "Bulk Remove";
public $beta = true;
public $url = "http://www.drudexsoftware.com/";
public $authors = ["Drudex Software"=>"support@drudexsoftware.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Allows admin to delete many images at once through Board Admin.";
}

View file

@ -1,13 +1,5 @@
<?php
/*
* Name: [Beta] Bulk Remove
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com/
* License: GPLv2
* Description: Allows admin to delete many images at once through Board Admin.
* Documentation:
*
*/
//todo: removal by tag returns 1 less image in test for some reason, actually a combined search doesn't seem to work for shit either
class BulkRemove extends Extension

25
ext/comment/info.php Normal file
View file

@ -0,0 +1,25 @@
<?php
/**
* Name: Image Comments
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Allow users to make comments on images
* Documentation:
* Formatting is done with the standard formatting API (normally BBCode)
*/
class CommentListInfo extends ExtensionInfo
{
public const KEY = "comment";
public $key = self::KEY;
public $name = "Image Comments";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Allow users to make comments on images";
public $documentation = "Formatting is done with the standard formatting API (normally BBCode)";
public $core = true;
}

View file

@ -1,13 +1,4 @@
<?php
/**
* Name: Image Comments
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Allow users to make comments on images
* Documentation:
* Formatting is done with the standard formatting API (normally BBCode)
*/
require_once "vendor/ifixit/php-akismet/akismet.class.php";
@ -407,13 +398,13 @@ class CommentList extends Extension
LIMIT :limit OFFSET :offset
", ["limit"=>$threads_per_page, "offset"=>$start]);
$user_ratings = ext_is_live("Ratings") ? Ratings::get_user_privs($user) : "";
$user_ratings = Extension::is_enabled(RatingsInfo::KEY) ? Ratings::get_user_privs($user) : "";
$images = [];
while ($row = $result->fetch()) {
$image = Image::by_id($row["image_id"]);
if (
ext_is_live("Ratings") && !is_null($image) &&
Extension::is_enabled(RatingsInfo::KEY) && !is_null($image) &&
strpos($user_ratings, $image->rating) === false
) {
$image = null; // this is "clever", I may live to regret it

View file

@ -0,0 +1,28 @@
<?php
/*
* Name: Cron Uploader
* Authors: YaoiFox <admin@yaoifox.com>, Matthew Barbour <matthew@darkholme.net>
* Link: http://www.yaoifox.com/
* License: GPLv2
* Description: Uploads images automatically using Cron Jobs
* Documentation: Installation guide: activate this extension and navigate to www.yoursite.com/cron_upload
*/
class CronUploaderInfo extends ExtensionInfo
{
public const KEY = "cron_uploader";
public $key = self::KEY;
public $name = "Cron Uploader";
public $url = self::SHIMMIE_URL;
public $authors = ["YaoiFox"=>"admin@yaoifox.com", "Matthew Barbour"=>"matthew@darkholme.net"];
public $license = self::LICENSE_GPLV2;
public $description = "Uploads images automatically using Cron Jobs";
public function __construct()
{
$this->documentation = "Installation guide: activate this extension and navigate to System Config screen.</a>";
parent::__construct();
}
}

View file

@ -1,13 +1,5 @@
<?php
/*
* Name: Cron Uploader
* Authors: YaoiFox <admin@yaoifox.com>, Matthew Barbour <matthew@darkholme.net>
* Link: http://www.yaoifox.com/
* License: GPLv2
* Description: Uploads images automatically using Cron Jobs
* Documentation: Installation guide: activate this extension and navigate to www.yoursite.com/cron_upload
*/
class CronUploader extends Extension
{

View file

@ -0,0 +1,30 @@
<?php
/**
* Name: Custom HTML Headers
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com
* License: GPLv2
* Description: Allows admins to modify & set custom &lt;head&gt; content
* Documentation:
*
*/
class custom_html_headersInfo extends ExtensionInfo
{
public const KEY = "custom_html_headers";
public $key = self::KEY;
public $name = "Custom HTML Headers";
public $url = "http://www.drudexsoftware.com";
public $authors = ["Drudex Software"=>"support@drudexsoftware.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Allows admins to modify & set custom &lt;head&gt; content";
public $documentation =
"When you go to board config you can find a block named Custom HTML Headers.
In that block you can simply place any thing you can place within &lt;head&gt;&lt;/head&gt;
This can be useful if you want to add website tracking code or other javascript.
NOTE: Only use if you know what you're doing.
You can also add your website name as prefix or suffix to the title of each page on your website.";
}

View file

@ -1,19 +1,5 @@
<?php
/**
* Name: Custom HTML Headers
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com
* License: GPLv2
* Description: Allows admins to modify & set custom &lt;head&gt; content
* Documentation:
* When you go to board config you can find a block named Custom HTML Headers.
* In that block you can simply place any thing you can place within &lt;head&gt;&lt;/head&gt;
*
* This can be useful if you want to add website tracking code or other javascript.
* NOTE: Only use if you know what you're doing.
*
* You can also add your website name as prefix or suffix to the title of each page on your website.
*/
class custom_html_headers extends Extension
{
# Adds setup block for custom <head> content

61
ext/danbooru_api/info.php Normal file
View file

@ -0,0 +1,61 @@
<?php
/*
Name: Danbooru Client API
Author: JJS <jsutinen@gmail.com>
Description: Allow Danbooru apps like Danbooru Uploader for Firefox to communicate with Shimmie
Documentation:
*/
class DanbooruApiInfo extends ExtensionInfo
{
public const KEY = "danbooru_api";
public $key = self::KEY;
public $name = "Danbooru Client API";
public $authors = ["JJS"=>"jsutinen@gmail.com"];
public $description = "Allow Danbooru apps like Danbooru Uploader for Firefox to communicate with Shimmie";
public $documentation =
"<p>Notes:
<br>danbooru API based on documentation from danbooru 1.0 -
http://attachr.com/7569
<br>I've only been able to test add_post and find_tags because I use the
old danbooru firefox extension for firefox 1.5
<p>Functions currently implemented:
<ul>
<li>add_post - title and rating are currently ignored because shimmie does not support them
<li>find_posts - sort of works, filename is returned as the original filename and probably won't help when it comes to actually downloading it
<li>find_tags - id, name, and after_id all work but the tags parameter is ignored just like danbooru 1.0 ignores it
</ul>
CHANGELOG
13-OCT-08 8:00PM CST - JJS
Bugfix - Properly escape source attribute
17-SEP-08 10:00PM CST - JJS
Bugfix for changed page name checker in PageRequestEvent
13-APR-08 10:00PM CST - JJS
Properly escape the tags returned in find_tags and find_posts - Caught by ATravelingGeek
Updated extension info to be a bit more clear about its purpose
Deleted add_comment code as it didn't do anything anyway
01-MAR-08 7:00PM CST - JJS
Rewrote to make it compatible with Shimmie trunk again (r723 at least)
It may or may not support the new file handling stuff correctly, I'm only testing with images and the danbooru uploader for firefox
21-OCT-07 9:07PM CST - JJS
Turns out I actually did need to implement the new parameter names
for danbooru api v1.8.1. Now danbooruup should work when used with /api/danbooru/post/create.xml
Also correctly redirects the url provided by danbooruup in the event
of a duplicate image.
19-OCT-07 4:46PM CST - JJS
Add compatibility with danbooru api v1.8.1 style urls
for find_posts and add_post. NOTE: This does not implement
the changes to the parameter names, it is simply a
workaround for the latest danbooruup firefox extension.
Completely compatibility will probably involve a rewrite with a different URL
";
}

View file

@ -1,51 +1,4 @@
<?php
/*
Name: Danbooru Client API
Author: JJS <jsutinen@gmail.com>
Description: Allow Danbooru apps like Danbooru Uploader for Firefox to communicate with Shimmie
Documentation:
<p>Notes:
<br>danbooru API based on documentation from danbooru 1.0 -
http://attachr.com/7569
<br>I've only been able to test add_post and find_tags because I use the
old danbooru firefox extension for firefox 1.5
<p>Functions currently implemented:
<ul>
<li>add_post - title and rating are currently ignored because shimmie does not support them
<li>find_posts - sort of works, filename is returned as the original filename and probably won't help when it comes to actually downloading it
<li>find_tags - id, name, and after_id all work but the tags parameter is ignored just like danbooru 1.0 ignores it
</ul>
CHANGELOG
13-OCT-08 8:00PM CST - JJS
Bugfix - Properly escape source attribute
17-SEP-08 10:00PM CST - JJS
Bugfix for changed page name checker in PageRequestEvent
13-APR-08 10:00PM CST - JJS
Properly escape the tags returned in find_tags and find_posts - Caught by ATravelingGeek
Updated extension info to be a bit more clear about its purpose
Deleted add_comment code as it didn't do anything anyway
01-MAR-08 7:00PM CST - JJS
Rewrote to make it compatible with Shimmie trunk again (r723 at least)
It may or may not support the new file handling stuff correctly, I'm only testing with images and the danbooru uploader for firefox
21-OCT-07 9:07PM CST - JJS
Turns out I actually did need to implement the new parameter names
for danbooru api v1.8.1. Now danbooruup should work when used with /api/danbooru/post/create.xml
Also correctly redirects the url provided by danbooruup in the event
of a duplicate image.
19-OCT-07 4:46PM CST - JJS
Add compatibility with danbooru api v1.8.1 style urls
for find_posts and add_post. NOTE: This does not implement
the changes to the parameter names, it is simply a
workaround for the latest danbooruup firefox extension.
Completely compatibility will probably involve a rewrite with a different URL
*/
class DanbooruApi extends Extension
{

28
ext/downtime/info.php Normal file
View file

@ -0,0 +1,28 @@
<?php
/*
* Name: Downtime
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Show a "down for maintenance" page
* Documentation:
*
*/
class DowntimeInfo extends ExtensionInfo
{
public const KEY = "downtime";
public $key = self::KEY;
public $name = "Downtime";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Show a \"down for maintenance\" page";
public $documentation =
"Once installed there will be some more options on the config page --
Ticking \"disable non-admin access\" will mean that regular and anonymous
users will be blocked from accessing the site, only able to view the
message specified in the box.";
}

View file

@ -1,16 +1,4 @@
<?php
/*
* Name: Downtime
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Show a "down for maintenance" page
* Documentation:
* Once installed there will be some more options on the config page --
* Ticking "disable non-admin access" will mean that regular and anonymous
* users will be blocked from accessing the site, only able to view the
* message specified in the box.
*/
class Downtime extends Extension
{

29
ext/emoticons/info.php Normal file
View file

@ -0,0 +1,29 @@
<?php
/*
* Name: Emoticon Filter
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Lets users use graphical smilies
* Documentation:
*
*/
class EmoticonsInfo extends ExtensionInfo
{
public const KEY = "emoticons";
public $key = self::KEY;
public $name = "Emoticon Filter";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Lets users use graphical smilies";
public $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
<p>Images are stored in /ext/emoticons/default/, and you can
add more emoticons by uploading images into that folder.";
}

View file

@ -1,17 +1,5 @@
<?php
/*
* Name: Emoticon Filter
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* 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
* <p>Images are stored in /ext/emoticons/default/, and you can
* add more emoticons by uploading images into that folder.
*/
/**
* Class Emoticons

25
ext/et/info.php Normal file
View file

@ -0,0 +1,25 @@
<?php
/*
* Name: System Info
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Show various bits of system information
* Documentation:
*/
class ETInfo extends ExtensionInfo
{
public const KEY = "et";
public $key = self::KEY;
public $name = "System Info";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Show various bits of system information";
public $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.";
}

View file

@ -1,16 +1,4 @@
<?php
/*
* Name: System Info
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* 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 extends Extension
{

26
ext/ext_manager/info.php Normal file
View file

@ -0,0 +1,26 @@
<?php
/**
* Name: Extension Manager
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Visibility: admin
* Description: A thing for point & click extension management
* Documentation:
*/
class ExtManagerInfo extends ExtensionInfo
{
public const KEY = "ext_manager";
public $key = self::KEY;
public $name = "Extension Manager";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $visibility = self::VISIBLE_ADMIN;
public $description = "A thing for point & click extension management";
public $documentation = "Allows the admin to view a list of all extensions and enable or disable them; also allows users to view the list of activated extensions and read their documentation";
public $core = true;
}

View file

@ -1,134 +1,22 @@
<?php
/**
* Name: Extension Manager
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Visibility: admin
* Description: A thing for point & click extension management
* Documentation:
* Allows the admin to view a list of all extensions and enable or
* disable them; also allows users to view the list of activated
* extensions and read their documentation
*/
function __extman_extcmp(ExtensionManagerInfo $a, ExtensionManagerInfo $b): int
function __extman_extcmp(ExtensionInfo $a, ExtensionInfo $b): int
{
if($a->beta===true&&$b->beta===false)
return 1;
if($a->beta===false&&$b->beta===true)
return -1;
return strcmp($a->name, $b->name);
}
class ExtensionManagerInfo
function __extman_extactive(ExtensionInfo $a): bool
{
public $ext_name;
public $name;
public $link;
public $authors;
public $description;
public $documentation;
public $version;
public $visibility;
public $enabled;
public $supported;
public function __construct($main)
{
$matches = [];
preg_match("#ext/(.*)/main.php#", $main, $matches);
$this->ext_name = $matches[1];
$this->name = $this->ext_name;
$this->enabled = $this->is_enabled($this->ext_name);
if(file_exists("ext/{$this->ext_name}/info.php")) {
include_once "ext/{$this->ext_name}/info.php";
$class = get_class_from_file("ext/{$this->ext_name}/info.php");
$info = new $class();
$this->name = $info->name;
$this->link = $info->link;
foreach ($info->authors as $key=>$value){
$this->authors[] = new ExtensionAuthor($key, $value);
}
$this->description = $info->description;
$this->documentation = $info->documentation;
$this->version = $info->version;
$this->visibility = $info->visibility;
$this->supported = $info->supported;
} else {
$this->authors = [];
$handle = fopen($main, "r");
if ($handle === null) {
throw new Exception("Could not open extension file $main");
}
try {
$line = fgets($handle);
while ($line !== false) {
if (preg_match("/Name: (.*)/", $line, $matches)) {
$this->name = $matches[1];
} elseif (preg_match("/Visibility: (.*)/", $line, $matches)) {
$this->visibility = $matches[1];
} elseif (preg_match("/Link: (.*)/", $line, $matches)) {
$this->link = $matches[1];
if ($this->link[0] == "/") {
$this->link = make_link(substr($this->link, 1));
}
} elseif (preg_match("/Version: (.*)/", $line, $matches)) {
$this->version = $matches[1];
} elseif (preg_match("/Authors?: (.*)/", $line, $matches)) {
$author_list = explode(',', $matches[1]);
foreach ($author_list as $author) {
if (preg_match("/(.*) [<\(](.*@.*)[>\)]/", $author, $matches)) {
$this->authors[] = new ExtensionAuthor($matches[1], $matches[2]);
} else {
$this->authors[] = new ExtensionAuthor($author, null);
}
}
} elseif (preg_match("/(.*)Description: ?(.*)/", $line, $matches)) {
$this->description = $matches[2];
$start = $matches[1] . " ";
$start_len = strlen($start);
while (($line = fgets($handle)) !== false &&
substr($line, 0, $start_len) == $start) {
$this->description .= " " . substr($line, $start_len);
}
continue;
} elseif (preg_match("/(.*)Documentation: ?(.*)/", $line, $matches)) {
$this->documentation = $matches[2];
$start = $matches[1] . " ";
$start_len = strlen($start);
while (($line = fgets($handle)) !== false &&
substr($line, 0, $start_len) == $start) {
$this->documentation .= " " . substr($line, $start_len);
}
$this->documentation = str_replace('$site', make_http(get_base_href()), $this->documentation);
continue;
} elseif (preg_match("/\*\//", $line, $matches)) {
break;
}
$line = fgets($handle);
}
} finally {
fclose($handle);
}
}
}
private function is_enabled(string $fname): ?bool
{
$core = explode(",", CORE_EXTS);
$extra = explode(",", EXTRA_EXTS);
if (in_array($fname, $extra)) {
return true;
} // enabled
if (in_array($fname, $core)) {
return null;
} // core
return false; // not enabled
}
return Extension::is_enabled($a->key);
}
class ExtensionAuthor
{
public $name;
@ -172,7 +60,7 @@ class ExtManager extends Extension
if ($event->page_matches("ext_doc")) {
$ext = $event->get_arg(0);
if (file_exists("ext/$ext/info.php")) {
$info = new ExtensionManagerInfo("ext/$ext/main.php");
$info = ExtensionInfo::get_by_key($ext);
$this->theme->display_doc($page, $info);
} else {
$this->theme->display_table($page, $this->get_extensions(false), false);
@ -218,14 +106,9 @@ class ExtManager extends Extension
*/
private function get_extensions(bool $all): array
{
$extensions = [];
if ($all) {
$exts = zglob("ext/*/main.php");
} else {
$exts = zglob("ext/{" . ENABLED_EXTS . "}/main.php");
}
foreach ($exts as $main) {
$extensions[] = new ExtensionManagerInfo($main);
$extensions = ExtensionInfo::get_all();
if (!$all) {
$extensions = array_filter($extensions,"__extman_extactive");
}
usort($extensions, "__extman_extcmp");
return $extensions;
@ -233,16 +116,13 @@ class ExtManager extends Extension
private function set_things($settings)
{
$core = explode(",", CORE_EXTS);
$core = ExtensionInfo::get_core_extensions();
$extras = [];
foreach (glob("ext/*/main.php") as $main) {
foreach (ExtensionInfo::get_all_keys() as $key) {
$matches = [];
preg_match("#ext/(.*)/main.php#", $main, $matches);
$fname = $matches[1];
if (!in_array($fname, $core) && isset($settings["ext_$fname"])) {
$extras[] = $fname;
if (!in_array($key, $core) && isset($settings["ext_$key"])) {
$extras[] = $key;
}
}

View file

@ -26,24 +26,24 @@ class ExtManagerTheme extends Themelet
continue;
}
$h_name = html_escape(empty($extension->name) ? $extension->ext_name : $extension->name);
$h_name = html_escape(($extension->beta===true ? "[BETA] ":"").(empty($extension->name) ? $extension->key : $extension->name));
$h_description = html_escape($extension->description);
$h_link = make_link("ext_doc/" . url_escape($extension->ext_name));
$h_link = make_link("ext_doc/" . url_escape($extension->key));
$h_enabled = ($extension->enabled === true ? " checked='checked'" : ($extension->enabled === false ? "" : " checked='checked'"));
$h_disabled = ($extension->supported===false || $extension->enabled===null? " disabled ": " " );
$h_enabled = ($extension->is_enabled() === true ? " checked='checked'" : "");
$h_disabled = ($extension->is_supported()===false || $extension->core===true? " disabled ": " " );
//baseline_open_in_new_black_18dp.png
$h_enabled_box = $editable ? "<td><input type='checkbox' name='ext_" . html_escape($extension->ext_name) . "' id='ext_" . html_escape($extension->ext_name) . "'$h_disabled $h_enabled></td>" : "";
$h_enabled_box = $editable ? "<td><input type='checkbox' name='ext_" . html_escape($extension->key) . "' id='ext_" . html_escape($extension->key) . "'$h_disabled $h_enabled></td>" : "";
$h_docs = ($extension->documentation ? "<a href='$h_link'>■</a>" : ""); //TODO: A proper "docs" symbol would be preferred here.
$html .= "
<tr data-ext='{$extension->ext_name}'>
<tr data-ext='{$extension->name}'>
{$h_enabled_box}
<td><label for='ext_" . html_escape($extension->ext_name) . "'>{$h_name}</label></td>
<td><label for='ext_" . html_escape($extension->key) . "'>{$h_name}</label></td>
<td>{$h_docs}</td>
<td style='text-align: left;'>{$h_description} " .($extension->supported===false ? "<b style='color:red'>Database not supported</b>" : ""). "</td>
<td style='text-align: left;'>{$h_description} <b style='color:red'>".$extension->get_support_info()."</b></td>
</tr>";
}
$h_set = $editable ? "<tfoot><tr><td colspan='5'><input type='submit' value='Set Extensions'></td></tr></tfoot>" : "";
@ -66,16 +66,16 @@ class ExtManagerTheme extends Themelet
$col_1 = "";
$col_2 = "";
foreach($extensions as $extension) {
$ext_name = $extension->ext_name;
$ext_name = $extension->name;
$h_name = empty($extension->name) ? $ext_name : html_escape($extension->name);
$h_email = html_escape($extension->email);
$h_link = isset($extension->link) ?
"<a href=\"".html_escape($extension->link)."\">Original Site</a>" : "";
$h_doc = isset($extension->documentation) ?
"<a href=\"".make_link("ext_doc/".html_escape($extension->ext_name))."\">Documentation</a>" : "";
"<a href=\"".make_link("ext_doc/".html_escape($extension->name))."\">Documentation</a>" : "";
$h_author = html_escape($extension->author);
$h_description = html_escape($extension->description);
$h_enabled = $extension->enabled ? " checked='checked'" : "";
$h_enabled = $extension->is_enabled() ? " checked='checked'" : "";
$h_author_link = empty($h_email) ?
"$h_author" :
"<a href='mailto:$h_email'>$h_author</a>";
@ -118,7 +118,7 @@ class ExtManagerTheme extends Themelet
}
*/
public function display_doc(Page $page, ExtensionManagerInfo $info)
public function display_doc(Page $page, ExtensionInfo $info)
{
$author = "";
if (count($info->authors) > 0) {
@ -127,12 +127,13 @@ class ExtManagerTheme extends Themelet
$author .= "s";
}
$author .= ":</b>";
foreach ($info->authors as $auth) {
if (!empty($auth->email)) {
$author .= "<a href=\"mailto:" . html_escape($auth->email) . "\">" . html_escape($auth->name) . "</a>";
foreach ($info->authors as $auth=>$email) {
if (!empty($email)) {
$author .= "<a href=\"mailto:" . html_escape($email) . "\">" . html_escape($auth) . "</a>";
} else {
$author .= html_escape($auth->name);
$author .= html_escape($auth);
}
$author .= "<br/>";
}
}

25
ext/favorites/info.php Normal file
View file

@ -0,0 +1,25 @@
<?php
/*
* Name: Favorites
* Author: Daniel Marschall <info@daniel-marschall.de>
* License: GPLv2
* Description: Allow users to favorite images
* Documentation:
*/
class FavoritesInfo extends ExtensionInfo
{
public const KEY = "favorites";
public $key = self::KEY;
public $name = "Favorites";
public $authors = ["Daniel Marschall"=>"info@daniel-marschall.de"];
public $license = self::LICENSE_GPLV2;
public $description = "Allow users to favorite images";
public $documentation =
"Gives users a \"favorite this image\" button that they can press
<p>Favorites for a user can then be retrieved by searching for \"favorited_by=UserName\"
<p>Popular images can be searched for by eg. \"favorites>5\"
<p>Favorite info can be added to an image's filename or tooltip using the \$favorites placeholder";
}

View file

@ -1,17 +1,4 @@
<?php
/*
* Name: Favorites
* Author: Daniel Marschall <info@daniel-marschall.de>
* License: GPLv2
* Description: Allow users to favorite images
* Documentation:
* Gives users a "favorite this image" button that they can press
* <p>Favorites for a user can then be retrieved by searching for
* "favorited_by=UserName"
* <p>Popular images can be searched for by eg. "favorites>5"
* <p>Favorite info can be added to an image's filename or tooltip
* using the $favorites placeholder
*/
class FavoriteSetEvent extends Event
{

35
ext/featured/info.php Normal file
View file

@ -0,0 +1,35 @@
<?php
/*
* Name: Featured Image
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Bring a specific image to the users' attentions
* Documentation:
*
*/
class FeaturedInfo extends ExtensionInfo
{
public const KEY = "featured";
public $key = self::KEY;
public $name = "Featured Image";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Bring a specific image to the users' attentions";
public $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.
<p><b>Viewing a featured image</b>
<br>Visit <code>/featured_image/view</code>
<p><b>Downloading a featured image</b>
<br>Link to <code>/featured_image/download</code>. 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.";
}

View file

@ -1,23 +1,4 @@
<?php
/*
* Name: Featured Image
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* 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.
* <p><b>Viewing a featured image</b>
* <br>Visit <code>/featured_image/view</code>
* <p><b>Downloading a featured image</b>
* <br>Link to <code>/featured_image/download</code>. 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.
*/
class Featured extends Extension
{
@ -73,7 +54,7 @@ class Featured extends Extension
$database->cache->set("featured_image_object:$fid", $image, 600);
}
if (!is_null($image)) {
if (ext_is_live("Ratings")) {
if (Extension::is_enabled(RatingsInfo::KEY)) {
if (strpos(Ratings::get_user_privs($user), $image->rating) === false) {
return;
}

21
ext/forum/info.php Normal file
View file

@ -0,0 +1,21 @@
<?php
/**
* Name: [Beta] Forum
* Author: Sein Kraft <mail@seinkraft.info>
* Alpha <alpha@furries.com.ar>
* License: GPLv2
* Description: Rough forum extension
* Documentation:
*/
class ForumInfo extends ExtensionInfo
{
public const KEY = "dorum";
public $key = self::KEY;
public $name = "Forum";
public $authors = ["Sein Kraft"=>"mail@seinkraft.info","Alpha"=>"alpha@furries.com.ar"];
public $license = self::LICENSE_GPLV2;
public $description = "Rough forum extension";
}

View file

@ -1,12 +1,4 @@
<?php
/**
* Name: [Beta] Forum
* Author: Sein Kraft <mail@seinkraft.info>
* Alpha <alpha@furries.com.ar>
* License: GPLv2
* Description: Rough forum extension
* Documentation:
*/
/*
Todo:
*Quote buttons on posts

View file

@ -0,0 +1,24 @@
<?php
/**
* Name: Google Analytics
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://drudexsoftware.com
* License: GPLv2
* Description: Integrates Google Analytics tracking
* Documentation:
*
*/
class google_analyticsInfo extends ExtensionInfo
{
public const KEY = "google_analytics";
public $key = self::KEY;
public $name = "Google Analytics";
public $url = "http://drudexsoftware.com";
public $authors = ["Drudex Software"=>"support@drudexsoftware.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Integrates Google Analytics tracking";
public $documentation =
"User has to enter their Google Analytics ID in the Board Config to use this extension.";
}

View file

@ -1,13 +1,5 @@
<?php
/**
* Name: Google Analytics
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://drudexsoftware.com
* License: GPLv2
* Description: Integrates Google Analytics tracking
* Documentation:
* User has to enter their Google Analytics ID in the Board Config to use this extention.
*/
class google_analytics extends Extension
{
# Add analytics to config

23
ext/handle_404/info.php Normal file
View file

@ -0,0 +1,23 @@
<?php
/**
* Name: 404 Detector
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Visibility: admin
* Description: If no other extension puts anything onto the page, show 404
*/
class Handle404Info extends ExtensionInfo
{
public const KEY = "handle_404";
public $key = self::KEY;
public $name = "404 Detector";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $visibility = self::VISIBLE_ADMIN;
public $description = "If no other extension puts anything onto the page, show 404";
public $core = true;
}

View file

@ -1,12 +1,5 @@
<?php
/**
* Name: 404 Detector
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Visibility: admin
* Description: If no other extension puts anything onto the page, show 404
*/
class Handle404 extends Extension
{

View file

@ -0,0 +1,25 @@
<?php
/*
* Name: Handle Archives
* Author: Shish <webmaster@shishnet.org>
* Description: Allow users to upload archives (zip, etc)
* Documentation:
*
*/
class ArchiveFileHandlerInfo extends ExtensionInfo
{
public const KEY = "handle_archive";
public $key = self::KEY;
public $name = "Handle Archives";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $description = "Allow users to upload archives (zip, etc)";
public $documentation =
"Note: requires exec() access and an external unzip command
<p>Any command line unzipper should work, some examples:
<p>unzip: <code>unzip -d \"%d\" \"%f\"</code>
<br>7-zip: <code>7zr x -o\"%d\" \"%f\"</code>";
}

View file

@ -1,14 +1,4 @@
<?php
/*
* Name: Handle Archives
* Author: Shish <webmaster@shishnet.org>
* Description: Allow users to upload archives (zip, etc)
* Documentation:
* Note: requires exec() access and an external unzip command
* <p>Any command line unzipper should work, some examples:
* <p>unzip: <code>unzip -d "%d" "%f"</code>
* <br>7-zip: <code>7zr x -o"%d" "%f"</code>
*/
class ArchiveFileHandler extends Extension
{

19
ext/handle_flash/info.php Normal file
View file

@ -0,0 +1,19 @@
<?php
/*
* Name: Handle Flash
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* Description: Handle Flash files.
*/
class FlashFileHandlerInfo extends ExtensionInfo
{
public const KEY = "handle_flash";
public $key = self::KEY;
public $name = "Handle Flash";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $description = "Handle Flash files.";
}

View file

@ -1,10 +1,4 @@
<?php
/*
* Name: Handle Flash
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* Description: Handle Flash files.
*/
class FlashFileHandler extends DataHandlerExtension
{

18
ext/handle_ico/info.php Normal file
View file

@ -0,0 +1,18 @@
<?php
/*
* Name: Handle ICO
* Author: Shish <webmaster@shishnet.org>
* Description: Handle windows icons
*/
class IcoFileHandlerInfo extends ExtensionInfo
{
public const KEY = "handle_ico";
public $key = self::KEY;
public $name = "Handle ICO";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $description = "Handle windows icons";
}

View file

@ -1,9 +1,4 @@
<?php
/*
* Name: Handle ICO
* Author: Shish <webmaster@shishnet.org>
* Description: Handle windows icons
*/
class IcoFileHandler extends DataHandlerExtension
{

18
ext/handle_mp3/info.php Normal file
View file

@ -0,0 +1,18 @@
<?php
/*
* Name: Handle MP3
* Author: Shish <webmaster@shishnet.org>
* Description: Handle MP3 files
*/
class MP3FileHandlerInfo extends ExtensionInfo
{
public const KEY = "handle_mp3";
public $key = self::KEY;
public $name = "Handle MP3";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $description = "Handle MP3 files";
}

View file

@ -1,9 +1,4 @@
<?php
/*
* Name: Handle MP3
* Author: Shish <webmaster@shishnet.org>
* Description: Handle MP3 files
*/
class MP3FileHandler extends DataHandlerExtension
{

20
ext/handle_pixel/info.php Normal file
View file

@ -0,0 +1,20 @@
<?php
/**
* Name: Handle Pixel
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* Description: Handle JPEG, PNG, GIF, WEBP, etc files
*/
class PixelFileHandlerInfo extends ExtensionInfo
{
public const KEY = "handle_pixel";
public $key = self::KEY;
public $name = "Handle Pixel";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $description = "Handle JPEG, PNG, GIF, WEBP, etc files";
public $core = true;
}

View file

@ -1,10 +1,4 @@
<?php
/**
* Name: Handle Pixel
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* Description: Handle JPEG, PNG, GIF, WEBP, etc files
*/
class PixelFileHandler extends DataHandlerExtension
{

View file

@ -0,0 +1,24 @@
<?php
/**
* Name: Static File Handler
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Visibility: admin
* Description: If Shimmie can't handle a request, check static files ($theme/static/$filename, then ext/handle_static/static/$filename)
*/
class HandleStaticInfo extends ExtensionInfo
{
public const KEY = "handle_static";
public $key = self::KEY;
public $name = "Static File Handler";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $visibility = self::VISIBLE_ADMIN;
public $description = 'If Shimmie can\'t handle a request, check static files ($theme/static/$filename, then ext/handle_static/static/$filename)';
public $core = true;
}

View file

@ -1,12 +1,4 @@
<?php
/**
* Name: Static File Handler
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Visibility: admin
* Description: If Shimmie can't handle a request, check static files ($theme/static/$filename, then ext/handle_static/static/$filename)
*/
class HandleStatic extends Extension
{

19
ext/handle_svg/info.php Normal file
View file

@ -0,0 +1,19 @@
<?php
/*
* Name: Handle SVG
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* Description: Handle static SVG files.
*/
class SVGFileHandlerInfo extends ExtensionInfo
{
public const KEY = "handle_svg";
public $key = self::KEY;
public $name = "Handle SVG";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $description = "Handle static SVG files.";
}

View file

@ -1,10 +1,4 @@
<?php
/*
* Name: Handle SVG
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* Description: Handle static SVG files.
*/
use enshrined\svgSanitize\Sanitizer;

28
ext/handle_video/info.php Normal file
View file

@ -0,0 +1,28 @@
<?php
/*
* Name: Handle Video
* Author: velocity37 <velocity37@gmail.com>
* Modified By: Shish <webmaster@shishnet.org>, jgen <jeffgenovy@gmail.com>, im-mi <im.mi.mail.mi@gmail.com>
* License: GPLv2
* Description: Handle FLV, MP4, OGV and WEBM video files.
* Documentation:
*/
class VideoFileHandlerInfo extends ExtensionInfo
{
public const KEY = "handle_video";
public $key = self::KEY;
public $name = "Handle Video";
public $authors = ["velocity37"=>"velocity37@gmail.com",self::SHISH_NAME=>self::SHISH_EMAIL, "jgen"=>"jeffgenovy@gmail.com", "im-mi"=>"im.mi.mail.mi@gmail.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Handle FLV, MP4, OGV and WEBM video files.";
public $documentation =
"Based heavily on \"Handle MP3\" by Shish.<br><br>
FLV: Flash player<br>
MP4: HTML5 with Flash fallback<br>
OGV, WEBM: HTML5<br>
MP4's flash fallback is forced with a bit of Javascript as some browsers won't fallback if they can't play H.264.
In the future, it may be necessary to change the user agent checks to reflect the current state of H.264 support.<br><br>";
}

View file

@ -1,18 +1,4 @@
<?php
/*
* Name: Handle Video
* Author: velocity37 <velocity37@gmail.com>
* Modified By: Shish <webmaster@shishnet.org>, jgen <jeffgenovy@gmail.com>, im-mi <im.mi.mail.mi@gmail.com>
* License: GPLv2
* Description: Handle FLV, MP4, OGV and WEBM video files.
* Documentation:
* Based heavily on "Handle MP3" by Shish.<br><br>
* FLV: Flash player<br>
* MP4: HTML5 with Flash fallback<br>
* OGV, WEBM: HTML5<br>
* MP4's flash fallback is forced with a bit of Javascript as some browsers won't fallback if they can't play H.264.
* In the future, it may be necessary to change the user agent checks to reflect the current state of H.264 support.<br><br>
*/
class VideoFileHandler extends DataHandlerExtension
{

14
ext/hellban/info.php Normal file
View file

@ -0,0 +1,14 @@
<?php
/*
* Name: [Beta] Hellban
*/
class HellBanInfo extends ExtensionInfo
{
public const KEY = "hellban";
public $key = self::KEY;
public $name = "Hellban";
public $beta = true;
}

View file

@ -1,7 +1,4 @@
<?php
/*
* Name: [Beta] Hellban
*/
class HellBan extends Extension
{

19
ext/help_pages/info.php Normal file
View file

@ -0,0 +1,19 @@
<?php
/**
* Name: Help Pages
* Author: Matthew Barbour <matthew@darkholme.net>
* Description: Provides documentation screens
*/
class HelpPagesInfo extends ExtensionInfo
{
public const KEY = "help_pages";
public $key = self::KEY;
public $name = "Help Pages";
public $authors = ["Matthew Barbour"=>"matthew@darkholme.net"];
public $license = self::LICENSE_WTFPL;
public $description = "Provides documentation screens";
public $core = true;
}

View file

@ -1,10 +1,4 @@
<?php
/**
* Name: Help Pages
* Author: Matthew Barbour <matthew@darkholme.net>
* License: MIT
* Description: Provides documentation screens
*/
class HelpPageListBuildingEvent extends Event
{
@ -77,6 +71,7 @@ class HelpPages extends Extension
public function onHelpPageListBuilding(HelpPageListBuildingEvent $event)
{
$event->add_page("search", "Searching");
$event->add_page("licenses", "Licenses");
}
public function onPageNavBuilding(PageNavBuildingEvent $event)
@ -90,5 +85,395 @@ class HelpPages extends Extension
$event->add_link("Help", make_link("help"));
}
public function onHelpPageBuilding(HelpPageBuildingEvent $event) {
if($event->key=="licenses"){
$block = new Block("Software Licenses");
$block->body = "The code in Shimmie is contributed by numerous authors under multiple licenses. For reference, these licenses are listed below. The base software is in general licensed under the GPLv2 license.";
$event->add_block($block);
$block = new Block(ExtensionInfo::LICENSE_GPLV2);
$block->body = "<pre> GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The \"Program\", below,
refers to any such program or work, and a \"work based on the Program\"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term \"modification\".) Each licensee is addressed as \"you\".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and \"any
later version\", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the \"copyright\" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a \"copyright disclaimer\" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.</pre>";
$event->add_block($block);
$block = new Block(ExtensionInfo::LICENSE_MIT);
$block->body = "<pre>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</pre>";
$event->add_block($block);
$block = new Block(ExtensionInfo::LICENSE_WTFPL);
$block->body = "<pre> DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
</pre>";
$event->add_block($block);
}
}
}

20
ext/holiday/info.php Normal file
View file

@ -0,0 +1,20 @@
<?php
/**
* Name: Holiday Theme
* Author: DakuTree <thedakutree@codeanimu.net>
* Link: http://www.codeanimu.net
* License: GPLv2
* Description: Use an additional stylesheet on certain holidays.
*/
class HolidayInfo extends ExtensionInfo
{
public const KEY = "holiday";
public $key = self::KEY;
public $name = "Holiday Theme";
public $url = "http://www.codeanimu.net";
public $authors = ["DakuTree"=>"thedakutree@codeanimu.net"];
public $license = self::LICENSE_GPLV2;
public $description = "Use an additional stylesheet on certain holidays";
}

View file

@ -1,11 +1,5 @@
<?php
/**
* Name: Holiday Theme
* Author: DakuTree <thedakutree@codeanimu.net>
* Link: http://www.codeanimu.net
* License: GPLv2
* Description: Use an additional stylesheet on certain holidays.
*/
class Holiday extends Extension
{
public function onInitExt(InitExtEvent $event)

31
ext/home/info.php Normal file
View file

@ -0,0 +1,31 @@
<?php
/*
* Name: Home Page
* Author: Bzchan <bzchan@animemahou.com>
* License: GPLv2
* Visibility: admin
* Description: Displays a front page with logo, search box and image count
* Documentation:
*
*/
class HomeInfo extends ExtensionInfo
{
public const KEY = "home";
public $key = self::KEY;
public $name = "Home Page";
public $authors =["Bzchan"=>"bzchan@animemahou.com"];
public $license = self::LICENSE_GPLV2;
public $visibility = self::VISIBLE_ADMIN;
public $description = "Displays a front page with logo, search box and image count";
public $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\".
<p>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 <code>/ext/home/counters</code>, and they'll become available
alongside the default choices.";
}

View file

@ -1,19 +1,4 @@
<?php
/*
* Name: Home Page
* Author: Bzchan <bzchan@animemahou.com>
* License: GPLv2
* Visibility: admin
* 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".
* <p>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 <code>/ext/home/counters</code>, and they'll become available
* alongside the default choices.
*/
class Home extends Extension
{

21
ext/image/config.php Normal file
View file

@ -0,0 +1,21 @@
<?php
abstract class ImageConfig {
const THUMB_ENGINE = 'thumb_engine';
const THUMB_WIDTH = 'thumb_width';
const THUMB_HEIGHT = 'thumb_height';
const THUMB_SCALING = 'thumb_scaling';
const THUMB_QUALITY = 'thumb_quality';
const THUMB_TYPE = 'thumb_type';
const SHOW_META = 'image_show_meta';
const ILINK = 'image_ilink';
const TLINK = 'image_tlink';
const TIP = 'image_tip';
const EXPIRES = 'image_expires';
const UPLOAD_COLLISION_HANDLER = 'upload_collision_handler';
const COLLISION_MERGE = 'merge';
const COLLISION_ERROR = 'error';
}

24
ext/image/info.php Normal file
View file

@ -0,0 +1,24 @@
<?php
/*
* Name: Image Manager
* Author: Shish <webmaster@shishnet.org>
* Modified by: jgen <jgen.tech@gmail.com>
* Link: http://code.shishnet.org/shimmie2/
* Description: Handle the image database
* Visibility: admin
*/
class ImageIOInfo extends ExtensionInfo
{
public const KEY = "image";
public $key = self::KEY;
public $name = "Image Manager";
public $url = self::SHIMMIE_URL;
public $authors = [self::SHISH_NAME=> self::SHISH_EMAIL, "jgen"=>"jgen.tech@gmail.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Handle the image database";
public $visibility = self::VISIBLE_ADMIN;
public $core = true;
}

View file

@ -1,33 +1,6 @@
<?php
/*
* Name: Image Manager
* Author: Shish <webmaster@shishnet.org>
* Modified by: jgen <jgen.tech@gmail.com>
* Link: http://code.shishnet.org/shimmie2/
* Description: Handle the image database
* Visibility: admin
*/
abstract class ImageConfig {
const THUMB_ENGINE = 'thumb_engine';
const THUMB_WIDTH = 'thumb_width';
const THUMB_HEIGHT = 'thumb_height';
const THUMB_SCALING = 'thumb_scaling';
const THUMB_QUALITY = 'thumb_quality';
const THUMB_TYPE = 'thumb_type';
const SHOW_META = 'image_show_meta';
const ILINK = 'image_ilink';
const TLINK = 'image_tlink';
const TIP = 'image_tip';
const EXPIRES = 'image_expires';
const UPLOAD_COLLISION_HANDLER = 'upload_collision_handler';
const COLLISION_MERGE = 'merge';
const COLLISION_ERROR = 'error';
}
require_once "config.php";
/**
* A class to handle adding / getting / removing image files from the disk.
@ -217,7 +190,7 @@ class ImageIO extends Extension
if ($handler == ImageConfig::COLLISION_MERGE || isset($_GET['update'])) {
$merged = array_merge($image->get_tag_array(), $existing->get_tag_array());
send_event(new TagSetEvent($existing, $merged));
if (isset($_GET['rating']) && isset($_GET['update']) && ext_is_live("Ratings")) {
if (isset($_GET['rating']) && isset($_GET['update']) && Extension::is_enabled(RatingsInfo::KEY)) {
send_event(new RatingSetEvent($existing, $_GET['rating']));
}
if (isset($_GET['source']) && isset($_GET['update'])) {

View file

@ -0,0 +1,26 @@
<?php
/*
* Name: Image Hash Ban
* Author: ATravelingGeek <atg@atravelinggeek.com>
* Link: http://atravelinggeek.com/
* License: GPLv2
* Description: Ban images based on their hash
* Based on the ResolutionLimit and IPban extensions by Shish
* Version 0.1, October 21, 2007
*/
class ImageBanInfo extends ExtensionInfo
{
public const KEY = "image_hash_ban";
public $key = self::KEY;
public $name = "Image Hash Ban";
public $url = "http://atravelinggeek.com/";
public $authors = ["ATravelingGeek"=>"atg@atravelinggeek.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Ban images based on their hash";
public $version = "0.1, October 21, 2007";
public $documentation =
"Based on the ResolutionLimit and IPban extensions by Shish";
}

View file

@ -1,13 +1,4 @@
<?php
/*
* Name: Image Hash Ban
* Author: ATravelingGeek <atg@atravelinggeek.com>
* Link: http://atravelinggeek.com/
* License: GPLv2
* Description: Ban images based on their hash
* Based on the ResolutionLimit and IPban extensions by Shish
* Version 0.1, October 21, 2007
*/
// RemoveImageHashBanEvent {{{
class RemoveImageHashBanEvent extends Event

View file

@ -0,0 +1,27 @@
<?php
/**
* Name: Image View Counter
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com/
* License: GPLv2
* Description: Tracks & displays how many times an image is viewed
* Documentation:
*
*/
class ImageViewCounterInfo extends ExtensionInfo
{
public const KEY = "image_view_counter";
public $key = self::KEY;
public $name = "Image View Counter";
public $url = "http://www.drudexsoftware.com/";
public $authors = ["Drudex Software"=>"support@drudexsoftware.com"];
public $license = self::LICENSE_GPLV2;
public $description = "Tracks & displays how many times an image is viewed";
public $documentation =
"Whenever anyone views an image, a view will be added to that image.
This extension will also track any username & the IP address.
This is done to prevent duplicate views.
A person can only count as a view again 1 hour after viewing the image initially.";
}

View file

@ -1,16 +1,5 @@
<?php
/**
* Name: Image View Counter
* Author: Drudex Software <support@drudexsoftware.com>
* Link: http://www.drudexsoftware.com/
* License: GPLv2
* Description: Tracks & displays how many times an image is viewed
* Documentation:
* Whenever anyone views an image, a view will be added to that image.
* This extension will also track any username & the IP adress.
* This is done to prevent duplicate views.
* A person can only count as a view again 1 hour after viewing the image initially.
*/
class ImageViewCounter extends Extension
{
private $view_interval = 3600; # allows views to be added each hour

169
ext/index/info.php Normal file
View file

@ -0,0 +1,169 @@
<?php
/**
* Name: Image List
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Show a list of uploaded images
* Documentation:
* Here is a list of the search methods available out of the box;
* Shimmie extensions may provide other filters:
* <ul>
* <li>by tag, eg
* <ul>
* <li>cat
* <li>pie
* <li>somethi* -- wildcards are supported
* </ul>
* <li>size (=, &lt;, &gt;, &lt;=, &gt;=) width x height, eg
* <ul>
* <li>size=1024x768 -- a specific wallpaper size
* <li>size&gt;=500x500 -- no small images
* <li>size&lt;1000x1000 -- no large images
* </ul>
* <li>width (=, &lt;, &gt;, &lt;=, &gt;=) width, eg
* <ul>
* <li>width=1024 -- find images with 1024 width
* <li>width>2000 -- find images bigger than 2000 width
* </ul>
* <li>height (=, &lt;, &gt;, &lt;=, &gt;=) height, eg
* <ul>
* <li>height=768 -- find images with 768 height
* <li>height>1000 -- find images bigger than 1000 height
* </ul>
* <li>ratio (=, &lt;, &gt;, &lt;=, &gt;=) width : height, eg
* <ul>
* <li>ratio=4:3, ratio=16:9 -- standard wallpaper
* <li>ratio=1:1 -- square images
* <li>ratio<1:1 -- tall images
* <li>ratio>1:1 -- wide images
* </ul>
* <li>filesize (=, &lt;, &gt;, &lt;=, &gt;=) size, eg
* <ul>
* <li>filesize&gt;1024 -- no images under 1KB
* <li>filesize&lt=3MB -- shorthand filesizes are supported too
* </ul>
* <li>id (=, &lt;, &gt;, &lt;=, &gt;=) number, eg
* <ul>
* <li>id<20 -- search only the first few images
* <li>id>=500 -- search later images
* </ul>
* <li>user=Username & poster=Username, eg
* <ul>
* <li>user=Shish -- find all of Shish's posts
* <li>poster=Shish -- same as above
* </ul>
* <li>user_id=userID & poster_id=userID, eg
* <ul>
* <li>user_id=2 -- find all posts by user id 2
* <li>poster_id=2 -- same as above
* </ul>
* <li>hash=md5sum & md5=md5sum, eg
* <ul>
* <li>hash=bf5b59173f16b6937a4021713dbfaa72 -- find the "Taiga want up!" image
* <li>md5=bf5b59173f16b6937a4021713dbfaa72 -- same as above
* </ul>
* <li>filetype=type & ext=type, eg
* <ul>
* <li>filetype=png -- find all PNG images
* <li>ext=png -- same as above
* </ul>
* <li>filename=blah & name=blah, eg
* <ul>
* <li>filename=kitten -- find all images with "kitten" in the original filename
* <li>name=kitten -- same as above
* </ul>
* <li>posted (=, &lt;, &gt;, &lt;=, &gt;=) date, eg
* <ul>
* <li>posted&gt;=2009-12-25 posted&lt;=2010-01-01 -- find images posted between christmas and new year
* </ul>
* <li>tags (=, &lt;, &gt;, &lt;=, &gt;=) count, eg
* <ul>
* <li>tags=1 -- search for images with only 1 tag
* <li>tags>=10 -- search for images with 10 or more tags
* <li>tags<25 -- search for images with less than 25 tags
* </ul>
* <li>source=(URL, any, none) eg
* <ul>
* <li>source=http://example.com -- find all images with "http://example.com" in the source
* <li>source=any -- find all images with a source
* <li>source=none -- find all images without a source
* </ul>
* <li>order=(id, width, height, filesize, filename)_(ASC, DESC), eg
* <ul>
* <li>order=width -- find all images sorted from highest > lowest width
* <li>order=filesize_asc -- find all images sorted from lowest > highest filesize
* </ul>
* <li>order=random_####, eg
* <ul>
* <li>order=random_8547 -- find all images sorted randomly using 8547 as a seed
* </ul>
* </ul>
* <p>Search items can be combined to search for images which match both,
* or you can stick "-" in front of an item to search for things that don't
* match it.
* <p>Metatags can be followed by ":" rather than "=" if you prefer.
* <br />I.E: "posted:2014-01-01", "id:>=500" etc.
* <p>Some search methods provided by extensions:
* <ul>
* <li>Numeric Score
* <ul>
* <li>score (=, &lt;, &gt;, &lt;=, &gt;=) number -- seach by score
* <li>upvoted_by=Username -- search for a user's likes
* <li>downvoted_by=Username -- search for a user's dislikes
* <li>upvoted_by_id=UserID -- search for a user's likes by user ID
* <li>downvoted_by_id=UserID -- search for a user's dislikes by user ID
* <li>order=score_(ASC, DESC) -- find all images sorted from by score
* </ul>
* <li>Image Rating
* <ul>
* <li>rating=se -- find safe and explicit images, ignore questionable and unknown
* </ul>
* <li>Favorites
* <ul>
* <li>favorites (=, &lt;, &gt;, &lt;=, &gt;=) number -- search for images favourited a certain number of times
* <li>favourited_by=Username -- search for a user's choices by username
* <li>favorited_by_userno=UserID -- search for a user's choice by userID
* </ul>
* <li>Notes
* <ul>
* <li>notes (=, &lt;, &gt;, &lt;=, &gt;=) number -- search by the number of notes an image has
* <li>notes_by=Username -- search for images containing notes created by username
* <li>notes_by_userno=UserID -- search for images containing notes created by userID
* </ul>
* <li>Artists
* <ul>
* <li>author=ArtistName -- search for images by artist
* </ul>
* <li>Image Comments
* <ul>
* <li>comments (=, &lt;, &gt;, &lt;=, &gt;=) number -- search for images by number of comments
* <li>commented_by=Username -- search for images containing user's comments by username
* <li>commented_by_userno=UserID -- search for images containing user's comments by userID
* </ul>
* <li>Pools
* <ul>
* <li>pool=(PoolID, any, none) -- search for images in a pool by PoolID.
* <li>pool_by_name=PoolName -- search for images in a pool by PoolName. underscores are replaced with spaces
* </ul>
* <li>Post Relationships
* <ul>
* <li>parent=(parentID, any, none) -- search for images by parentID / if they have, do not have a parent
* <li>child=(any, none) -- search for images which have, or do not have children
* </ul>
* </ul>
*/
class IndexInfo extends ExtensionInfo
{
public const KEY = "index";
public $key = self::KEY;
public $name = "Image List";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Show a list of uploaded images";
public $core = true;
}

View file

@ -1,158 +1,4 @@
<?php
/**
* Name: Image List
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Show a list of uploaded images
* Documentation:
* Here is a list of the search methods available out of the box;
* Shimmie extensions may provide other filters:
* <ul>
* <li>by tag, eg
* <ul>
* <li>cat
* <li>pie
* <li>somethi* -- wildcards are supported
* </ul>
* <li>size (=, &lt;, &gt;, &lt;=, &gt;=) width x height, eg
* <ul>
* <li>size=1024x768 -- a specific wallpaper size
* <li>size&gt;=500x500 -- no small images
* <li>size&lt;1000x1000 -- no large images
* </ul>
* <li>width (=, &lt;, &gt;, &lt;=, &gt;=) width, eg
* <ul>
* <li>width=1024 -- find images with 1024 width
* <li>width>2000 -- find images bigger than 2000 width
* </ul>
* <li>height (=, &lt;, &gt;, &lt;=, &gt;=) height, eg
* <ul>
* <li>height=768 -- find images with 768 height
* <li>height>1000 -- find images bigger than 1000 height
* </ul>
* <li>ratio (=, &lt;, &gt;, &lt;=, &gt;=) width : height, eg
* <ul>
* <li>ratio=4:3, ratio=16:9 -- standard wallpaper
* <li>ratio=1:1 -- square images
* <li>ratio<1:1 -- tall images
* <li>ratio>1:1 -- wide images
* </ul>
* <li>filesize (=, &lt;, &gt;, &lt;=, &gt;=) size, eg
* <ul>
* <li>filesize&gt;1024 -- no images under 1KB
* <li>filesize&lt=3MB -- shorthand filesizes are supported too
* </ul>
* <li>id (=, &lt;, &gt;, &lt;=, &gt;=) number, eg
* <ul>
* <li>id<20 -- search only the first few images
* <li>id>=500 -- search later images
* </ul>
* <li>user=Username & poster=Username, eg
* <ul>
* <li>user=Shish -- find all of Shish's posts
* <li>poster=Shish -- same as above
* </ul>
* <li>user_id=userID & poster_id=userID, eg
* <ul>
* <li>user_id=2 -- find all posts by user id 2
* <li>poster_id=2 -- same as above
* </ul>
* <li>hash=md5sum & md5=md5sum, eg
* <ul>
* <li>hash=bf5b59173f16b6937a4021713dbfaa72 -- find the "Taiga want up!" image
* <li>md5=bf5b59173f16b6937a4021713dbfaa72 -- same as above
* </ul>
* <li>filetype=type & ext=type, eg
* <ul>
* <li>filetype=png -- find all PNG images
* <li>ext=png -- same as above
* </ul>
* <li>filename=blah & name=blah, eg
* <ul>
* <li>filename=kitten -- find all images with "kitten" in the original filename
* <li>name=kitten -- same as above
* </ul>
* <li>posted (=, &lt;, &gt;, &lt;=, &gt;=) date, eg
* <ul>
* <li>posted&gt;=2009-12-25 posted&lt;=2010-01-01 -- find images posted between christmas and new year
* </ul>
* <li>tags (=, &lt;, &gt;, &lt;=, &gt;=) count, eg
* <ul>
* <li>tags=1 -- search for images with only 1 tag
* <li>tags>=10 -- search for images with 10 or more tags
* <li>tags<25 -- search for images with less than 25 tags
* </ul>
* <li>source=(URL, any, none) eg
* <ul>
* <li>source=http://example.com -- find all images with "http://example.com" in the source
* <li>source=any -- find all images with a source
* <li>source=none -- find all images without a source
* </ul>
* <li>order=(id, width, height, filesize, filename)_(ASC, DESC), eg
* <ul>
* <li>order=width -- find all images sorted from highest > lowest width
* <li>order=filesize_asc -- find all images sorted from lowest > highest filesize
* </ul>
* <li>order=random_####, eg
* <ul>
* <li>order=random_8547 -- find all images sorted randomly using 8547 as a seed
* </ul>
* </ul>
* <p>Search items can be combined to search for images which match both,
* or you can stick "-" in front of an item to search for things that don't
* match it.
* <p>Metatags can be followed by ":" rather than "=" if you prefer.
* <br />I.E: "posted:2014-01-01", "id:>=500" etc.
* <p>Some search methods provided by extensions:
* <ul>
* <li>Numeric Score
* <ul>
* <li>score (=, &lt;, &gt;, &lt;=, &gt;=) number -- seach by score
* <li>upvoted_by=Username -- search for a user's likes
* <li>downvoted_by=Username -- search for a user's dislikes
* <li>upvoted_by_id=UserID -- search for a user's likes by user ID
* <li>downvoted_by_id=UserID -- search for a user's dislikes by user ID
* <li>order=score_(ASC, DESC) -- find all images sorted from by score
* </ul>
* <li>Image Rating
* <ul>
* <li>rating=se -- find safe and explicit images, ignore questionable and unknown
* </ul>
* <li>Favorites
* <ul>
* <li>favorites (=, &lt;, &gt;, &lt;=, &gt;=) number -- search for images favourited a certain number of times
* <li>favourited_by=Username -- search for a user's choices by username
* <li>favorited_by_userno=UserID -- search for a user's choice by userID
* </ul>
* <li>Notes
* <ul>
* <li>notes (=, &lt;, &gt;, &lt;=, &gt;=) number -- search by the number of notes an image has
* <li>notes_by=Username -- search for images containing notes created by username
* <li>notes_by_userno=UserID -- search for images containing notes created by userID
* </ul>
* <li>Artists
* <ul>
* <li>author=ArtistName -- search for images by artist
* </ul>
* <li>Image Comments
* <ul>
* <li>comments (=, &lt;, &gt;, &lt;=, &gt;=) number -- search for images by number of comments
* <li>commented_by=Username -- search for images containing user's comments by username
* <li>commented_by_userno=UserID -- search for images containing user's comments by userID
* </ul>
* <li>Pools
* <ul>
* <li>pool=(PoolID, any, none) -- search for images in a pool by PoolID.
* <li>pool_by_name=PoolName -- search for images in a pool by PoolName. underscores are replaced with spaces
* </ul>
* <li>Post Relationships
* <ul>
* <li>parent=(parentID, any, none) -- search for images by parentID / if they have, do not have a parent
* <li>child=(any, none) -- search for images which have, or do not have children
* </ul>
* </ul>
*/
/*
* SearchTermParseEvent:

28
ext/ipban/info.php Normal file
View file

@ -0,0 +1,28 @@
<?php
/*
* Name: IP Ban
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Ban IP addresses
* Documentation:
*
*/
class IPBanInfo extends ExtensionInfo
{
public const KEY = "ipban";
public $key = self::KEY;
public $name = "IP Ban";
public $url = self::SHIMMIE_URL;
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $description = "Ban IP addresses";
public $documentation =
"<b>Adding a Ban</b>
<br>IP: Can be a single IP (eg. 123.234.210.21), or a CIDR block (eg. 152.23.43.0/24)
<br>Reason: Any text, for the admin to remember why the ban was put in place
<br>Until: Either a date in YYYY-MM-DD format, or an offset like \"3 days\"";
}

View file

@ -1,16 +1,4 @@
<?php
/*
* Name: IP Ban
* Author: Shish <webmaster@shishnet.org>
* Link: http://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: Ban IP addresses
* Documentation:
* <b>Adding a Ban</b>
* <br>IP: Can be a single IP (eg. 123.234.210.21), or a CIDR block (eg. 152.23.43.0/24)
* <br>Reason: Any text, for the admin to remember why the ban was put in place
* <br>Until: Either a date in YYYY-MM-DD format, or an offset like "3 days"
*/
// RemoveIPBanEvent {{{
class RemoveIPBanEvent extends Event

17
ext/link_image/info.php Normal file
View file

@ -0,0 +1,17 @@
<?php
/*
* Name: Link to Image
* Author: Artanis <artanis.00@gmail.com>
* Description: Show various forms of link to each image, for copy & paste
*/
class LinkImageInfo extends ExtensionInfo
{
public const KEY = "link_image";
public $key = self::KEY;
public $name = "Link to Image";
public $authors = ["Artanis"=>"artanis.00@gmail.com"];
public $description = "Show various forms of link to each image, for copy & paste";
}

View file

@ -1,9 +1,5 @@
<?php
/*
* Name: Link to Image
* Author: Artanis <artanis.00@gmail.com>
* Description: Show various forms of link to each image, for copy & paste
*/
class LinkImage extends Extension
{
public function onDisplayingImage(DisplayingImageEvent $event)

22
ext/livefeed/info.php Normal file
View file

@ -0,0 +1,22 @@
<?php
/*
* Name: Live Feed
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Visibility: admin
* Description: Logs user-safe (no IPs) data to a UDP socket, eg IRCCat
* Documentation:
*/
class LiveFeedInfo extends ExtensionInfo
{
public const KEY = "livefeed";
public $key = self::KEY;
public $name = "Live Feed";
public $authors = self::SHISH_AUTHOR;
public $license = self::LICENSE_GPLV2;
public $visibility = self::VISIBLE_ADMIN;
public $description = "Logs user-safe (no IPs) data to a UDP socket, eg IRCCat";
}

View file

@ -1,12 +1,4 @@
<?php
/*
* Name: Live Feed
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Visibility: admin
* Description: Logs user-safe (no IPs) data to a UDP socket, eg IRCCat
* Documentation:
*/
class LiveFeed extends Extension
{

Some files were not shown because too many files have changed in this diff Show more