From 11873e96011357701c648f8c0802ac1e77d868b3 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 4 Jan 2009 11:18:37 -0800 Subject: [PATCH] remove EOL whitespace --- contrib/ban_words/main.php | 2 +- contrib/browser_search/main.php | 42 +++++------ contrib/bulk_add/main.php | 6 +- contrib/bulk_add/theme.php | 2 +- contrib/danbooru_api/main.php | 122 ++++++++++++++++---------------- contrib/downtime/main.php | 2 +- contrib/et/main.php | 2 +- contrib/et/theme.php | 2 +- contrib/event_log/main.php | 6 +- contrib/event_log/theme.php | 2 +- contrib/featured/main.php | 2 +- contrib/handle_archive/main.php | 8 +-- contrib/handle_flash/main.php | 4 +- contrib/handle_flash/theme.php | 2 +- contrib/handle_ico/main.php | 8 +-- contrib/handle_mp3/main.php | 2 +- contrib/handle_mp3/theme.php | 2 +- contrib/handle_svg/main.php | 8 +-- contrib/home/main.php | 12 ++-- contrib/home/theme.php | 2 +- contrib/image_hash_ban/main.php | 4 +- contrib/ipban/main.php | 6 +- contrib/ipban/test.php | 2 +- contrib/link_image/main.php | 8 +-- contrib/link_image/theme.php | 16 ++--- contrib/news/main.php | 2 +- contrib/numeric_score/main.php | 8 +-- contrib/numeric_score/theme.php | 2 +- contrib/piclens/main.php | 6 +- contrib/pm/main.php | 2 +- contrib/random_image/main.php | 2 +- contrib/rating/main.php | 2 +- contrib/report_image/main.php | 24 +++---- contrib/report_image/theme.php | 14 ++-- contrib/res_limit/main.php | 6 +- contrib/rss_comments/main.php | 2 +- contrib/rss_images/main.php | 2 +- contrib/simpletest/theme.php | 2 +- contrib/svn_update/main.php | 4 +- contrib/tag_history/theme.php | 2 +- contrib/tagger/main.php | 48 ++++++------- contrib/tagger/theme.php | 14 ++-- contrib/text_score/main.php | 8 +-- contrib/text_score/theme.php | 2 +- contrib/wiki/main.php | 6 +- contrib/wiki/theme.php | 2 +- contrib/word_filter/main.php | 2 +- contrib/zoom/main.php | 2 +- contrib/zoom/theme.php | 2 +- core/database.class.php | 6 +- core/event.class.php | 2 +- core/imageboard.pack.php | 60 ++++++++-------- core/page.class.php | 8 +-- core/user.class.php | 2 +- core/util.inc.php | 16 ++--- ext/admin/main.php | 6 +- ext/alias_editor/main.php | 4 +- ext/alias_editor/theme.php | 4 +- ext/bbcode/main.php | 4 +- ext/comment/main.php | 4 +- ext/comment/theme.php | 4 +- ext/ext_manager/main.php | 2 +- ext/ext_manager/theme.php | 2 +- ext/handle_pixel/main.php | 10 +-- ext/image/main.php | 8 +-- ext/index/main.php | 8 +-- ext/index/theme.php | 2 +- ext/setup/main.php | 4 +- ext/tag_edit/main.php | 2 +- ext/tag_list/main.php | 14 ++-- ext/tag_list/theme.php | 14 ++-- ext/upgrade/main.php | 2 +- ext/upload/main.php | 10 +-- ext/upload/theme.php | 2 +- ext/user/main.php | 54 +++++++------- ext/user/theme.php | 18 ++--- ext/view/main.php | 4 +- ext/view/theme.php | 2 +- 78 files changed, 360 insertions(+), 358 deletions(-) diff --git a/contrib/ban_words/main.php b/contrib/ban_words/main.php index 3d560d15..be86d052 100644 --- a/contrib/ban_words/main.php +++ b/contrib/ban_words/main.php @@ -20,7 +20,7 @@ porn global $config; $banned = $config->get_string("banned_words"); $comment = strtolower($event->comment); - + foreach(explode("\n", $banned) as $word) { $word = trim(strtolower($word)); if(strlen($word) == 0) { diff --git a/contrib/browser_search/main.php b/contrib/browser_search/main.php index 6be6dd33..c4620fe6 100755 --- a/contrib/browser_search/main.php +++ b/contrib/browser_search/main.php @@ -10,16 +10,16 @@ * October 26, 2007 * */ - + class BrowserSearch implements Extension { public function receive_event(Event $event) { global $page; global $config; - + if($event instanceof InitExtEvent) { $config->set_default_string("search_suggestions_results_order", 'a'); } - + // Add in header code to let the browser know that the search plugin exists if($event instanceof PageRequestEvent) { // We need to build the data for the header @@ -28,23 +28,23 @@ class BrowserSearch implements Extension { $search_file_url = make_link('browser_search/please_dont_use_this_tag_as_it_would_break_stuff__search.xml'); $page->add_header(""); } - + // The search.xml file that is generated on the fly if(($event instanceof PageRequestEvent) && $event->page_matches("browser_search/please_dont_use_this_tag_as_it_would_break_stuff__search.xml")) { // First, we need to build all the variables we'll need - + $search_title = $config->get_string('title'); //$search_form_url = $config->get_string('base_href'); //make_link('post/list'); $search_form_url = make_link('post/list/{searchTerms}'); $suggenton_url = make_link('browser_search/')."{searchTerms}"; - - + + // Now for the XML $xml = " $search_title UTF-8 - data:image/x-icon;base64,AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWFhYAfX19AH9/fwCAgIAAgYGBAIODgwCEhIQAhoaGAIeHhwCJiYkAioqKAIyMjACPj48AkJCQAJKSkgCTk5MAlZWVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEREREREREREREREREREREREAAAAAAAAAAAAAABERERERAAEBAQEBAQEBAQAAEREREQABAQEBAQEBAQEAAQAREREAAQEBAQEBAQEBAAEBABERAAEBAQEBAQEBAQABAQAREQAGBgUEAwIBAQEAAgEAEREADAwMCwsKCQkHAAkIABERABAQEBAQEA4ODAANDQAREQAQEBAQEBAQEBAAEBAAEREAEBAQEBAQEBAQABAQABERAAAAAAAAAAAAAAAQEAAREREAEBAPEBAQEBAQABAAEREREQAQEBAQEBAPEBAAABERERERAAAAAAAAAAAAAAAREREREREREREREREREREREf//AACADwAAgAcAAIADAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAMABAADgAQAA8AEAAP//AAA= $search_form_url @@ -53,56 +53,56 @@ class BrowserSearch implements Extension { "; - + // And now to send it to the browser $page->set_mode("data"); $page->set_type("text/xml"); $page->set_data($xml); } - + else if(($event instanceof PageRequestEvent) && ( $event->page_matches("browser_search") && !$config->get_bool("disable_search_suggestions") )) { global $database; - + // We have to build some json stuff $tag_search = $event->get_arg(0); - + // Now to get DB results - if($config->get_string("search_suggestions_results_order") == "a") { + if($config->get_string("search_suggestions_results_order") == "a") { $tags = $database->execute("SELECT tag FROM tags WHERE tag LIKE ? AND count > 0 ORDER BY tag ASC LIMIT 30",array($tag_search."%")); } else { $tags = $database->execute("SELECT tag FROM tags WHERE tag LIKE ? AND count > 0 ORDER BY count DESC LIMIT 30",array($tag_search."%")); } - - + + // And to do stuff with it. We want our output to look like: // ["shimmie",["shimmies","shimmy","shimmie","21 shimmies","hip shimmies","skea shimmies"],[],[]] $json_tag_list = ""; - + $tags_array = array(); foreach($tags as $tag) { array_push($tags_array,$tag['tag']); } - - + + $json_tag_list .= implode("\",\"", $tags_array); // $json_tag_list = implode($tags_array,", "); // $json_tag_list = "\"".implode($tags_array,"\", \"")."\""; - + // And now for the final output $json_string = "[\"$tag_search\",[\"$json_tag_list\"],[],[]]"; $page->set_mode("data"); $page->set_data($json_string); } - + if($event instanceof SetupBuildingEvent) { $sort_by = array(); $sort_by['Alphabetical'] = 'a'; $sort_by['Tag Count'] = 't'; - + $sb = new SetupBlock("Browser Search"); $sb->add_bool_option("disable_search_suggestions", "Disable search suggestions when using browser-based search: "); $sb->add_label("
"); diff --git a/contrib/bulk_add/main.php b/contrib/bulk_add/main.php index 18638434..283e5938 100644 --- a/contrib/bulk_add/main.php +++ b/contrib/bulk_add/main.php @@ -47,18 +47,18 @@ class BulkAdd implements Extension { private function add_dir($base, $subdir="") { global $page; - + if(!is_dir($base)) { $this->theme->add_status("Error", "$base is not a directory"); return; } $list = ""; - + $dir = opendir("$base/$subdir"); while($filename = readdir($dir)) { $fullpath = "$base/$subdir/$filename"; - + if(is_link($fullpath)) { // ignore } diff --git a/contrib/bulk_add/theme.php b/contrib/bulk_add/theme.php index 961f58ee..990c89af 100644 --- a/contrib/bulk_add/theme.php +++ b/contrib/bulk_add/theme.php @@ -26,7 +26,7 @@ class BulkAddTheme extends Themelet { used as tags for the images within.
Note: this is the folder as seen by the server -- you need to upload via FTP or something first. - +

Directory to add: diff --git a/contrib/danbooru_api/main.php b/contrib/danbooru_api/main.php index 9765adde..6ea4ae4d 100644 --- a/contrib/danbooru_api/main.php +++ b/contrib/danbooru_api/main.php @@ -36,21 +36,21 @@ 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. +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 implements Extension +class DanbooruApi implements Extension { // Receive the event - public function receive_event(Event $event) + public function receive_event(Event $event) { // Check if someone is accessing /api/danbooru (us) - if(($event instanceof PageRequestEvent) && ($event->page_matches("api")) && ($event->get_arg(0) == 'danbooru')) + if(($event instanceof PageRequestEvent) && ($event->page_matches("api")) && ($event->get_arg(0) == 'danbooru')) { // execute the danbooru processing code $this->api_danbooru($event); @@ -65,7 +65,7 @@ class DanbooruApi implements Extension } } } - + // Danbooru API private function api_danbooru($event) { @@ -77,31 +77,31 @@ class DanbooruApi implements Extension $page->set_type("application/xml"); //debug //$page->set_type("text/plain"); - + $results = array(); - + /* add_post() - Adds a post to the database. - Parameters + Adds a post to the database. + Parameters * login: login - * password: password - * file: file as a multipart form - * source: source url + * password: password + * file: file as a multipart form + * source: source url * title: title **IGNORED** - * tags: list of tags as a string, delimited by whitespace - * md5: MD5 hash of upload in hexadecimal format + * tags: list of tags as a string, delimited by whitespace + * md5: MD5 hash of upload in hexadecimal format * rating: rating of the post. can be explicit, questionable, or safe. **IGNORED** - Notes - * The only necessary parameter is tags and either file or source. - * If you want to sign your post, you need a way to authenticate your account, either by supplying login and password, or by supplying a cookie. - * If an account is not supplied or if it doesn‘t authenticate, he post will be added anonymously. - * If the md5 parameter is supplied and does not match the hash of what‘s on the server, the post is rejected. - Response - The response depends on the method used: - Post - * X-Danbooru-Location set to the URL for newly uploaded post. - Get + Notes + * The only necessary parameter is tags and either file or source. + * If you want to sign your post, you need a way to authenticate your account, either by supplying login and password, or by supplying a cookie. + * If an account is not supplied or if it doesn‘t authenticate, he post will be added anonymously. + * If the md5 parameter is supplied and does not match the hash of what‘s on the server, the post is rejected. + Response + The response depends on the method used: + Post + * X-Danbooru-Location set to the URL for newly uploaded post. + Get * Redirected to the newly uploaded post. */ if(($event->get_arg(1) == 'add_post') || (($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'create.xml'))) @@ -137,7 +137,7 @@ class DanbooruApi implements Extension if(isset($_REQUEST['post']['source']) && !empty($_REQUEST['post']['source'])) { $source = $_REQUEST['post']['source']; - } else + } else { $source = null; } @@ -146,19 +146,19 @@ class DanbooruApi implements Extension $url = isset($_REQUEST['source']) ? $_REQUEST['source'] : $_REQUEST['post']['source']; $source = $url; $tmp_filename = tempnam("/tmp", "shimmie_transload"); - + // Are we using fopen wrappers or curl? - if($config->get_string("transload_engine") == "fopen") + if($config->get_string("transload_engine") == "fopen") { $fp = fopen($url, "r"); if(!$fp) { header("HTTP/1.0 409 Conflict"); header("X-Danbooru-Errors: fopen read error"); } - + $data = ""; $length = 0; - while(!feof($fp) && $length <= $config->get_int('upload_size')) + while(!feof($fp) && $length <= $config->get_int('upload_size')) { $data .= fread($fp, 8192); $length = strlen($data); @@ -170,7 +170,7 @@ class DanbooruApi implements Extension fclose($fp); } - if($config->get_string("transload_engine") == "curl") + if($config->get_string("transload_engine") == "curl") { $ch = curl_init($url); $fp = fopen($tmp_filename, "w"); @@ -184,13 +184,13 @@ class DanbooruApi implements Extension } $file = $tmp_filename; $filename = basename($url); - } else + } else { // Nothing was specified at all header("HTTP/1.0 409 Conflict"); header("X-Danbooru-Errors: no input files"); return; } - + // Get tags out of url $posttags = tag_explode(isset($_REQUEST['tags']) ? $_REQUEST['tags'] : $_REQUEST['post']['tags']); $hash = md5_file($file); @@ -206,7 +206,7 @@ class DanbooruApi implements Extension } // Upload size checking is now performed in the upload extension // It is also currently broken due to some confusion over file variable ($tmp_filename?) - + // Does it exist already? $existing = Image::by_hash($config, $database, $hash); if(!is_null($existing)) { @@ -222,7 +222,7 @@ class DanbooruApi implements Extension $metadata['extension'] = $fileinfo['extension']; $metadata['tags'] = $posttags; $metadata['source'] = $source; - + try { $nevent = new DataUploadEvent($user, $file, $metadata); send_event($nevent); @@ -243,23 +243,23 @@ class DanbooruApi implements Extension header("X-Danbooru-Errors: ". $ex->getMessage()); return; } - } else + } else { header("HTTP/1.0 409 Conflict"); header("X-Danbooru-Errors: authentication error"); return; } } - + /* - find_posts() - Find all posts that match the search criteria. Posts will be ordered by id descending. - Parameters - * md5: md5 hash to search for (comma delimited) - * id: id to search for (comma delimited) - * tags: what tags to search for - * limit: limit - * offset: offset + find_posts() + Find all posts that match the search criteria. Posts will be ordered by id descending. + Parameters + * md5: md5 hash to search for (comma delimited) + * id: id to search for (comma delimited) + * tags: what tags to search for + * limit: limit + * offset: offset * after_id: limit results to posts added after this id */ if(($event->get_arg(1) == 'find_posts') || (($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'index.xml'))) @@ -285,7 +285,7 @@ class DanbooruApi implements Extension $tags = isset($_GET['tags']) ? tag_explode($_GET['tags']) : array(); $results = Image::find_images($config,$database,$start,$limit,$tags); } - + // Now we have the array $results filled with Image objects // Let's display them $xml = "\n"; @@ -302,13 +302,13 @@ class DanbooruApi implements Extension $xml .= ""; $page->set_data($xml); } - + /* - find_tags() Find all tags that match the search criteria. - Parameters - * id: A comma delimited list of tag id numbers. - * name: A comma delimited list of tag names. - * tags: any typical tag query. See Tag#parse_query for details. + find_tags() Find all tags that match the search criteria. + Parameters + * id: A comma delimited list of tag id numbers. + * name: A comma delimited list of tag names. + * tags: any typical tag query. See Tag#parse_query for details. * after_id: limit results to tags with an id number after after_id. Useful if you only want to refresh */ if($event->get_arg(1) == 'find_tags') @@ -335,16 +335,16 @@ class DanbooruApi implements Extension $results[] = array($sqlresult->fields['count'], $sqlresult->fields['tag'], $sqlresult->fields['id']); } } - } + } /* Currently disabled to maintain identical functionality to danbooru 1.0's own "broken" find_tags elseif(isset($_GET['tags'])) { $start = isset($_GET['after_id']) ? int_escape($_GET['offset']) : 0; $tags = tag_explode($_GET['tags']); - + } */ - else + else { $start = isset($_GET['after_id']) ? int_escape($_GET['offset']) : 0; $sqlresult = $database->execute("SELECT id,tag,count FROM tags WHERE count > 0 AND id >= ? ORDER BY id DESC",array($start)); @@ -354,7 +354,7 @@ class DanbooruApi implements Extension $sqlresult->MoveNext(); } } - + // Tag results collected, build XML output $xml = "\n"; foreach($results as $tag) @@ -364,7 +364,7 @@ class DanbooruApi implements Extension $xml .= ""; $page->set_data($xml); } - + // Hackery for danbooruup 0.3.2 providing the wrong view url. This simply redirects to the proper // Shimmie view page // Example: danbooruup says the url is http://shimmie/api/danbooru/post/show/123 @@ -375,7 +375,7 @@ class DanbooruApi implements Extension header("Location: $fixedlocation"); } } - + // Turns out I use this a couple times so let's make it a utility function // Authenticates a user based on the contents of the login and password parameters // or makes them anonymous. Does not set any cookies or anything permanent. @@ -404,7 +404,7 @@ class DanbooruApi implements Extension // From htmlspecialchars man page on php.net comments // If tags contain quotes they need to be htmlified - private function xmlspecialchars($text) + private function xmlspecialchars($text) { return str_replace(''', ''', htmlspecialchars($text, ENT_QUOTES)); } diff --git a/contrib/downtime/main.php b/contrib/downtime/main.php index 99dcb9d8..985ea059 100644 --- a/contrib/downtime/main.php +++ b/contrib/downtime/main.php @@ -31,7 +31,7 @@ class Downtime implements Extension { $user = $event->context->user; $config = $event->context->config; - if($config->get_bool("downtime") && !$user->is_admin() && + if($config->get_bool("downtime") && !$user->is_admin() && ($event instanceof PageRequestEvent) && !$this->is_safe_page($event)) { $msg = $config->get_string("downtime_message"); $this->theme->display_message($msg); diff --git a/contrib/et/main.php b/contrib/et/main.php index 62856954..4ca4ef96 100644 --- a/contrib/et/main.php +++ b/contrib/et/main.php @@ -57,7 +57,7 @@ class ET implements Extension { $els[] = get_class($el); } $info['sys_extensions'] = join(', ', $els); - + //$cfs = array(); //foreach($database->get_all("SELECT name, value FROM config") as $pair) { // $cfs[] = $pair['name']."=".$pair['value']; diff --git a/contrib/et/theme.php b/contrib/et/theme.php index 4153d385..9c0541e0 100644 --- a/contrib/et/theme.php +++ b/contrib/et/theme.php @@ -12,7 +12,7 @@ class ETTheme extends Themelet { $page->add_block(new NavBlock()); $page->add_block(new Block("Information:", $this->build_data_form($info))); } - + protected function build_data_form($info) { $data = <<execute(" INSERT INTO event_log (owner_id, owner_ip, date, event, entry) VALUES (?, ?, now(), ?, ?)", diff --git a/contrib/event_log/theme.php b/contrib/event_log/theme.php index 8a28e277..a2ba1718 100644 --- a/contrib/event_log/theme.php +++ b/contrib/event_log/theme.php @@ -5,7 +5,7 @@ class EventLogTheme extends Themelet { $page->set_title("Event Log"); $page->set_heading("Event Log"); $page->add_block(new NavBlock()); - + $this->display_table($page, $events); $this->display_controls($page); } diff --git a/contrib/featured/main.php b/contrib/featured/main.php index 28e1e1ee..089afcbc 100644 --- a/contrib/featured/main.php +++ b/contrib/featured/main.php @@ -11,7 +11,7 @@ class Featured implements Extension { public function receive_event(Event $event) { if(is_null($this->theme)) $this->theme = get_theme_object($this); - + if($event instanceof InitExtEvent) { global $config; $config->set_default_int('featured_id', 0); diff --git a/contrib/handle_archive/main.php b/contrib/handle_archive/main.php index 26de4112..71499a5e 100644 --- a/contrib/handle_archive/main.php +++ b/contrib/handle_archive/main.php @@ -11,7 +11,7 @@ class ArchiveFileHandler implements Extension { global $config; $config->set_default_string('archive_extract_command', 'unzip -d "%d" "%f"'); } - + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Archive Handler Options"); $sb->add_text_option("archive_tmp_dir", "Temporary folder: "); @@ -60,13 +60,13 @@ class ArchiveFileHandler implements Extension { // copied from bulk add extension private function add_dir($base, $subdir="") { global $page; - + $list = ""; - + $dir = opendir("$base/$subdir"); while($filename = readdir($dir)) { $fullpath = "$base/$subdir/$filename"; - + if(is_link($fullpath)) { // ignore } diff --git a/contrib/handle_flash/main.php b/contrib/handle_flash/main.php index 5a0d3298..ec1fe485 100644 --- a/contrib/handle_flash/main.php +++ b/contrib/handle_flash/main.php @@ -61,7 +61,7 @@ class FlashFileHandler implements Extension { // } // $image->width = $rect[1]; // $image->height = $rect[3]; - + if(!($info = getimagesize($filename))) return null; $image->width = $info[0]; @@ -89,7 +89,7 @@ class FlashFileHandler implements Extension { } return $int; } - + private function swf_get_bounds($filename) { $fp = fopen($filename, "r"); $head = fread($fp, 3); diff --git a/contrib/handle_flash/theme.php b/contrib/handle_flash/theme.php index b867d8d6..8f679f84 100644 --- a/contrib/handle_flash/theme.php +++ b/contrib/handle_flash/theme.php @@ -5,7 +5,7 @@ class FlashFileHandlerTheme extends Themelet { $ilink = $image->get_image_link(); // FIXME: object and embed have "height" and "width" $html = " - hash; $ha = substr($hash, 0, 2); - + $event->page->set_type("image/x-icon"); $event->page->set_mode("data"); $event->page->set_data(file_get_contents("images/$ha/$hash")); @@ -49,7 +49,7 @@ class IcoFileHandler implements Extension { $exts = array("ico", "ani", "cur"); return array_contains($exts, strtolower($ext)); } - + private function create_image_from_data($filename, $metadata) { global $config; @@ -61,10 +61,10 @@ class IcoFileHandler implements Extension { $subheader = unpack("cwidth/cheight/ccolours/cnull/splanes/sbpp/lsize/loffset", fread($fp, 16)); fclose($fp); - + $image->width = $subheader['width']; $image->height = $subheader['height']; - + $image->filesize = $metadata['size']; $image->hash = $metadata['hash']; $image->filename = $metadata['filename']; diff --git a/contrib/handle_mp3/main.php b/contrib/handle_mp3/main.php index 397af4f2..a0e1fcb3 100644 --- a/contrib/handle_mp3/main.php +++ b/contrib/handle_mp3/main.php @@ -48,7 +48,7 @@ class MP3FileHandler implements Extension { // FIXME: need more flash format specs :| $image->width = 0; $image->height = 0; - + $image->filesize = $metadata['size']; $image->hash = $metadata['hash']; $image->filename = $metadata['filename']; diff --git a/contrib/handle_mp3/theme.php b/contrib/handle_mp3/theme.php index 524c38e0..c3baae92 100644 --- a/contrib/handle_mp3/theme.php +++ b/contrib/handle_mp3/theme.php @@ -5,7 +5,7 @@ class MP3FileHandlerTheme extends Themelet { $data_href = get_base_href(); $ilink = $image->get_image_link(); $html = " - diff --git a/contrib/handle_svg/main.php b/contrib/handle_svg/main.php index 81d8677a..4859f93b 100644 --- a/contrib/handle_svg/main.php +++ b/contrib/handle_svg/main.php @@ -46,7 +46,7 @@ class SVGFileHandler implements Extension { if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) { $this->theme->display_image($event->page, $event->image); } - + if(($event instanceof PageRequestEvent) && $event->page_matches("get_svg")) { global $config; global $database; @@ -54,7 +54,7 @@ class SVGFileHandler implements Extension { $image = Image::by_id($config, $database, $id); $hash = $image->hash; $ha = substr($hash, 0, 2); - + $event->page->set_type("image/svg+xml"); $event->page->set_mode("data"); $event->page->set_data(file_get_contents("images/$ha/$hash")); @@ -74,7 +74,7 @@ class SVGFileHandler implements Extension { $msp = new MiniSVGParser($filename); $image->width = $msp->width; $image->height = $msp->height; - + $image->filesize = $metadata['size']; $image->hash = $metadata['hash']; $image->filename = $metadata['filename']; @@ -87,7 +87,7 @@ class SVGFileHandler implements Extension { private function check_contents($file) { if(!file_exists($file)) return false; - + $msp = new MiniSVGParser($file); return $msp->valid; } diff --git a/contrib/home/main.php b/contrib/home/main.php index 6d6ca8bf..64c291e6 100644 --- a/contrib/home/main.php +++ b/contrib/home/main.php @@ -26,7 +26,7 @@ class Home implements Extension { $name = str_replace("ext/home/counters/", "", $counter_dirname); $counters[ucfirst($name)] = $name; } - + $sb = new SetupBlock("Home Page"); $sb->add_label("Page Links - Example: [$"."base/index|Posts]"); $sb->add_longtext_option("home_links", "
"); @@ -46,19 +46,19 @@ class Home implements Extension { $sitename = $config->get_string('title'); $contact_link = $config->get_string('contact_link'); $counter_dir = $config->get_string('home_counter', 'default'); - + $total = ceil($database->db->GetOne("SELECT COUNT(*) FROM images")); $strtotal = "$total"; - + $num_comma = number_format($total); - + $counter_text = ""; for($n=0; $nget_string('home_links'); $main_links = str_replace('$base', $base_href, $main_links); @@ -77,7 +77,7 @@ class Home implements Extension { $data_href = get_base_href(); $sitename = $config->get_string('title'); $theme_name = $config->get_string('theme'); - + $body = $this->get_body(); $this->theme->display_page($page, $sitename, $data_href, $theme_name, $body); diff --git a/contrib/home/theme.php b/contrib/home/theme.php index 55f21765..d6e43e38 100644 --- a/contrib/home/theme.php +++ b/contrib/home/theme.php @@ -43,7 +43,7 @@ EOD
contact – Serving $num_comma posts
- +
Powered by Shimmie
diff --git a/contrib/image_hash_ban/main.php b/contrib/image_hash_ban/main.php index c0f2658e..395db93d 100644 --- a/contrib/image_hash_ban/main.php +++ b/contrib/image_hash_ban/main.php @@ -9,7 +9,7 @@ * Version 0.1 * October 21, 2007 */ - + // RemoveImageHashBanEvent {{{ class RemoveImageHashBanEvent extends Event { var $hash; @@ -20,7 +20,7 @@ class RemoveImageHashBanEvent extends Event { } // }}} // AddImageHashBanEvent {{{ -class AddImageHashBanEvent extends Event { +class AddImageHashBanEvent extends Event { var $hash; var $reason; diff --git a/contrib/ipban/main.php b/contrib/ipban/main.php index abe05e10..2c804dc8 100644 --- a/contrib/ipban/main.php +++ b/contrib/ipban/main.php @@ -17,7 +17,7 @@ class RemoveIPBanEvent extends Event { } // }}} // AddIPBanEvent {{{ -class AddIPBanEvent extends Event { +class AddIPBanEvent extends Event { var $ip; var $reason; var $end; @@ -41,7 +41,7 @@ class IPBan implements Extension { if($config->get_int("ext_ipban_version") < 5) { $this->install(); } - + $this->check_ip_ban(); } @@ -95,7 +95,7 @@ class IPBan implements Extension { protected function install() { global $database; global $config; - + // shortcut to latest if($config->get_int("ext_ipban_version") < 1) { $database->execute(" diff --git a/contrib/ipban/test.php b/contrib/ipban/test.php index 31790ddb..4d4144b7 100644 --- a/contrib/ipban/test.php +++ b/contrib/ipban/test.php @@ -17,7 +17,7 @@ class IPBanTest extends WebTestCase { $this->setField('reason', 'unit testing'); $this->setField('end', '1 week'); $this->click("Ban"); - + $this->assertText("42.42.42.42"); $this->click("Remove"); // FIXME: remove which ban? :S $this->assertNoText("42.42.42.42"); diff --git a/contrib/link_image/main.php b/contrib/link_image/main.php index 29d76273..919539ef 100644 --- a/contrib/link_image/main.php +++ b/contrib/link_image/main.php @@ -6,14 +6,14 @@ */ class LinkImage implements Extension { var $theme; - + public function receive_event(Event $event) { if(is_null($this->theme)) $this->theme = get_theme_object($this); if(($event instanceof DisplayingImageEvent)) { global $config; $data_href = get_base_href(); $event->page->add_header("",0); - + $this->theme->links_block($event->page,$this->data($event->image)); } if($event instanceof SetupBuildingEvent) { @@ -30,10 +30,10 @@ class LinkImage implements Extension { } private function data($image) { global $config; - + $text_link = $image->parse_link_template($config->get_string("ext_link-img_text-link_format")); $text_link = $text_link==" "? null : $text_link; // null blank setting so the url gets filled in on the text links. - + return array( 'thumb_src' => $image->get_thumb_link(), 'image_src' => $image->get_image_link(), diff --git a/contrib/link_image/theme.php b/contrib/link_image/theme.php index 48e68cd2..52bee0e7 100644 --- a/contrib/link_image/theme.php +++ b/contrib/link_image/theme.php @@ -1,12 +1,12 @@ add_block( new Block( "Link to Image", "
". @@ -15,14 +15,14 @@ class LinkImageTheme extends Themelet { $this->link_code("Thumbnail Link",$this->url($post_link, $this->img($thumb_src,"ubb"),"ubb"),"ubb_thumb-link"). $this->link_code("Inline Image", $this->img($image_src,"ubb"), "ubb_full-img"). "
". - + "
". "HTML". $this->link_code("Text Link", $this->url($post_link, $text_link,"html"), "html_text-link"). $this->link_code("Thumbnail Link", $this->url($post_link,$this->img($thumb_src,"html"),"html"), "html_thumb-link"). $this->link_code("Inline Image", $this->img($image_src,"html"), "html_full-image"). "
". - + "
". "Plain Text". $this->link_code("Post URL",$post_link,"text_post-link"). @@ -32,10 +32,10 @@ class LinkImageTheme extends Themelet { "main", 50)); } - + protected function url ($url,$content,$type) { if ($content == NULL) {$content=$url;} - + switch ($type) { case "html": $text = "".$content.""; @@ -48,7 +48,7 @@ class LinkImageTheme extends Themelet { } return $text; } - + protected function img ($src,$type) { switch ($type) { case "html": @@ -62,7 +62,7 @@ class LinkImageTheme extends Themelet { } return $text; } - + protected function link_code($label,$content,$id=NULL) { return "\n". "\n
\n"; diff --git a/contrib/news/main.php b/contrib/news/main.php index 30d42960..b6262a8d 100644 --- a/contrib/news/main.php +++ b/contrib/news/main.php @@ -11,7 +11,7 @@ class News implements Extension { public function receive_event(Event $event) { if(is_null($this->theme)) $this->theme = get_theme_object($this); - + if($event instanceof PostListBuildingEvent) { if(strlen($event->context->config->get_string("news_text")) > 0) { $this->theme->display_news($event->page, $event->context->config->get_string("news_text")); diff --git a/contrib/numeric_score/main.php b/contrib/numeric_score/main.php index ea3baa15..36e51a9f 100644 --- a/contrib/numeric_score/main.php +++ b/contrib/numeric_score/main.php @@ -28,7 +28,7 @@ class NumericScore implements Extension { $this->install(); } } - + if($event instanceof DisplayingImageEvent) { global $user; if(!$user->is_anonymous()) { @@ -36,7 +36,7 @@ class NumericScore implements Extension { $event->page->add_block(new Block("Image Score", $html, "left", 20)); } } - + if(($event instanceof PageRequestEvent) && $event->page_matches("numeric_score_vote")) { if(!$event->user->is_anonymous()) { $image_id = int_escape($_POST['image_id']); @@ -49,7 +49,7 @@ class NumericScore implements Extension { $event->page->set_redirect(make_link("post/view/$image_id")); } } - + if($event instanceof ImageInfoSetEvent) { global $user; $char = $_POST['numeric_score']; @@ -58,7 +58,7 @@ class NumericScore implements Extension { else if($char == "d") $score = -1; if($score != 0) send_event(new NumericScoreSetEvent($event->image_id, $user, $score)); } - + if($event instanceof NumericScoreSetEvent) { $this->add_vote($event->image_id, $event->user->id, $event->score); } diff --git a/contrib/numeric_score/theme.php b/contrib/numeric_score/theme.php index 07d9645e..32567f6c 100644 --- a/contrib/numeric_score/theme.php +++ b/contrib/numeric_score/theme.php @@ -4,7 +4,7 @@ class NumericScoreTheme extends Themelet { public function get_voter_html($image) { $i_image_id = int_escape($image->id); $i_score = int_escape($image->numeric_score); - + $html = " Current Score: $i_score diff --git a/contrib/piclens/main.php b/contrib/piclens/main.php index 140d8708..c1a2ca32 100644 --- a/contrib/piclens/main.php +++ b/contrib/piclens/main.php @@ -12,9 +12,9 @@ class PicLens implements Extension { } if($event instanceof PostListBuildingEvent) { $foo=' - Start Slideshow - PicLensStart Slideshow + PicLens'; $event->page->add_block(new Block("PicLens", $foo, "left", 20)); } diff --git a/contrib/pm/main.php b/contrib/pm/main.php index 430319da..20426f73 100644 --- a/contrib/pm/main.php +++ b/contrib/pm/main.php @@ -114,7 +114,7 @@ class PM implements Extension { protected function install(RequestContext $context) { $database = $context->database; $config = $context->config; - + // shortcut to latest if($config->get_int("pm_version") < 1) { $database->execute(" diff --git a/contrib/random_image/main.php b/contrib/random_image/main.php index 514fcd8c..03f5682c 100644 --- a/contrib/random_image/main.php +++ b/contrib/random_image/main.php @@ -12,7 +12,7 @@ class RandomImage implements Extension { if(($event instanceof PageRequestEvent) && $event->page_matches("random_image")) { global $config; global $database; - + if($event->count_args() == 1) { $action = $event->get_arg(0); $search_terms = array(); diff --git a/contrib/rating/main.php b/contrib/rating/main.php index a5b1e161..f879b692 100644 --- a/contrib/rating/main.php +++ b/contrib/rating/main.php @@ -50,7 +50,7 @@ class Ratings implements Extension { send_event(new RatingSetEvent($event->image_id, $user, $_POST['rating'])); } } - + if($event instanceof SetupBuildingEvent) { $privs = array(); $privs['Safe Only'] = 's'; diff --git a/contrib/report_image/main.php b/contrib/report_image/main.php index 8956a0d3..064834a7 100755 --- a/contrib/report_image/main.php +++ b/contrib/report_image/main.php @@ -8,7 +8,7 @@ * Version 0.3a - See changelog in main.php * November 06, 2007 */ - + class RemoveReportedImageEvent extends Event { var $id; @@ -17,11 +17,11 @@ class RemoveReportedImageEvent extends Event { } } -class AddReportedImageEvent extends Event { +class AddReportedImageEvent extends Event { var $reporter_id; var $image_id; var $reason; - + public function AddReportedImageEvent($image_id, $reporter_id, $reason) { $this->reporter_id = $reporter_id; $this->image_id = $image_id; @@ -31,20 +31,20 @@ class AddReportedImageEvent extends Event { class ReportImage implements Extension { var $theme; - + public function receive_event(Event $event) { if(is_null($this->theme)) $this->theme = get_theme_object($this); - + if($event instanceof InitExtEvent) { global $config; - + $config->set_default_bool('report_image_show_thumbs', true); if($config->get_int("ext_report_image_version") < 1) { $this->install(); } } - + if(($event instanceof PageRequestEvent) && $event->page_matches("image_report")) { global $user; if($event->get_arg(0) == "add") { @@ -70,7 +70,7 @@ class ReportImage implements Extension { } } } - + if($event instanceof AddReportedImageEvent) { global $database; $database->Execute( @@ -83,7 +83,7 @@ class ReportImage implements Extension { global $database; $database->Execute("DELETE FROM image_reports WHERE id = ?", array($event->id)); } - + if($event instanceof DisplayingImageEvent) { global $user; global $config; @@ -98,7 +98,7 @@ class ReportImage implements Extension { $sb->add_bool_option("report_image_show_thumbs", "
Show thumbnails in admin panel: "); $event->panel->add_block($sb); } - + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("Reported Images", make_link("image_report/list")); @@ -110,7 +110,7 @@ class ReportImage implements Extension { $database->Execute("DELETE FROM image_reports WHERE image_id = ?", array($event->image->id)); } } - + protected function install() { global $database; global $config; @@ -132,7 +132,7 @@ class ReportImage implements Extension { FROM image_reports JOIN users ON reporter_id = users.id"); if(is_null($all_reports)) $all_reports = array(); - + $reports = array(); foreach($all_reports as $report) { global $database, $config; diff --git a/contrib/report_image/theme.php b/contrib/report_image/theme.php index bead2f66..8b77f97a 100755 --- a/contrib/report_image/theme.php +++ b/contrib/report_image/theme.php @@ -9,7 +9,7 @@ * Version 0.3a - See changelog in main.php * November 06, 2007 */ - + class ReportImageTheme extends Themelet { public function display_reported_images($page, $reports) { global $config; @@ -28,13 +28,13 @@ class ReportImageTheme extends Themelet { $reporter_name = html_escape($report['reporter_name']); $userlink = "$reporter_name"; - + global $user; $iabbe = new ImageAdminBlockBuildingEvent($image, $user); send_event($iabbe); ksort($iabbe->parts); $actions = join("
", $iabbe->parts); - + $h_reportedimages .= " {$image_link} @@ -50,7 +50,7 @@ class ReportImageTheme extends Themelet { "; } - + $thumb_width = $config->get_int("thumb_width"); $html = "