diff --git a/contrib/downtime/test.php b/contrib/downtime/test.php
index b341a983..8870416e 100644
--- a/contrib/downtime/test.php
+++ b/contrib/downtime/test.php
@@ -1,5 +1,5 @@
log_in_as_admin();
$this->get_page("setup");
diff --git a/contrib/downtime/theme.php b/contrib/downtime/theme.php
index 65511fa2..ac398cc7 100644
--- a/contrib/downtime/theme.php
+++ b/contrib/downtime/theme.php
@@ -1,7 +1,7 @@
DOWNTIME MODE IS ON!", "left", 0));
}
- /*
+ /**
* Display $message and exit
*/
public function display_message($message) {
diff --git a/contrib/ipban/test.php b/contrib/ipban/test.php
index d821a3bc..0cd06f3b 100644
--- a/contrib/ipban/test.php
+++ b/contrib/ipban/test.php
@@ -1,5 +1,5 @@
get_page('ip_ban/list');
$this->assertResponse(403);
diff --git a/contrib/news/test.php b/contrib/news/test.php
index 0e959439..cbfb71a5 100644
--- a/contrib/news/test.php
+++ b/contrib/news/test.php
@@ -1,5 +1,5 @@
log_in_as_admin();
diff --git a/contrib/pm/test.php b/contrib/pm/test.php
index 74bccb49..8879d7bf 100644
--- a/contrib/pm/test.php
+++ b/contrib/pm/test.php
@@ -1,5 +1,5 @@
log_in_as_admin();
$this->get_page("user/test");
diff --git a/contrib/random_image/main.php b/contrib/random_image/main.php
index 4c87b1a7..e15e4b17 100644
--- a/contrib/random_image/main.php
+++ b/contrib/random_image/main.php
@@ -19,14 +19,10 @@
* /random_image/download/size:1024x768+cute
*/
-class RandomImage implements Extension {
- var $theme;
-
- public function receive_event(Event $event) {
+class RandomImage extends SimpleExtension {
+ public function onPageRequest($event) {
global $config, $database, $page, $user;
- if(is_null($this->theme)) $this->theme = get_theme_object($this);
-
- if(($event instanceof PageRequestEvent) && $event->page_matches("random_image")) {
+ if($event->page_matches("random_image")) {
if($event->count_args() == 1) {
$action = $event->get_arg(0);
$search_terms = array();
@@ -50,22 +46,22 @@ class RandomImage implements Extension {
}
}
}
+ }
- if(($event instanceof SetupBuildingEvent)) {
- $sb = new SetupBlock("Random Image");
- $sb->add_bool_option("show_random_block", "Show Random Block: ");
- $event->panel->add_block($sb);
- }
+ public function onSetupBuilding($event) {
+ $sb = new SetupBlock("Random Image");
+ $sb->add_bool_option("show_random_block", "Show Random Block: ");
+ $event->panel->add_block($sb);
+ }
- if($event instanceof PostListBuildingEvent) {
- if($config->get_bool("show_random_block")) {
- $image = Image::by_random($event->search_terms);
- if(!is_null($image)) {
- $this->theme->display_random($page, $image);
- }
+ public function onPostListBuilding($event) {
+ global $config, $page;
+ if($config->get_bool("show_random_block")) {
+ $image = Image::by_random($event->search_terms);
+ if(!is_null($image)) {
+ $this->theme->display_random($page, $image);
}
}
}
}
-add_event_listener(new RandomImage());
?>
diff --git a/contrib/simpletest/main.php b/contrib/simpletest/main.php
index 377efa93..013cffd3 100644
--- a/contrib/simpletest/main.php
+++ b/contrib/simpletest/main.php
@@ -6,6 +6,19 @@
* Description: adds unit testing to SCore
*/
+/**
+ * \page unittests Unit Tests
+ *
+ * Each extension should (although doesn't technically have to) come with a
+ * test.php file, for example ext/index/test.php. The SimpleSCoreTest
+ * extension will look for these files and load any SCoreWebTestCase classes
+ * it finds inside them, then run them and report whether or not the test
+ * passes.
+ *
+ * For Shimmie2 specific extensions, there is a ShimmieWebTestCase class which
+ * includes functions to upload and delete images.
+ */
+
require_once('simpletest/web_tester.php');
require_once('simpletest/unit_tester.php');
require_once('simpletest/reporter.php');
@@ -15,6 +28,9 @@ define('USER_PASS', "test");
define('ADMIN_NAME', "demo");
define('ADMIN_PASS', "demo");
+/**
+ * A set of common SCore activities to test
+ */
class SCoreWebTestCase extends WebTestCase {
protected function get_page($page) {
$url = "http://".$_SERVER["HTTP_HOST"].get_base_href().'/'.make_link($page);
@@ -49,6 +65,9 @@ class SCoreWebTestCase extends WebTestCase {
}
}
+/**
+ * A set of common Shimmie activities to test
+ */
class ShimmieWebTestCase extends SCoreWebTestCase {
protected function post_image($filename, $tags) {
$image_id = -1;
@@ -81,6 +100,7 @@ class ShimmieWebTestCase extends SCoreWebTestCase {
}
}
+/** @private */
class TestFinder extends TestSuite {
function TestFinder($hint) {
if(strpos($hint, "..") !== FALSE) return;
diff --git a/contrib/simpletest/theme.php b/contrib/simpletest/theme.php
index 7d74c2b3..7a06a8fc 100644
--- a/contrib/simpletest/theme.php
+++ b/contrib/simpletest/theme.php
@@ -2,6 +2,7 @@
class SimpleSCoreTestTheme extends Themelet {
}
+/** @private */
class SCoreReporter extends HtmlReporter {
var $current_html = "";
var $clear_modules = array();
diff --git a/contrib/site_description/main.php b/contrib/site_description/main.php
index 72d00d05..610c1d17 100644
--- a/contrib/site_description/main.php
+++ b/contrib/site_description/main.php
@@ -8,22 +8,19 @@
* This extension sets the "description" meta tag in the header
* of pages so that search engines can pick it up
*/
-class SiteDescription implements Extension {
- public function receive_event(Event $event) {
- global $config, $database, $page, $user;
- if($event instanceof PageRequestEvent) {
- if(strlen($config->get_string("site_description")) > 0) {
- $description = $config->get_string("site_description");
- $page->add_header("");
- }
- }
-
- if($event instanceof SetupBuildingEvent) {
- $sb = new SetupBlock("Site Description");
- $sb->add_longtext_option("site_description");
- $event->panel->add_block($sb);
+class SiteDescription extends SimpleExtension {
+ public function onPageRequest(PageRequestEvent $event) {
+ global $config, $page;
+ if(strlen($config->get_string("site_description")) > 0) {
+ $description = $config->get_string("site_description");
+ $page->add_header("");
}
}
+
+ public function onSetupBuilding(SetupBuildingEvent $event) {
+ $sb = new SetupBlock("Site Description");
+ $sb->add_longtext_option("site_description");
+ $event->panel->add_block($sb);
+ }
}
-add_event_listener(new SiteDescription());
?>
diff --git a/contrib/site_description/test.php b/contrib/site_description/test.php
index 089d229c..9fe0931d 100644
--- a/contrib/site_description/test.php
+++ b/contrib/site_description/test.php
@@ -1,5 +1,5 @@
log_in_as_admin();
$this->get_page('setup');
diff --git a/contrib/wiki/test.php b/contrib/wiki/test.php
index c411679d..0f3ed439 100644
--- a/contrib/wiki/test.php
+++ b/contrib/wiki/test.php
@@ -1,5 +1,5 @@
log_in_as_admin();
$this->get_page("wiki");
diff --git a/contrib/wiki/theme.php b/contrib/wiki/theme.php
index c3cc4083..d1ed22bc 100644
--- a/contrib/wiki/theme.php
+++ b/contrib/wiki/theme.php
@@ -1,6 +1,6 @@
= 5.2.1)
# Based on http://www.phpit.net/
# article/creating-zip-tar-archives-dynamically-php/2/
if(!function_exists('sys_get_temp_dir')) {
-/**
- * @ignore
- */
function sys_get_temp_dir() {
// Try to get from environment variable
if(!empty($_ENV['TMP'])) {
@@ -46,9 +42,6 @@ function sys_get_temp_dir() {
# (PHP >= 5.1)
# from http://www.php.net/inet_pton
if(!function_exists('inet_pton')) {
-/**
- * @ignore
- */
function inet_pton($ip) {
# ipv4
if(strpos($ip, '.') !== FALSE) {
@@ -70,9 +63,6 @@ function inet_pton($ip) {
# (PHP >= 5.1)
# from http://www.php.net/inet_ntop
if(!function_exists('inet_ntop')) {
-/**
- * @ignore
- */
function inet_ntop($ip) {
if (strlen($ip)==4) {
// ipv4
diff --git a/core/config.class.php b/core/config.class.php
index 9413fd3b..e8967f55 100644
--- a/core/config.class.php
+++ b/core/config.class.php
@@ -1,8 +1,4 @@
- *
- * @ignore
*/
class StaticConfig extends BaseConfig {
public function __construct($filename) {
@@ -135,12 +127,12 @@ class StaticConfig extends BaseConfig {
* Loads the config list from a table in a given database, the table should
* be called config and have the schema:
*
+ * \code
* CREATE TABLE config(
* name VARCHAR(255) NOT NULL,
* value TEXT
* );
- *
- * @ignore
+ * \endcode
*/
class DatabaseConfig extends BaseConfig {
var $database = null;
diff --git a/core/database.class.php b/core/database.class.php
index 3648ef23..453edfb5 100644
--- a/core/database.class.php
+++ b/core/database.class.php
@@ -1,16 +1,10 @@
misses;}
}
// }}}
-/**#@-*/
+/** @publicsection */
/**
* A class for controlled database access
diff --git a/core/event.class.php b/core/event.class.php
index 376f32be..4ce3a795 100644
--- a/core/event.class.php
+++ b/core/event.class.php
@@ -1,8 +1,4 @@
formatted;
+ * \endcode
+ *
+ * An extension is something which is capable of reacting to events. They
+ * register themselves using the add_event_listener() function, after which
+ * events will be sent to the object's recieve_event() function.
+ *
+ * SimpleExtension subclasses are slightly different -- they are registered
+ * automatically, and events are sent to a named method, eg PageRequestEvent
+ * will be sent to onPageRequest()
+ *
+ *
+ * \page hello The Hello World Extension
+ *
+ * \code
+ * // ext/hello/main.php
+ * public class Hello extends SimpleExtension {
+ * public void onPageRequest(PageRequestEvent $event) {
+ * global $page, $user;
+ * $this->theme->display_hello($page, $user);
+ * }
+ * }
+ *
+ * // ext/hello/theme.php
+ * public class HelloTheme extends Themelet {
+ * public void display_hello(Page $page, User $user) {
+ * $page->add_block(new Block("Hello!", "Hello there ".html_escape($user->name));
+ * }
+ * }
+ *
+ * // ext/hello/test.php
+ * public class HelloTest extends ShimmieWebTestCase {
+ * public void testHello() {
+ * $this->get_page("post/list");
+ * $this->assertText("Hello there");
+ * }
+ * }
+ *
+ * // themes/mytheme/hello.theme.php
+ * public class CustomHelloTheme extends HelloTheme {
+ * public function display_hello(Page $page, User $user) {
+ * $h_user = html_escape($user->name);
+ * $page->add_block(new Block(
+ * "Hello!",
+ * "Hello there $h_user, look at my snazzy custom theme!"
+ * );
+ * }
+ * }
+ * \endcode
+ *
*/
/**
@@ -19,7 +78,7 @@ interface Extension {
* priority, so no need for register_extension(new Foo())
*
* Hopefully this removes as much copy & paste code from the extension
- * files as possible \o/
+ * files as possible~
*
* The original concept came from Artanis's SimpleExtension extension
* --> http://github.com/Artanis/simple-extension/tree/master
diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php
index 17cea819..d8b8089e 100644
--- a/core/imageboard.pack.php
+++ b/core/imageboard.pack.php
@@ -2,8 +2,21 @@
/**
* All the imageboard-specific bits of code should be in this file, everything
* else in /core should be standard SCore bits.
- *
- * @package SCore
+ */
+
+/**
+ * \page search Shimmie2: Searching
+ *
+ * The current search system is built of several search item -> image ID list
+ * translators, eg:
+ *
+ * \li the item "fred" will search the image_tags table to find image IDs with the fred tag
+ * \li the item "size=640x480" will search the images table to find image IDs of 640x480 images
+ *
+ * So the search "fred size=640x480" will calculate two lists and take the
+ * intersection. (There are some optimisations in there making it more
+ * complicated behind the scenes, but as long as you can turn a single word
+ * into a list of image IDs, making a search plugin should be simple)
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
@@ -42,7 +55,7 @@ class Image {
/**
* Find an image by ID
*
- * @var Image
+ * @retval Image
*/
public static function by_id($id) {
assert(is_numeric($id));
@@ -55,7 +68,7 @@ class Image {
/**
* Find an image by hash
*
- * @var Image
+ * @retval Image
*/
public static function by_hash($hash) {
assert(is_string($hash));
@@ -68,7 +81,7 @@ class Image {
/**
* Pick a random image out of a set
*
- * @var Image
+ * @retval Image
*/
public static function by_random($tags=array()) {
assert(is_array($tags));
@@ -145,7 +158,7 @@ class Image {
* Rather than simply $this_id + 1, one must take into account
* deleted images and search queries
*
- * @var Image
+ * @retval Image
*/
public function get_next($tags=array(), $next=true) {
assert(is_array($tags));
@@ -177,7 +190,7 @@ class Image {
/**
* The reverse of get_next
*
- * @var Image
+ * @retval Image
*/
public function get_prev($tags=array()) {
return $this->get_next($tags, false);
@@ -186,7 +199,7 @@ class Image {
/**
* Find the User who owns this Image
*
- * @var User
+ * @retval User
*/
public function get_owner() {
return User::by_id($this->owner_id);
@@ -223,7 +236,7 @@ class Image {
/**
* Get the URL for the full size image
*
- * @var string
+ * @retval string
*/
public function get_image_link() {
global $config;
@@ -242,7 +255,7 @@ class Image {
* Get a short link to the full size image
*
* @deprecated
- * @var string
+ * @retval string
*/
public function get_short_link() {
global $config;
@@ -252,7 +265,7 @@ class Image {
/**
* Get the URL for the thumbnail
*
- * @var string
+ * @retval string
*/
public function get_thumb_link() {
global $config;
@@ -271,7 +284,7 @@ class Image {
* Get the tooltip for this image, formatted according to the
* configured template
*
- * @var string
+ * @retval string
*/
public function get_tooltip() {
global $config;
@@ -281,7 +294,7 @@ class Image {
/**
* Figure out where the full size image is on disk
*
- * @var string
+ * @retval string
*/
public function get_image_filename() {
$hash = $this->hash;
@@ -293,7 +306,7 @@ class Image {
/**
* Figure out where the thumbnail is on disk
*
- * @var string
+ * @retval string
*/
public function get_thumb_filename() {
$hash = $this->hash;
@@ -304,7 +317,7 @@ class Image {
/**
* Get the original filename
*
- * @var string
+ * @retval string
*/
public function get_filename() {
return $this->filename;
@@ -315,7 +328,7 @@ class Image {
*
* FIXME: now we handle more than just images
*
- * @var string
+ * @retval string
*/
public function get_mime_type() {
return "image/".($this->ext);
@@ -324,7 +337,7 @@ class Image {
/**
* Get the image's filename extension
*
- * @var string
+ * @retval string
*/
public function get_ext() {
return $this->ext;
@@ -333,7 +346,7 @@ class Image {
/**
* Get the image's source URL
*
- * @var string
+ * @retval string
*/
public function get_source() {
return $this->source;
@@ -418,9 +431,9 @@ class Image {
}
/**
- * ...?
+ * Someone please explain this
*
- * @var string
+ * @retval string
*/
public function parse_link_template($tmpl, $_escape="url_escape") {
global $config;
diff --git a/core/page.class.php b/core/page.class.php
index 3686d3a9..c491f32a 100644
--- a/core/page.class.php
+++ b/core/page.class.php
@@ -1,15 +1,39 @@
admin;
diff --git a/core/util.inc.php b/core/util.inc.php
index 29c9965f..1072c42f 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -1,9 +1,4 @@
1024
*
- * @var int
+ * @retval int
*/
function parse_shorthand_int($limit) {
if(is_numeric($limit)) {
@@ -77,7 +72,7 @@ function parse_shorthand_int($limit) {
/**
* Turn an integer into a human readable filesize, eg 1024 -> 1KB
*
- * @var string
+ * @retval string
*/
function to_shorthand_int($int) {
if($int >= pow(1024, 3)) {
@@ -103,7 +98,7 @@ function to_shorthand_int($int) {
* Figure out the correct way to link to a page, taking into account
* things like the nice URLs setting
*
- * @var string
+ * @retval string
*/
function make_link($page=null, $query=null) {
global $config;
@@ -132,6 +127,10 @@ function make_link($page=null, $query=null) {
}
}
+/**
+ * Make a link to a static file in the current theme's
+ * directory
+ */
function theme_file($filepath) {
global $config;
$theme = $config->get_string("theme","default");
@@ -144,21 +143,21 @@ function theme_file($filepath) {
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
- * @ignore
+ * @private
*/
-function version_check() {
+function _version_check() {
if(version_compare(PHP_VERSION, "5.0.0") == -1) {
- print <<position == $b->position) {
return 0;
}
@@ -227,7 +226,7 @@ function blockcmp($a, $b) {
/**
* Figure out PHP's internal memory limit
*
- * @var int
+ * @retval int
*/
function get_memory_limit() {
global $config;
@@ -257,7 +256,7 @@ function get_memory_limit() {
* Get the currently active IP, masked to make it not change when the last
* octet or two change, for use in session cookies and such
*
- * @var string
+ * @retval string
*/
function get_session_ip($config) {
$mask = $config->get_string("session_hash_mask", "255.255.0.0");
@@ -271,7 +270,7 @@ function get_session_ip($config) {
*
* PHP really, really sucks.
*
- * @var string
+ * @retval string
*/
function get_base_href() {
$possible_vars = array('SCRIPT_NAME', 'PHP_SELF', 'PATH_INFO', 'ORIG_PATH_INFO');
@@ -292,7 +291,7 @@ function get_base_href() {
* A shorthand way to send a TextFormattingEvent and get the
* results
*
- * @var string
+ * @retval string
*/
function format_text($string) {
$tfe = new TextFormattingEvent($string);
@@ -312,10 +311,16 @@ if(!defined("LOG_INFO")) define("LOG_INFO", 20);
if(!defined("LOG_DEBUG")) define("LOG_DEBUG", 10);
if(!defined("LOG_NOTSET")) define("LOG_NOTSET", 0);
+/**
+ * A shorthand way to send a LogEvent
+ */
function log_msg($section, $priority, $message) {
send_event(new LogEvent($section, $priority, $message));
}
+/**
+ * A shorthand way to send a LogEvent
+ */
function log_info($section, $message) {
log_msg($section, LOG_INFO, $message);
}
@@ -328,7 +333,7 @@ function log_info($section, $message) {
/**
* Remove an item from an array
*
- * @var array
+ * @retval array
*/
function array_remove($array, $to_remove) {
$array = array_unique($array);
@@ -344,7 +349,7 @@ function array_remove($array, $to_remove) {
/**
* Add an item to an array
*
- * @var array
+ * @retval array
*/
function array_add($array, $element) {
$array[] = $element;
@@ -355,7 +360,7 @@ function array_add($array, $element) {
/**
* Return the unique elements of an array, case insensitively
*
- * @var array
+ * @retval array
*/
function array_iunique($array) {
$ok = array();
@@ -378,7 +383,7 @@ function array_iunique($array) {
*
* from http://uk.php.net/network
*
- * @var bool
+ * @retval bool
*/
function ip_in_range($IP, $CIDR) {
list ($net, $mask) = split ("/", $CIDR);
@@ -446,33 +451,7 @@ function full_copy($source, $target) {
}
/**
- * @ignore
- */
-function stripslashes_r($arr) {
- return is_array($arr) ? array_map('stripslashes_r', $arr) : stripslashes($arr);
-}
-
-/**
- * @ignore
- */
-function sanitise_environment() {
- if(DEBUG) {
- error_reporting(E_ALL);
- assert_options(ASSERT_ACTIVE, 1);
- assert_options(ASSERT_BAIL, 1);
- }
-
- ob_start();
-
- if(get_magic_quotes_gpc()) {
- $_GET = stripslashes_r($_GET);
- $_POST = stripslashes_r($_POST);
- $_COOKIE = stripslashes_r($_COOKIE);
- }
-}
-
-/**
- * @ignore
+ * @private
*/
function weighted_random($weights) {
$total = 0;
@@ -493,9 +472,7 @@ function weighted_random($weights) {
* Event API *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/**
- * @ignore
- */
+/** @private */
$_event_listeners = array();
/**
@@ -509,9 +486,7 @@ function add_event_listener(Extension $extension, $pos=50) {
$_event_listeners[$pos] = $extension;
}
-/**
- * @ignore
- */
+/** @private */
$_event_count = 0;
/**
@@ -605,13 +580,33 @@ function print_GET() {
* Request initialisation stuff *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/** @privatesection */
+
+function _stripslashes_r($arr) {
+ return is_array($arr) ? array_map('stripslashes_r', $arr) : stripslashes($arr);
+}
+
+function _sanitise_environment() {
+ if(DEBUG) {
+ error_reporting(E_ALL);
+ assert_options(ASSERT_ACTIVE, 1);
+ assert_options(ASSERT_BAIL, 1);
+ }
+
+ ob_start();
+
+ if(get_magic_quotes_gpc()) {
+ $_GET = _stripslashes_r($_GET);
+ $_POST = _stripslashes_r($_POST);
+ $_COOKIE = _stripslashes_r($_COOKIE);
+ }
+}
+
/**
* Turn ^^ into ^ and ^s into /
*
* Necessary because various servers and various clients
* think that / is special...
- *
- * @ignore
*/
function _decaret($str) {
$out = "";
@@ -628,9 +623,6 @@ function _decaret($str) {
return $out;
}
-/**
- * @ignore
- */
function _get_query_parts() {
if(isset($_GET["q"])) {
$path = $_GET["q"];
@@ -660,9 +652,6 @@ function _get_query_parts() {
}
}
-/**
- * @ignore
- */
function _get_page_request() {
global $config;
$args = _get_query_parts();
@@ -674,9 +663,6 @@ function _get_page_request() {
return new PageRequestEvent($args);
}
-/**
- * @ignore
- */
function _get_user() {
global $config, $database;
$user = null;
diff --git a/ext/admin/main.php b/ext/admin/main.php
index 522b4fab..600c9b8d 100644
--- a/ext/admin/main.php
+++ b/ext/admin/main.php
@@ -1,6 +1,5 @@
page = $page;
}
}
-// }}}
class AdminPage implements Extension {
var $theme;
diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php
index 47aa618f..fa374658 100644
--- a/ext/ext_manager/main.php
+++ b/ext/ext_manager/main.php
@@ -7,7 +7,8 @@
* Description: A thing for point & click extension management
*/
-class ExtensionInfo { // {{{
+/** @private */
+class ExtensionInfo {
var $ext_name, $name, $link, $author, $email, $description, $documentation, $version;
function ExtensionInfo($main) {
@@ -66,7 +67,7 @@ class ExtensionInfo { // {{{
private function is_enabled($fname) {
return file_exists("ext/$fname");
}
-} // }}}
+}
class ExtManager extends SimpleExtension {
public function onPageRequest($event) {
diff --git a/ext/ext_manager/test.php b/ext/ext_manager/test.php
index 3c1e1c86..907cd247 100644
--- a/ext/ext_manager/test.php
+++ b/ext/ext_manager/test.php
@@ -1,5 +1,5 @@
get_page('ext_manager');
$this->assertResponse(403);
diff --git a/ext/handle_404/test.php b/ext/handle_404/test.php
index 60e614dd..6f106997 100644
--- a/ext/handle_404/test.php
+++ b/ext/handle_404/test.php
@@ -1,5 +1,5 @@
get_page('not/a/page');
$this->assertResponse(404);
diff --git a/ext/setup/test.php b/ext/setup/test.php
index af168db7..9f6f361d 100644
--- a/ext/setup/test.php
+++ b/ext/setup/test.php
@@ -1,5 +1,5 @@
get_page('setup');
$this->assertResponse(403);
diff --git a/ext/user/test.php b/ext/user/test.php
index 384947af..80ad1190 100644
--- a/ext/user/test.php
+++ b/ext/user/test.php
@@ -1,5 +1,5 @@
get_page('user');
$this->assertTitle("Not Logged In");
diff --git a/index.php b/index.php
index 9e8299da..6388f65d 100644
--- a/index.php
+++ b/index.php
@@ -1,4 +1,55 @@
get_string("theme", "default");
if(!file_exists("themes/$_theme")) $_theme = "default";
- require_once "themes/$_theme/page.class.php";
+ if(file_exists("themes/$_theme/custompage.class.php")) require_once "themes/$_theme/custompage.class.php";
require_once "themes/$_theme/layout.class.php";
require_once "themes/$_theme/themelet.class.php";
@@ -63,7 +114,7 @@ try {
// start the page generation waterfall
- $page = new Page();
+ $page = class_exists("CustomPage") ? new CustomPage() : new Page();
$user = _get_user($config, $database);
send_event(new InitExtEvent());
send_event(_get_page_request());
diff --git a/themes/danbooru/page.class.php b/themes/danbooru/custompage.class.php
similarity index 76%
rename from themes/danbooru/page.class.php
rename to themes/danbooru/custompage.class.php
index e9f12753..1e71720b 100644
--- a/themes/danbooru/page.class.php
+++ b/themes/danbooru/custompage.class.php
@@ -1,6 +1,6 @@
left_enabled = false;
diff --git a/themes/default/layout.class.php b/themes/default/layout.class.php
index 22930649..84bae676 100644
--- a/themes/default/layout.class.php
+++ b/themes/default/layout.class.php
@@ -1,7 +1,12 @@
get_string('theme', 'default');
@@ -71,7 +76,10 @@ $header_html
EOD;
}
- function block_to_html($block, $hidable=false, $salt="") {
+ /**
+ * A handy function which does exactly what it says in the method name
+ */
+ private function block_to_html($block, $hidable=false, $salt="") {
$h = $block->header;
$b = $block->body;
$html = "";
diff --git a/themes/default/page.class.php b/themes/default/page.class.php
deleted file mode 100644
index 07d2fc45..00000000
--- a/themes/default/page.class.php
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/themes/default/setup.theme.php b/themes/default/setup.theme.php
index d59e6729..1da9c867 100644
--- a/themes/default/setup.theme.php
+++ b/themes/default/setup.theme.php
@@ -1,6 +1,11 @@
diff --git a/themes/default/themelet.class.php b/themes/default/themelet.class.php
index aa31c67d..49b41d59 100644
--- a/themes/default/themelet.class.php
+++ b/themes/default/themelet.class.php
@@ -1,5 +1,7 @@
left_enabled = false;
diff --git a/themes/minimal/page.class.php b/themes/minimal/page.class.php
deleted file mode 100644
index 07d2fc45..00000000
--- a/themes/minimal/page.class.php
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/themes/old_default/page.class.php b/themes/old_default/page.class.php
deleted file mode 100644
index 07d2fc45..00000000
--- a/themes/old_default/page.class.php
+++ /dev/null
@@ -1,6 +0,0 @@
-