All pastes #462074 Raw Edit

Someone

public php v1 · immutable
#462074 ·published 2007-04-28 01:16 UTC
rendered paste body
<?phpif(preg_match('/^:[[:alnum:]\[\]\-`|}{_]+![^\s]+@[[:alnum:]\.-]+[ ]+PRIVMSG (\#[^\s,]+|'.$irc->Nick.') :?!bashquote( [[:alpha:]]+)* *$/i',$irc->LastLine,$temp)) {	if($temp[1]{0}!='#') $temp[1] = $irc->LastNick();	if($bashcon=fsockopen("www.bash.org",80)) {		$action = preg_replace('/^ /','',$temp[2]);		fwrite($bashcon,"GET /?random1 HTTP/1.1\r\nHost: www.bash.org\r\n\r\n");		switch($action) {			case "whole":				$irc->PrivMsg($irc->LastNick(),"One moment, retrieving quote");				$inside_qt = FALSE;				while($bashline=fgets($bashcon)) {					$bashline = preg_replace('/[\r\n]/','',$bashline);					if(preg_match('/^<p class="quote"><a href="\?([0-9]+)" title="Permanent link to this quote.">.+<\/p><p class="qt">(.+)(<\/p>|<br \/>)$/',$bashline,$bashout) && $inside_qt===FALSE) {						$quoteline = $bashout[2];						$quoteline = preg_replace('/&lt;/','<',$quoteline);						$quoteline = preg_replace('/&gt;/','>',$quoteline);						$quoteline = preg_replace('/&quot/','"',$quoteline);						$quoteline = preg_replace('/&nbsp;/','  ',$quoteline);						$irc->PrivMsg($irc->LastNick(),"http://bash.org?{$bashout[1]}");						$irc->PrivMsg($irc->LastNick(),$quoteline);						if($bashout[3]=='</p>') break;						$inside_qt = TRUE;					}					if(preg_match('/^([^<>]+)<br \/>$/',$bashline,$bashout) && $inside_qt===TRUE) {						$quoteline = $bashout[1];						$quoteline = preg_replace('/&lt;/','<',$quoteline);						$quoteline = preg_replace('/&gt;/','>',$quoteline);						$quoteline = preg_replace('/&quot/','"',$quoteline);						$quoteline = preg_replace('/&nbsp;/','  ',$quoteline);						$irc->PrivMsg($irc->LastNick(),$quoteline);					}					if(preg_match('/^([^<>]+)<\/p>$/',$bashline,$bashout) && $inside_qt===TRUE) {						$quoteline = $bashout[1];						$quoteline = preg_replace('/&lt;/','<',$quoteline);						$quoteline = preg_replace('/&gt;/','>',$quoteline);						$quoteline = preg_replace('/&quot/','"',$quoteline);						$quoteline = preg_replace('/&nbsp;/','  ',$quoteline);						$irc->PrivMsg($irc->LastNick(),$quoteline);						$inside_qt = FALSE;						break;					}				}				break;			default:				$irc->PrivMsg($temp[1],"One moment, retrieving quote");				while($bashline=fgets($bashcon)) {					if(preg_match('/^<p class="quote"><a href="\?([0-9]+)" title="Permanent link to this quote.">/',$bashline,$bashout)) {						$irc->PrivMsg($temp[1],"http://bash.org?{$bashout[1]}");						break;					}				}				break;		}		fclose($bashcon);	} else {		$irc->PrivMsg($temp[1],"Sorry, I was unable to connect to bash.org");	}	$irc->KnownNicks[$irc->LastNick()]->LastCommandTime = time();}?>