More type hints!
This commit is contained in:
		
							parent
							
								
									0b26eba141
								
							
						
					
					
						commit
						30eb5ddd8b
					
				| @ -137,7 +137,7 @@ class AdminPage extends Extension { | ||||
| 		$database->Execute("DELETE FROM tags WHERE count=0"); | ||||
| 	} | ||||
| 
 | ||||
| 	private function dbdump($page) { | ||||
| 	private function dbdump(Page $page) { | ||||
| 		$matches = array(); | ||||
| 		preg_match("#(\w+)://(\w+):(\w+)@([\w\.\-]+)/([\w_]+)(\?.*)?#", DATABASE_DSN, $matches); | ||||
| 		$software = $matches[1]; | ||||
| @ -146,6 +146,7 @@ class AdminPage extends Extension { | ||||
| 		$hostname = $matches[4]; | ||||
| 		$database = $matches[5]; | ||||
| 
 | ||||
| 		// TODO: Support more than just MySQL..
 | ||||
| 		switch($software) { | ||||
| 			case 'mysql': | ||||
| 				$cmd = "mysqldump -h$hostname -u$username -p$password $database"; | ||||
| @ -222,7 +223,7 @@ class AdminPage extends Extension { | ||||
| 		$database->execute("ALTER TABLE images AUTO_INCREMENT=".$count); | ||||
| 	} | ||||
| 
 | ||||
| 	private function imgdump($page) { | ||||
| 	private function imgdump(Page $page) { | ||||
| 		global $database; | ||||
| 		$zip = new ZipArchive; | ||||
| 		$images = $database->get_all("SELECT * FROM images"); | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| <?php | ||||
| class ArtistsTheme extends Themelet { | ||||
| 
 | ||||
| 	public function get_author_editor_html($author) { | ||||
| 	public function get_author_editor_html(/*string*/ $author) { | ||||
| 		$h_author = html_escape($author); | ||||
| 		return "<tr><td>Author</td><td><input class='editor_author' type='text' name='tag_edit__author' value='$h_author'></td></tr>"; | ||||
| 	} | ||||
| @ -16,7 +16,7 @@ class ArtistsTheme extends Themelet { | ||||
| 		//$this->display_paginator($page, "artist/list", null, $pageNumber, $totalPages);
 | ||||
| 	} | ||||
| 	 | ||||
| 	public function sidebar_options($mode, $artistID=NULL, $is_admin=FALSE){ | ||||
| 	public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){ | ||||
| 		global $page; | ||||
| 		 | ||||
| 		if($mode == "neutral"){ | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: Generic Blocks | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Add HTML to some space | ||||
|  * Documentation: | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /** | ||||
|  * Name: Bookmarks | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Allow users to bookmark searches | ||||
|  */ | ||||
| @ -59,7 +60,7 @@ class Bookmarks extends Extension { | ||||
| 		else {return array();} | ||||
| 	} | ||||
| 
 | ||||
| 	private function add_bookmark($url, $title) { | ||||
| 	private function add_bookmark(/*string*/ $url, /*string*/ $title) { | ||||
| 		global $database; | ||||
| 		$sql = "INSERT INTO bookmark(owner_id, url, title) VALUES (?, ?, ?)"; | ||||
| 		$database->Execute($sql, array($user->id, $url, $title)); | ||||
|  | ||||
| @ -53,7 +53,7 @@ class BulkAdd extends Extension { | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	private function add_dir($base, $subdir="") { | ||||
| 	private function add_dir(/*string*/ $base, $subdir="") { | ||||
| 		global $page; | ||||
| 
 | ||||
| 		if(!is_dir($base)) { | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: Downtime | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Show a "down for maintenance" page | ||||
|  * Documentation: | ||||
| @ -14,14 +15,14 @@ | ||||
| class Downtime extends Extension { | ||||
| 	public function get_priority() {return 10;} | ||||
| 
 | ||||
| 	public function onSetupBuilding($event) { | ||||
| 	public function onSetupBuilding(SetupBuildingEvent $event) { | ||||
| 		$sb = new SetupBlock("Downtime"); | ||||
| 		$sb->add_bool_option("downtime", "Disable non-admin access: "); | ||||
| 		$sb->add_longtext_option("downtime_message", "<br>"); | ||||
| 		$event->panel->add_block($sb); | ||||
| 	} | ||||
| 
 | ||||
| 	public function onPageRequest($event) { | ||||
| 	public function onPageRequest(PageRequestEvent $event) { | ||||
| 		global $config, $page, $user; | ||||
| 
 | ||||
| 		if($config->get_bool("downtime")) { | ||||
|  | ||||
| @ -12,7 +12,7 @@ class DowntimeTheme extends Themelet { | ||||
| 	/** | ||||
| 	 * Display $message and exit | ||||
| 	 */ | ||||
| 	public function display_message($message) { | ||||
| 	public function display_message(/*string*/ $message) { | ||||
| 		global $config, $user; | ||||
| 		$theme_name = $config->get_string('theme'); | ||||
| 		$data_href = get_base_href(); | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: Emoticon Filter | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Lets users use graphical smilies | ||||
|  * Documentation: | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| <?php | ||||
| class EmoticonListTheme extends Themelet { | ||||
| 	public function display_emotes($list) { | ||||
| 	public function display_emotes(/*array*/ $list) { | ||||
| 		global $page; | ||||
| 		$data_href = get_base_href(); | ||||
| 		$html = "<html><head><title>Emoticon list</title></head><body>"; | ||||
|  | ||||
| @ -167,7 +167,7 @@ class Favorites extends Extension { | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	private function add_vote($image_id, $user_id, $do_set) { | ||||
| 	private function add_vote(/*int*/ $image_id, /*int*/ $user_id, /*bool*/ $do_set) { | ||||
| 		global $database; | ||||
| 		if ($do_set) { | ||||
| 			$database->Execute( | ||||
|  | ||||
| @ -8,7 +8,7 @@ class FeaturedTheme extends Themelet { | ||||
| 		$page->add_block(new Block("Featured Image", $this->build_featured_html($image), "left", 3)); | ||||
| 	} | ||||
| 
 | ||||
| 	public function get_buttons_html($image_id) { | ||||
| 	public function get_buttons_html(/*int*/ $image_id) { | ||||
| 		global $user; | ||||
| 		return " | ||||
| 			".make_form(make_link("featured_image/set"))." | ||||
|  | ||||
| @ -173,7 +173,7 @@ class Forum extends Extension { | ||||
|             } | ||||
| 	} | ||||
| 
 | ||||
|         private function get_total_pages_for_thread($threadID) | ||||
|         private function get_total_pages_for_thread(/*int*/ $threadID) | ||||
|         { | ||||
|             global $database, $config; | ||||
|             $result = $database->get_row("SELECT COUNT(1) AS count FROM forum_posts WHERE thread_id = ?", array($threadID)); | ||||
|  | ||||
| @ -16,7 +16,7 @@ class FlashFileHandler extends DataHandlerExtension { | ||||
| 		return in_array(strtolower($ext), $exts); | ||||
| 	} | ||||
| 
 | ||||
| 	protected function create_image_from_data($filename, $metadata) { | ||||
| 	protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) { | ||||
| 		global $config; | ||||
| 
 | ||||
| 		$image = new Image(); | ||||
| @ -44,7 +44,7 @@ class FlashFileHandler extends DataHandlerExtension { | ||||
| 		return $image; | ||||
| 	} | ||||
| 
 | ||||
| 	protected function check_contents($file) { | ||||
| 	protected function check_contents(/*string*/ $file) { | ||||
| 		if(!file_exists($file)) return false; | ||||
| 
 | ||||
| 		$fp = fopen($file, "r"); | ||||
| @ -55,7 +55,7 @@ class FlashFileHandler extends DataHandlerExtension { | ||||
| 		return true; | ||||
| 	} | ||||
| 
 | ||||
| 	private function str_to_binarray($string) { | ||||
| 	private function str_to_binarray(/*string*/ $string) { | ||||
| 		$binary = array(); | ||||
| 		$length = strlen($string); | ||||
| 		for($j=0; $j<$length; $j++) { | ||||
| @ -76,7 +76,7 @@ class FlashFileHandler extends DataHandlerExtension { | ||||
| 		return $int; | ||||
| 	} | ||||
| 
 | ||||
| 	private function swf_get_bounds($filename) { | ||||
| 	private function swf_get_bounds(/*string*/ $filename) { | ||||
| 		$fp = fopen($filename, "r"); | ||||
| 		$head = fread($fp, 3); | ||||
| 		$version = fread($fp, 1); | ||||
|  | ||||
| @ -25,7 +25,7 @@ EOD | ||||
| ); | ||||
| 	} | ||||
| 
 | ||||
| 	public function build_body($sitename, $main_links, $main_text, $contact_link, $num_comma, $counter_text) { | ||||
| 	public function build_body(/*string*/ $sitename, /*string*/ $main_links, /*string*/ $main_text, /*string*/ $contact_link, $num_comma, /*string*/ $counter_text) { | ||||
| 		$main_links_html = empty($main_links) ? "" : "<div class='space' id='links'>$main_links</div>"; | ||||
| 		$message_html = empty($main_text)     ? "" : "<div class='space' id='message'>$main_text</div>"; | ||||
| 		$counter_html = empty($counter_text)  ? "" : "<div class='space' id='counter'>$counter_text</div>"; | ||||
|  | ||||
| @ -21,7 +21,7 @@ class LinkImage extends Extension { | ||||
| 		$config->set_default_string("ext_link-img_text-link_format", '$title - $id ($ext $size $filesize)'); | ||||
| 	} | ||||
| 
 | ||||
| 	private function hostify($str) { | ||||
| 	private function hostify(/*string*/ $str) { | ||||
| 		$str = str_replace(" ", "%20", $str); | ||||
| 		if(strpos($str, "ttp://") > 0) { | ||||
| 			return $str; | ||||
|  | ||||
| @ -51,7 +51,7 @@ class LinkImageTheme extends Themelet { | ||||
| 			50)); | ||||
| 	} | ||||
| 
 | ||||
| 	protected function url ($url,$content,$type) { | ||||
| 	protected function url (/*string*/ $url, /*string*/ $content, /*string*/ $type) { | ||||
| 		if ($content == NULL) {$content=$url;} | ||||
| 
 | ||||
| 		switch ($type) { | ||||
| @ -67,7 +67,7 @@ class LinkImageTheme extends Themelet { | ||||
| 		return $text; | ||||
| 	} | ||||
| 
 | ||||
| 	protected function img ($src,$type) { | ||||
| 	protected function img (/*string*/ $src, /*string*/ $type) { | ||||
| 		switch ($type) { | ||||
| 			case "html": | ||||
| 				$text = "<img src=\"$src\" />";
 | ||||
| @ -81,7 +81,7 @@ class LinkImageTheme extends Themelet { | ||||
| 		return $text; | ||||
| 	} | ||||
| 
 | ||||
| 	protected function link_code($label,$content,$id=NULL) { | ||||
| 	protected function link_code(/*string*/ $label, /*string*/ $content, $id=NULL) { | ||||
| 		return	" | ||||
| 			<tr> | ||||
| 				<td><label for='".$id."' title='Click to select the textbox'>$label</label></td> | ||||
|  | ||||
| @ -31,7 +31,7 @@ class MassTagger extends Extension { | ||||
| 		if($event->get_arg(0) == "tag") $this->_apply_mass_tags( $config, $page, $user, $event ); | ||||
| 	} | ||||
| 	 | ||||
| 	private function _apply_mass_tags( $config, $page, $user, $event ) { | ||||
| 	private function _apply_mass_tags( $config, Page $page, $user, $event ) { | ||||
| 		if( !isset($_POST['ids']) or !isset($_POST['tag']) ) return; | ||||
| 		 | ||||
| 		$tag = $_POST['tag']; | ||||
|  | ||||
| @ -167,7 +167,7 @@ class Ratings extends Extension { | ||||
| 		return $sqes; | ||||
| 	} | ||||
| 
 | ||||
| 	public static function privs_to_sql($sqes) { | ||||
| 	public static function privs_to_sql(/*string*/ $sqes) { | ||||
| 		$arr = array(); | ||||
| 		$length = strlen($sqes); | ||||
| 		for($i=0; $i<$length; $i++) { | ||||
| @ -177,7 +177,7 @@ class Ratings extends Extension { | ||||
| 		return $set; | ||||
| 	} | ||||
| 
 | ||||
| 	public static function rating_to_human($rating) { | ||||
| 	public static function rating_to_human(/*string*/ $rating) { | ||||
| 		switch($rating) { | ||||
| 			case "s": return "Safe"; | ||||
| 			case "q": return "Questionable"; | ||||
| @ -225,7 +225,7 @@ class Ratings extends Extension { | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	private function set_rating($image_id, $rating, $old_rating) { | ||||
| 	private function set_rating(/*int*/ $image_id, /*string*/ $rating, /*string*/ $old_rating) { | ||||
| 		global $database; | ||||
| 		if($old_rating != $rating){ | ||||
| 			$database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $image_id)); | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| <?php | ||||
| 
 | ||||
| class RatingsTheme extends Themelet { | ||||
| 	public function get_rater_html($image_id, $rating) { | ||||
| 	public function get_rater_html(/*int*/ $image_id, /*string*/ $rating) { | ||||
| 		$i_image_id = int_escape($image_id); | ||||
| 		$s_checked = $rating == 's' ? " checked" : ""; | ||||
| 		$q_checked = $rating == 'q' ? " checked" : ""; | ||||
| @ -50,7 +50,7 @@ class RatingsTheme extends Themelet { | ||||
| 		$page->add_block(new Block("Bulk Rating", $html)); | ||||
| 	} | ||||
| 
 | ||||
| 	public function rating_to_name($rating) { | ||||
| 	public function rating_to_name(/*string*/ $rating) { | ||||
| 		switch($rating) { | ||||
| 			case 's': return "Safe"; | ||||
| 			case 'q': return "Questionable"; | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: Resolution Limiter | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Allows the admin to set min / max image dimentions | ||||
|  */ | ||||
|  | ||||
| @ -143,16 +143,14 @@ class ResizeImage extends Extension { | ||||
| 	 | ||||
| 	 | ||||
| 	// Private functions
 | ||||
| 	/* ----------------------------- */ | ||||
| 	 | ||||
| 	/* | ||||
| 		This function could be made much smaller by using the ImageReplaceEvent | ||||
| 		ie: Pretend that we are replacing the image with a resized copy. | ||||
| 	*/ | ||||
| 	private function resize_image($image_id, $width, $height) { | ||||
| 		global $config; | ||||
| 		global $user; | ||||
| 		global $page; | ||||
| 		global $database; | ||||
| 	private function resize_image(/*int*/ $image_id, /*int*/ $width, /*int*/ $height) { | ||||
| 		global $config, $user, $page, $database; | ||||
| 		 | ||||
| 		if ( ($height <= 0) && ($width <= 0) ) { | ||||
| 			throw new ImageResizeException("Invalid options for height and width. ($width x $height)"); | ||||
|  | ||||
| @ -4,9 +4,8 @@ class ResizeImageTheme extends Themelet { | ||||
| 	/* | ||||
| 	 * Display a link to resize an image | ||||
| 	 */ | ||||
| 	public function get_resize_html($image_id) { | ||||
| 		global $user; | ||||
| 		global $config; | ||||
| 	public function get_resize_html(/*int*/ $image_id) { | ||||
| 		global $user, $config; | ||||
| 
 | ||||
| 		$i_image_id = int_escape($image_id); | ||||
| 		 | ||||
| @ -20,14 +19,14 @@ class ResizeImageTheme extends Themelet { | ||||
| 		return $html; | ||||
| 	} | ||||
| 	 | ||||
| 	public function display_resize_error(Page $page, $title, $message) { | ||||
| 	public function display_resize_error(Page $page, /*string*/ $title, /*string*/ $message) { | ||||
| 		$page->set_title("Resize Image"); | ||||
| 		$page->set_heading("Resize Image"); | ||||
| 		$page->add_block(new NavBlock()); | ||||
| 		$page->add_block(new Block($title, $message)); | ||||
| 	} | ||||
| 	 | ||||
| 	public function display_resize_page(Page $page, $image_id) { | ||||
| 	public function display_resize_page(Page $page, /*int*/ $image_id) { | ||||
| 		global $config; | ||||
| 		 | ||||
| 		$default_width = $config->get_int('resize_default_width'); | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: RSS for Comments | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Self explanatory | ||||
|  */ | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: RSS for Images | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Self explanatory | ||||
|  */ | ||||
| @ -33,7 +34,7 @@ class RSS_Images extends Extension { | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	private function do_rss($images, $search_terms, $page_number) { | ||||
| 	private function do_rss($images, $search_terms, /*int*/ $page_number) { | ||||
| 		global $page; | ||||
| 		global $config; | ||||
| 		$page->set_mode("data"); | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: SimpleTest integration | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: adds unit testing to SCore | ||||
|  */ | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: Tweet! | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Show a twitter feed with the Sea of Clouds script | ||||
|  */ | ||||
|  | ||||
| @ -4,7 +4,7 @@ class TwitterSocTheme extends Themelet { | ||||
| 	/* | ||||
| 	 * Show $text on the $page | ||||
| 	 */ | ||||
| 	public function display_feed(Page $page, $username) { | ||||
| 	public function display_feed(Page $page, /*string*/ $username) { | ||||
| 		$page->add_block(new Block("Tweets", ' | ||||
| 			<div class="tweet_soc"></div> | ||||
| 			<p><a href="http://twitter.com/'.url_escape($username).'">Follow us on Twitter</a> | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /* | ||||
|  * Name: Word Filter | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * License: GPLv2 | ||||
|  * Description: Simple search and replace | ||||
|  */ | ||||
| @ -22,7 +23,7 @@ class WordFilter extends Extension { | ||||
| 		$event->panel->add_block($sb); | ||||
| 	} | ||||
| 
 | ||||
| 	private function filter($text) { | ||||
| 	private function filter(/*string*/ $text) { | ||||
| 		$map = $this->get_map(); | ||||
| 		foreach($map as $search => $replace) { | ||||
| 			$search = trim($search); | ||||
|  | ||||
| @ -648,16 +648,16 @@ define("SCORE_LOG_NOTSET", 0); | ||||
| /** | ||||
|  * A shorthand way to send a LogEvent | ||||
|  */ | ||||
| function log_msg($section, $priority, $message) { | ||||
| function log_msg(/*string*/ $section, /*int*/ $priority, /*string*/ $message) { | ||||
| 	send_event(new LogEvent($section, $priority, $message)); | ||||
| } | ||||
| 
 | ||||
| // More shorthand ways of logging
 | ||||
| function log_debug($section, $message) {log_msg($section, SCORE_LOG_DEBUG, $message);} | ||||
| function log_info($section, $message)  {log_msg($section, SCORE_LOG_INFO, $message);} | ||||
| function log_warning($section, $message) {log_msg($section, SCORE_LOG_WARNING, $message);} | ||||
| function log_error($section, $message) {log_msg($section, SCORE_LOG_ERROR, $message);} | ||||
| function log_critical($section, $message) {log_msg($section, SCORE_LOG_CRITICAL, $message);} | ||||
| function log_debug(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_DEBUG, $message);} | ||||
| function log_info(/*string*/ $section, /*string*/ $message)  {log_msg($section, SCORE_LOG_INFO, $message);} | ||||
| function log_warning(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_WARNING, $message);} | ||||
| function log_error(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_ERROR, $message);} | ||||
| function log_critical(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_CRITICAL, $message);} | ||||
| 
 | ||||
| 
 | ||||
| /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| <?php | ||||
| 
 | ||||
| class ExtManagerTheme extends Themelet { | ||||
| 	public function display_table(Page $page, $extensions, $editable) { | ||||
| 	public function display_table(Page $page, /*array*/ $extensions, /*bool*/ $editable) { | ||||
| 		global $user; | ||||
| 		$en = $editable ? "<th>Enabled</th>" : ""; | ||||
| 		$html = " | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| /** | ||||
|  * Name: Handle Pixel | ||||
|  * Author: Shish <webmaster@shishnet.org> | ||||
|  * Link: http://code.shishnet.org/shimmie2/ | ||||
|  * Description: Handle JPEG, PNG, GIF, etc files | ||||
|  */ | ||||
| 
 | ||||
| @ -17,7 +18,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 		return in_array(strtolower($ext), $exts); | ||||
| 	} | ||||
| 
 | ||||
| 	protected function create_image_from_data($filename, $metadata) { | ||||
| 	protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) { | ||||
| 		global $config; | ||||
| 
 | ||||
| 		$image = new Image(); | ||||
| @ -38,7 +39,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 		return $image; | ||||
| 	} | ||||
| 
 | ||||
| 	protected function check_contents($file) { | ||||
| 	protected function check_contents(/*string*/ $file) { | ||||
| 		$valid = Array(IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG); | ||||
| 		if(!file_exists($file)) return false; | ||||
| 		$info = getimagesize($file); | ||||
| @ -47,7 +48,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 		return false; | ||||
| 	} | ||||
| 
 | ||||
| 	protected function create_thumb($hash) { | ||||
| 	protected function create_thumb(/*string*/ $hash) { | ||||
| 		$outname = warehouse_path("thumbs", $hash); | ||||
| 		if(file_exists($outname)) { | ||||
| 			return true; | ||||
| @ -55,7 +56,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 		return $this->create_thumb_force($hash); | ||||
| 	} | ||||
| 
 | ||||
| 	protected function create_thumb_force($hash) { | ||||
| 	protected function create_thumb_force(/*string*/ $hash) { | ||||
| 		$inname  = warehouse_path("images", $hash); | ||||
| 		$outname = warehouse_path("thumbs", $hash); | ||||
| 		global $config; | ||||
| @ -76,7 +77,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 	} | ||||
| 
 | ||||
| // IM thumber {{{
 | ||||
| 	private function make_thumb_convert($inname, $outname) { | ||||
| 	private function make_thumb_convert(/*string*/ $inname, /*string*/ $outname) { | ||||
| 		global $config; | ||||
| 
 | ||||
| 		$w = $config->get_int("thumb_width"); | ||||
| @ -113,7 +114,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 	} | ||||
| // }}}
 | ||||
| // epeg thumber {{{
 | ||||
| 	private function make_thumb_epeg($inname, $outname) { | ||||
| 	private function make_thumb_epeg(/*string*/ $inname, /*string*/ $outname) { | ||||
| 		global $config; | ||||
| 		$w = $config->get_int("thumb_width"); | ||||
| 		exec("epeg $inname -c 'Created by EPEG' --max $w $outname"); | ||||
| @ -121,7 +122,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 	} | ||||
| 	// }}}
 | ||||
| // GD thumber {{{
 | ||||
| 	private function make_thumb_gd($inname, $outname) { | ||||
| 	private function make_thumb_gd(/*string*/ $inname, /*string*/ $outname) { | ||||
| 		global $config; | ||||
| 		$thumb = $this->get_thumb($inname); | ||||
| 		$ok = imagejpeg($thumb, $outname, $config->get_int('thumb_quality')); | ||||
| @ -129,7 +130,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 		return $ok; | ||||
| 	} | ||||
| 
 | ||||
| 	private function get_thumb($tmpname) { | ||||
| 	private function get_thumb(/*string*/ $tmpname) { | ||||
| 		global $config; | ||||
| 
 | ||||
| 		$info = getimagesize($tmpname); | ||||
| @ -165,7 +166,7 @@ class PixelFileHandler extends DataHandlerExtension { | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	private function read_file($fname) { | ||||
| 	private function read_file(/*string*/ $fname) { | ||||
| 		$fp = fopen($fname, "r"); | ||||
| 		if(!$fp) return false; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user