Merge pull request #386 from shish/linting
A few fixes for things scrutinizer-ci found
This commit is contained in:
		
						commit
						61764e7f9d
					
				| @ -73,7 +73,6 @@ class Image { | ||||
| 	public static function by_id(/*int*/ $id) { | ||||
| 		assert(is_numeric($id)); | ||||
| 		global $database; | ||||
| 		$image = null; | ||||
| 		$row = $database->get_row("SELECT * FROM images WHERE images.id=:id", array("id"=>$id)); | ||||
| 		return ($row ? new Image($row) : null); | ||||
| 	} | ||||
| @ -86,7 +85,6 @@ class Image { | ||||
| 	public static function by_hash(/*string*/ $hash) { | ||||
| 		assert(is_string($hash)); | ||||
| 		global $database; | ||||
| 		$image = null; | ||||
| 		$row = $database->get_row("SELECT images.* FROM images WHERE hash=:hash", array("hash"=>$hash)); | ||||
| 		return ($row ? new Image($row) : null); | ||||
| 	} | ||||
| @ -913,7 +911,6 @@ class Image { | ||||
| 		// more than one positive tag, or more than zero negative tags
 | ||||
| 		else { | ||||
| 			$s_tag_array = array_map("sql_escape", $tag_search->variables); | ||||
| 			$s_tag_list = join(', ', $s_tag_array); | ||||
| 
 | ||||
| 			$tag_id_array = array(); | ||||
| 			$tags_ok = true; | ||||
| @ -1058,7 +1055,7 @@ class Tag { | ||||
| 		else { | ||||
| 			global $database; | ||||
| 			$db_wild_tag = str_replace("%", "\%", $tag); | ||||
| 			$db_wild_tag = str_replace("*", "%", $tag); | ||||
| 			$db_wild_tag = str_replace("*", "%", $db_wild_tag); | ||||
| 			$newtags = $database->get_col($database->scoreql_to_sql("SELECT tag FROM tags WHERE SCORE_STRNORM(tag) LIKE SCORE_STRNORM(?)"), array($db_wild_tag)); | ||||
| 			if(count($newtags) > 0) { | ||||
| 				$resolved = $newtags; | ||||
|  | ||||
| @ -182,14 +182,18 @@ class AdminPage extends Extension { | ||||
| 			case 'sqlite': | ||||
| 				$cmd = "sqlite3 $database .dump"; | ||||
| 				break; | ||||
| 			default: | ||||
| 				$cmd = false; | ||||
| 		} | ||||
| 
 | ||||
| 		//FIXME: .SQL dump is empty if cmd doesn't exist
 | ||||
| 
 | ||||
| 		$page->set_mode("data"); | ||||
| 		$page->set_type("application/x-unknown"); | ||||
| 		$page->set_filename('shimmie-'.date('Ymd').'.sql'); | ||||
| 		$page->set_data(shell_exec($cmd)); | ||||
| 		if($cmd) { | ||||
| 			$page->set_mode("data"); | ||||
| 			$page->set_type("application/x-unknown"); | ||||
| 			$page->set_filename('shimmie-'.date('Ymd').'.sql'); | ||||
| 			$page->set_data(shell_exec($cmd)); | ||||
| 		} | ||||
| 
 | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| @ -29,7 +29,6 @@ class AliasEditorTheme extends Themelet { | ||||
| 		} | ||||
| 
 | ||||
| 		$h_aliases = ""; | ||||
| 		$n = 0; | ||||
| 		foreach($aliases as $old => $new) { | ||||
| 			$h_old = html_escape($old); | ||||
| 			$h_new = "<a href='".make_link("post/list/".url_escape($new)."/1")."'>".html_escape($new)."</a>"; | ||||
|  | ||||
| @ -175,7 +175,6 @@ class ArtistsTheme extends Themelet { | ||||
|              | ||||
|             $html .= "</tr></thead>"; | ||||
| 
 | ||||
|             $n = 0; | ||||
|             $deletionLinkActionArray = | ||||
|                 array('artist' => 'artist/nuke/' | ||||
|                     , 'alias' => 'artist/alias/delete/' | ||||
| @ -340,8 +339,6 @@ class ArtistsTheme extends Themelet { | ||||
| 
 | ||||
|             $artist_link = "<a href='".make_link("post/list/".$artist['name']."/1")."'>".str_replace("_", " ", $artist['name'])."</a>"; | ||||
| 
 | ||||
|             $n = 0; | ||||
| 
 | ||||
|             $html = "<table id='poolsList' class='zebra'>
 | ||||
|                     <thead> | ||||
|                         <tr> | ||||
|  | ||||
| @ -31,7 +31,6 @@ class BlotterTheme extends Themelet { | ||||
| 		 * Long function name, but at least I won't confuse it with something else ^_^ | ||||
| 		 */ | ||||
| 
 | ||||
| 		$html = ""; | ||||
| 		// Add_new stuff goes here.
 | ||||
| 		$table_header =  " | ||||
| 			<tr> | ||||
|  | ||||
| @ -14,7 +14,7 @@ require_once "lib/akismet.class.php"; | ||||
| class CommentPostingEvent extends Event { | ||||
| 	var $image_id, $user, $comment; | ||||
| 
 | ||||
| 	public function CommentPostingEvent($image_id, $user, $comment) { | ||||
| 	public function __construct($image_id, $user, $comment) { | ||||
| 		$this->image_id = $image_id; | ||||
| 		$this->user = $user; | ||||
| 		$this->comment = $comment; | ||||
| @ -29,7 +29,7 @@ class CommentPostingEvent extends Event { | ||||
| class CommentDeletionEvent extends Event { | ||||
| 	var $comment_id; | ||||
| 
 | ||||
| 	public function CommentDeletionEvent($comment_id) { | ||||
| 	public function __construct($comment_id) { | ||||
| 		$this->comment_id = $comment_id; | ||||
| 	} | ||||
| } | ||||
| @ -37,7 +37,11 @@ class CommentDeletionEvent extends Event { | ||||
| class CommentPostingException extends SCoreException {} | ||||
| 
 | ||||
| class Comment { | ||||
| 	public function Comment($row) { | ||||
| 	var $owner, $owner_id, $owner_name, $owner_email, $owner_class; | ||||
| 	var $comment, $comment_id; | ||||
| 	var $image_id, $poster_ip, $posted; | ||||
| 
 | ||||
| 	public function __construct($row) { | ||||
| 		$this->owner = null; | ||||
| 		$this->owner_id = $row['user_id']; | ||||
| 		$this->owner_name = $row['user_name']; | ||||
|  | ||||
| @ -17,7 +17,6 @@ class ExtManagerTheme extends Themelet { | ||||
| 					</thead> | ||||
| 					<tbody> | ||||
| 		";
 | ||||
| 		$n = 0; | ||||
| 		foreach($extensions as $extension) { | ||||
| 			if(!$editable && $extension->visibility == "admin") continue; | ||||
| 
 | ||||
| @ -53,7 +52,6 @@ class ExtManagerTheme extends Themelet { | ||||
| 	/* | ||||
| 	public function display_blocks(Page $page, $extensions) { | ||||
| 		global $user; | ||||
| 		$n = 0; | ||||
| 		$col_1 = ""; | ||||
| 		$col_2 = ""; | ||||
| 		foreach($extensions as $extension) { | ||||
|  | ||||
| @ -83,9 +83,7 @@ class ForumTheme extends Themelet { | ||||
| 		global $config, $page/*, $user*/; | ||||
| 		 | ||||
| 		$posts_per_page = $config->get_int('forumPostsPerPage'); | ||||
| 		$theme_name = $config->get_string('theme'); | ||||
| 		 | ||||
|         $html = ""; | ||||
|         $current_post = 0; | ||||
| 
 | ||||
|         $html = | ||||
|  | ||||
| @ -11,12 +11,16 @@ | ||||
|  */ | ||||
| 
 | ||||
| class SendPMEvent extends Event { | ||||
| 	var $pm; | ||||
| 
 | ||||
| 	public function __construct(PM $pm) { | ||||
| 		$this->pm = $pm; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| class PM { | ||||
| 	var $id, $from_id, $from_ip, $to_id, $sent_date, $subject, $message, $is_read; | ||||
| 
 | ||||
| 	public function __construct($from_id=0, $from_ip="0.0.0.0", $to_id=0, $subject="A Message", $message="Some Text", $read=False) { | ||||
| 		# PHP: the P stands for "really", the H stands for "awful" and the other P stands for "language"
 | ||||
| 		if(is_array($from_id)) { | ||||
|  | ||||
| @ -14,7 +14,7 @@ | ||||
| class ConfigSaveEvent extends Event { | ||||
| 	var $config; | ||||
| 
 | ||||
| 	public function ConfigSaveEvent(Config $config) { | ||||
| 	public function __construct(Config $config) { | ||||
| 		$this->config = $config; | ||||
| 	} | ||||
| } | ||||
| @ -26,7 +26,7 @@ class ConfigSaveEvent extends Event { | ||||
| class SetupBuildingEvent extends Event { | ||||
| 	var $panel; | ||||
| 
 | ||||
| 	public function SetupBuildingEvent(SetupPanel $panel) { | ||||
| 	public function __construct(SetupPanel $panel) { | ||||
| 		$this->panel = $panel; | ||||
| 	} | ||||
| } | ||||
| @ -49,10 +49,11 @@ class SetupBlock extends Block { | ||||
| 	var $header; | ||||
| 	var $body; | ||||
| 
 | ||||
| 	public function SetupBlock($title) { | ||||
| 	public function __construct($title) { | ||||
| 		$this->header = $title; | ||||
| 		$this->section = "main"; | ||||
| 		$this->position = 50; | ||||
| 		$this->body = ""; | ||||
| 	} | ||||
| 
 | ||||
| 	public function add_label($text) { | ||||
|  | ||||
| @ -12,7 +12,7 @@ class WikiUpdateEvent extends Event { | ||||
| 	var $user; | ||||
| 	var $wikipage; | ||||
| 
 | ||||
| 	public function WikiUpdateEvent(User $user, WikiPage $wikipage) { | ||||
| 	public function __construct(User $user, WikiPage $wikipage) { | ||||
| 		$this->user = $user; | ||||
| 		$this->wikipage = $wikipage; | ||||
| 	} | ||||
| @ -31,7 +31,7 @@ class WikiPage { | ||||
| 	var $locked; | ||||
| 	var $body; | ||||
| 
 | ||||
| 	public function WikiPage($row) { | ||||
| 	public function __construct($row) { | ||||
| 		assert(!empty($row)); | ||||
| 
 | ||||
| 		$this->id = $row['id']; | ||||
| @ -157,7 +157,7 @@ class Wiki extends Extension { | ||||
| 		global $database; | ||||
| 		$wpage = $event->wikipage; | ||||
| 		try { | ||||
| 			$row = $database->Execute(" | ||||
| 			$database->Execute(" | ||||
| 				INSERT INTO wiki_pages(owner_id, owner_ip, date, title, revision, locked, body) | ||||
| 				VALUES (?, ?, now(), ?, ?, ?, ?)", array($event->user->id, $_SERVER['REMOTE_ADDR'],
 | ||||
| 				$wpage->title, $wpage->rev, $wpage->locked?'Y':'N', $wpage->body)); | ||||
|  | ||||
| @ -75,7 +75,6 @@ class Layout { | ||||
| 		} | ||||
| 
 | ||||
| 		$custom_sublinks = "<div class='sbar'>"; | ||||
| 		$cs = null; | ||||
| 		// hack
 | ||||
| 		global $user; | ||||
| 		$username = url_escape($user->name); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user