diff --git a/.gitignore b/.gitignore index e0874880..6dd0495a 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ ext/image_hash_ban ext/ipban ext/link_image ext/log_db +ext/mass_tagger ext/news ext/notes ext/numeric_score @@ -62,6 +63,7 @@ ext/text_score ext/tips ext/twitter_soc ext/upload_cmd +ext/update ext/wiki ext/word_filter ext/zoom diff --git a/contrib/admin/main.php b/contrib/admin/main.php index c099b066..3d03915d 100644 --- a/contrib/admin/main.php +++ b/contrib/admin/main.php @@ -35,16 +35,11 @@ class AdminBuildingEvent extends Event { } } -class AdminPage implements Extension { - var $theme; +class AdminPage extends SimpleExtension { + public function onPageRequest($event) { + global $page, $user; - public function get_priority() {return 50;} - - public function receive_event(Event $event) { - global $config, $database, $page, $user; - if(is_null($this->theme)) $this->theme = get_theme_object($this); - - if(($event instanceof PageRequestEvent) && $event->page_matches("admin")) { + if($event->page_matches("admin")) { if(!$user->is_admin()) { $this->theme->display_permission_denied($page); } @@ -53,7 +48,7 @@ class AdminPage implements Extension { } } - if(($event instanceof PageRequestEvent) && $event->page_matches("admin_utils")) { + if($event->page_matches("admin_utils")) { if($user->is_admin() && $user->check_auth_token()) { log_info("admin", "Util: {$_POST['action']}"); set_time_limit(0); @@ -91,16 +86,18 @@ class AdminPage implements Extension { } } } + } - if($event instanceof AdminBuildingEvent) { - $this->theme->display_page($page); - $this->theme->display_form($page); - } + public function onAdminBuilding($event) { + global $page; + $this->theme->display_page($page); + $this->theme->display_form($page); + } - if($event instanceof UserBlockBuildingEvent) { - if($user->is_admin()) { - $event->add_link("Board Admin", make_link("admin")); - } + public function onUserBlockBuilding($event) { + global $user; + if($user->is_admin()) { + $event->add_link("Board Admin", make_link("admin")); } } @@ -134,10 +131,8 @@ class AdminPage implements Extension { } private function dbdump($page) { - include "config.php"; - $matches = array(); - preg_match("#(\w+)://(\w+):(\w+)@([\w\.\-]+)/([\w_]+)(\?.*)?#", $database_dsn, $matches); + preg_match("#(\w+)://(\w+):(\w+)@([\w\.\-]+)/([\w_]+)(\?.*)?#", DATABASE_DSN, $matches); $software = $matches[1]; $username = $matches[2]; $password = $matches[3]; diff --git a/contrib/artists/main.php b/contrib/artists/main.php index cd9190cb..0bde987d 100644 --- a/contrib/artists/main.php +++ b/contrib/artists/main.php @@ -914,8 +914,10 @@ class Artists implements Extension { , array( $artistID )); - - for ($i = 0 ; $i < count($result) ; $i++) + + $num = count($result); + + for ($i = 0 ; $i < $num ; $i++) { $result[$i]["name"] = stripslashes($result[$i]["name"]); } @@ -931,8 +933,10 @@ class Artists implements Extension { , array( $artistID )); + + $num = count($result); - for ($i = 0 ; $i < count($result) ; $i++) + for ($i = 0 ; $i < $num ; $i++) { $result[$i]["url"] = stripslashes($result[$i]["url"]); } @@ -1048,8 +1052,10 @@ class Artists implements Extension { $pageNumber * $artistsPerPage , $artistsPerPage )); + + $number_of_listings = count($listing); - for ($i = 0 ; $i < count($listing) ; $i++) + for ($i = 0 ; $i < $number_of_listings ; $i++) { $listing[$i]["name"] = stripslashes($listing[$i]["name"]); $listing[$i]["user_name"] = stripslashes($listing[$i]["user_name"]); diff --git a/contrib/blotter/theme.php b/contrib/blotter/theme.php index e8d82860..fd78b467 100644 --- a/contrib/blotter/theme.php +++ b/contrib/blotter/theme.php @@ -55,7 +55,8 @@ class BlotterTheme extends Themelet { // Now, time for entries list. $table_rows = ""; - for ($i = 0 ; $i < count($entries) ; $i++) + $num_entries = count($entries); + for ($i = 0 ; $i < $num_entries ; $i++) { /** * Add table rows @@ -106,7 +107,8 @@ class BlotterTheme extends Themelet { $html .= "Blotter
";
 
-		for ($i = 0 ; $i < count($entries) ; $i++)
+		$num_entries = count($entries);
+		for ($i = 0 ; $i < $num_entries ; $i++)
 		{
 			/**
 			 * Blotter entries
@@ -156,7 +158,8 @@ $(document).ready(function() {
 });
 //-->";
 		$entries_list = "";
-		for ($i = 0 ; $i < count($entries) ; $i++)
+		$num_entries = count($entries);
+		for ($i = 0 ; $i < $num_entries ; $i++)
 		{
 			/**
 			 * Blotter entries
@@ -175,8 +178,8 @@ $(document).ready(function() {
 		$in_text = "";
 		$pos_break = "";
 		$pos_align = "text-align: right; position: absolute; right: 0px;";
-		if($position == "left") { $pos_break = "
"; $pos_align = ""; } - if(count($entries) == 0) { $out_text = "No blotter entries yet."; $in_text = "Empty.";} + if($position === "left") { $pos_break = "
"; $pos_align = ""; } + if(count($entries) === 0) { $out_text = "No blotter entries yet."; $in_text = "Empty.";} else { $clean_date = date("m/d/y",strtotime($entries[0]['entry_date'])); $out_text = "Blotter updated: {$clean_date}"; $in_text = ""; diff --git a/contrib/downtime/main.php b/contrib/downtime/main.php index 5dc57690..8c9ced34 100644 --- a/contrib/downtime/main.php +++ b/contrib/downtime/main.php @@ -11,31 +11,26 @@ * message specified in the box. */ -class Downtime implements Extension { - var $theme; - +class Downtime extends SimpleExtension { public function get_priority() {return 10;} - public function receive_event(Event $event) { - global $config, $database, $page, $user; - if(is_null($this->theme)) $this->theme = get_theme_object($this); + public function onSetupBuilding($event) { + $sb = new SetupBlock("Downtime"); + $sb->add_bool_option("downtime", "Disable non-admin access: "); + $sb->add_longtext_option("downtime_message", "
"); + $event->panel->add_block($sb); + } - if($event instanceof SetupBuildingEvent) { - $sb = new SetupBlock("Downtime"); - $sb->add_bool_option("downtime", "Disable non-admin access: "); - $sb->add_longtext_option("downtime_message", "
"); - $event->panel->add_block($sb); - } + public function onPageRequest($event) { + global $config, $page, $user; - if($event instanceof PageRequestEvent) { - if($config->get_bool("downtime")) { - if(!$user->is_admin() && !$this->is_safe_page($event)) { - $msg = $config->get_string("downtime_message"); - $this->theme->display_message($msg); - exit; - } - $this->theme->display_notification($page); + if($config->get_bool("downtime")) { + if(!$user->is_admin() && !$this->is_safe_page($event)) { + $msg = $config->get_string("downtime_message"); + $this->theme->display_message($msg); + exit; } + $this->theme->display_notification($page); } } diff --git a/contrib/downtime/theme.php b/contrib/downtime/theme.php index 0003c2af..e529209e 100644 --- a/contrib/downtime/theme.php +++ b/contrib/downtime/theme.php @@ -6,7 +6,7 @@ class DowntimeTheme extends Themelet { */ public function display_notification(Page $page) { $page->add_block(new Block("Downtime", - "DOWNTIME MODE IS ON!", "left", 0)); + "
DOWNTIME MODE IS ON!
", "left", 0)); } /** @@ -28,7 +28,7 @@ class DowntimeTheme extends Themelet {
-

Down for Maintenance

+

Down for Maintenance

$message
diff --git a/contrib/emoticons/main.php b/contrib/emoticons/main.php index b7b9e82f..67d14e29 100644 --- a/contrib/emoticons/main.php +++ b/contrib/emoticons/main.php @@ -23,7 +23,6 @@ class Emoticons extends FormatterExtension { return $text; } } -add_event_listener(new Emoticons()); class EmoticonList extends SimpleExtension { public function onPageRequest($event) { diff --git a/contrib/featured/theme.php b/contrib/featured/theme.php index e4a3ab78..74a4134e 100644 --- a/contrib/featured/theme.php +++ b/contrib/featured/theme.php @@ -5,7 +5,7 @@ class FeaturedTheme extends Themelet { * Show $text on the $page */ public function display_featured(Page $page, Image $image) { - $page->add_block(new Block("Featured Image", $this->build_thumb_html($image), "left", 3)); + $page->add_block(new Block("Featured Image", $this->build_featured_html($image), "left", 3)); } public function get_buttons_html($image_id) { @@ -18,5 +18,25 @@ class FeaturedTheme extends Themelet { "; } + + public function build_featured_html(Image $image, $query=null) { + global $config; + $i_id = int_escape($image->id); + $h_view_link = make_link("post/view/$i_id", $query); + $h_thumb_link = $image->get_thumb_link(); + $h_tip = html_escape($image->get_tooltip()); + $tsize = get_thumbnail_size($image->width, $image->height); + + + return " +
+ + + $h_tip + + +
+ "; + } } ?> diff --git a/contrib/handle_flash/main.php b/contrib/handle_flash/main.php index 79cfc4ff..013528ac 100644 --- a/contrib/handle_flash/main.php +++ b/contrib/handle_flash/main.php @@ -56,7 +56,8 @@ class FlashFileHandler extends DataHandlerExtension { private function str_to_binarray($string) { $binary = array(); - for($j=0; $j=0; $i--) { $binary[] = ($c >> $i) & 0x01; diff --git a/contrib/handle_mp3/theme.php b/contrib/handle_mp3/theme.php index 7844f595..953f9a19 100644 --- a/contrib/handle_mp3/theme.php +++ b/contrib/handle_mp3/theme.php @@ -4,13 +4,14 @@ class MP3FileHandlerTheme extends Themelet { public function display_image(Page $page, Image $image) { $data_href = get_base_href(); $ilink = $image->get_image_link(); + $fname = url_escape($image->filename); //Most of the time this will be the title/artist of the song. $html = " - diff --git a/contrib/home/main.php b/contrib/home/main.php index b6172016..f9485309 100644 --- a/contrib/home/main.php +++ b/contrib/home/main.php @@ -21,8 +21,7 @@ class Home extends SimpleExtension { $config->set_default_string("home_links", '[$base/post/list|Posts] [$base/comment/list|Comments] [$base/tags|Tags] -[$base/wiki|Wiki] -[$base/wiki/more|»]'); +[$base/ext_doc|»]'); } public function onPageRequest(PageRequestEvent $event) { @@ -46,7 +45,8 @@ class Home extends SimpleExtension { } $sb = new SetupBlock("Home Page"); - $sb->add_longtext_option("home_links", 'Page Links - Example: [/post/list|Posts]
'); + $sb->add_bool_option("home_choice", "Use custom page links: "); + $sb->add_longtext_option("home_links", '
Page Links - Example: [/post/list|Posts]
'); $sb->add_longtext_option("home_text", "
Page Text:
"); $sb->add_choice_option("home_counter", $counters, "
Counter: "); $event->panel->add_block($sb); @@ -67,13 +67,21 @@ class Home extends SimpleExtension { $num_comma = number_format($total); $counter_text = ""; - for($n=0; $nget_string('home_links'); + if($config->get_bool('home_choice')){ + $main_links = $config->get_string('home_links'); + }else{ + $main_links = '[$base/post/list|Posts] [$base/comment/list|Comments] [$base/tags|Tags]'; + if(file_exists("ext/pools")){$main_links .= ' [$base/pools|Pools]';} + if(file_exists("ext/wiki")){$main_links .= ' [$base/wiki|Wiki]';} + $main_links .= ' [$base/ext_doc|»]'; + } $main_links = str_replace('$base', $base_href, $main_links); $main_links = preg_replace('#\[(.*?)\|(.*?)\]#', "\\2", $main_links); $main_links = str_replace('//', "/", $main_links); diff --git a/contrib/home/theme.php b/contrib/home/theme.php index eda5e815..da3c80a8 100644 --- a/contrib/home/theme.php +++ b/contrib/home/theme.php @@ -29,6 +29,7 @@ EOD $main_links_html = empty($main_links) ? "" : ""; $message_html = empty($main_text) ? "" : "
$main_text
"; $counter_html = empty($counter_text) ? "" : "
$counter_text
"; + $contact_link = empty($contact_link) ? "" : "
Contact –"; $search_html = "