diff --git a/classes/class_irc.php b/classes/class_irc.php index 2decd32e..40f6e6d8 100644 --- a/classes/class_irc.php +++ b/classes/class_irc.php @@ -2,6 +2,7 @@ class IRC_DB extends DB_MYSQL { function halt($Msg) { global $Bot; + global $DB; $Bot->send_to($Bot->get_channel(),'The database is currently unavailable try again later'); } } @@ -177,6 +178,25 @@ protected function listen() { if(isset($this->Identified[$Nick[1]])) { unset($this->Identified[$Nick[1]]); } + if (isset($this->DisabledUsers[$Nick[1]])) { + $DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[1] . "'"); + unset($this->DisabledUsers[$Nick[1]]); + } + } + + if (preg_match("/:([^!]+)![^\s]* PART #what.cd-disabled/", $this->Data, $Nick)) { + if (isset($this->DisabledUsers[$Nick[1]])) { + $DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[1] . "'"); + unset($this->DisabledUsers[$Nick[1]]); + } + } + + if (preg_match("/:([^!]+)![^\s]* KICK #what.cd-disabled.* /", $this->Data, $Nick)) { + if (isset($this->DisabledUsers[$Nick[1]])) { + $Nick = explode(" ", $Nick[0]); + $DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[3] . "'"); + unset($this->DisabledUsers[$Nick[1]]); + } } if(preg_match("/End of message of the day./", $this->Data)) { diff --git a/classes/class_text.php b/classes/class_text.php index d77938f9..d4a1586a 100644 --- a/classes/class_text.php +++ b/classes/class_text.php @@ -92,7 +92,7 @@ class TEXT { */ public function __construct ($TOC = false) { $this->TOC = (bool) $TOC; - foreach($this->Smileys as $Key=>$Val) { + foreach ($this->Smileys as $Key=>$Val) { $this->Smileys[$Key] = ''; } reset($this->Smileys); @@ -166,7 +166,7 @@ private function valid_url ($Str, $Extension = '', $Inline = false) { $Regex .= '(:[0-9]{1,5})?'; // port $Regex .= '\/?'; // slash? $Regex .= '(\/?[0-9a-z\-_.,&=@~%\/:;()+|!#]+)*'; // /file - if(!empty($Extension)) { + if (!empty($Extension)) { $Regex.=$Extension; } @@ -185,16 +185,16 @@ private function valid_url ($Str, $Extension = '', $Inline = false) { public function local_url ($Str) { $URLInfo = parse_url($Str); - if(!$URLInfo) { return false; } + if (!$URLInfo) { return false; } $Host = $URLInfo['host']; // If for some reason your site does not require subdomains or contains a directory in the SITE_URL, revert to the line below. - //if($Host == NONSSL_SITE_URL || $Host == SSL_SITE_URL || $Host == 'www.'.NONSSL_SITE_URL) { - if(empty($URLInfo['port']) && preg_match('/(\S+\.)*'.NONSSL_SITE_URL.'/', $Host)) { + //if ($Host == NONSSL_SITE_URL || $Host == SSL_SITE_URL || $Host == 'www.'.NONSSL_SITE_URL) { + if (empty($URLInfo['port']) && preg_match('/(\S+\.)*'.NONSSL_SITE_URL.'/', $Host)) { $URL = $URLInfo['path']; - if(!empty($URLInfo['query'])) { + if (!empty($URLInfo['query'])) { $URL.='?'.$URLInfo['query']; } - if(!empty($URLInfo['fragment'])) { + if (!empty($URLInfo['fragment'])) { $URL.='#'.$URLInfo['fragment']; } return $URL; @@ -249,7 +249,7 @@ private function parse ($Str) { $Array = array(); $ArrayPos = 0; - while($i<$Len) { + while ($i < $Len) { $Block = ''; // 1) Find the next tag (regex) @@ -257,7 +257,7 @@ private function parse ($Str) { $IsTag = preg_match("/((\[[a-zA-Z*#]+)(=(?:[^\n'\"\[\]]|\[\d*\])+)?\])|(\[\[[^\n\"'\[\]]+\]\])/", $Str, $Tag, PREG_OFFSET_CAPTURE, $i); // 1a) If there aren't any tags left, write everything remaining to a block - if(!$IsTag) { + if (!$IsTag) { // No more tags $Array[$ArrayPos] = substr($Str, $i); break; @@ -265,14 +265,14 @@ private function parse ($Str) { // 1b) If the next tag isn't where the pointer is, write everything up to there to a text block. $TagPos = $Tag[0][1]; - if($TagPos>$i) { - $Array[$ArrayPos] = substr($Str, $i, $TagPos-$i); + if ($TagPos > $i) { + $Array[$ArrayPos] = substr($Str, $i, $TagPos - $i); ++$ArrayPos; - $i=$TagPos; + $i = $TagPos; } // 2) See if it's a [[wiki-link]] or an ordinary tag, and get the tag name - if(!empty($Tag[4][0])) { // Wiki-link + if (!empty($Tag[4][0])) { // Wiki-link $WikiLink = true; $TagName = substr($Tag[4][0], 2, -2); $Attrib = ''; @@ -281,9 +281,9 @@ private function parse ($Str) { $TagName = strtolower(substr($Tag[2][0], 1)); //3a) check it against the $this->ValidTags array to see if it's actually a tag and not [bullshit] - if(!isset($this->ValidTags[$TagName])) { - $Array[$ArrayPos] = substr($Str, $i, ($TagPos-$i)+strlen($Tag[0][0])); - $i=$TagPos+strlen($Tag[0][0]); + if (!isset($this->ValidTags[$TagName])) { + $Array[$ArrayPos] = substr($Str, $i, ($TagPos - $i)+strlen($Tag[0][0])); + $i = $TagPos + strlen($Tag[0][0]); ++$ArrayPos; continue; } @@ -291,7 +291,7 @@ private function parse ($Str) { $MaxAttribs = $this->ValidTags[$TagName]; // 3b) Get the attribute, if it exists [name=attribute] - if(!empty($Tag[3][0])) { + if (!empty($Tag[3][0])) { $Attrib = substr($Tag[3][0], 1); } else { $Attrib=''; @@ -309,21 +309,21 @@ private function parse ($Str) { //5a) Different for different types of tag. Some tags don't close, others are weird like [*] - if($TagName == 'img' && !empty($Tag[3][0])) { //[img=...] + if ($TagName == 'img' && !empty($Tag[3][0])) { //[img=...] $Block = ''; // Nothing inside this tag // Don't need to touch $i - } elseif($TagName == 'inlineurl') { // We did a big replace early on to turn http:// into [inlineurl]http:// + } elseif ($TagName == 'inlineurl') { // We did a big replace early on to turn http:// into [inlineurl]http:// // Let's say the block can stop at a newline or a space $CloseTag = strcspn($Str, " \n\r", $i); - if($CloseTag === false) { // block finishes with URL + if ($CloseTag === false) { // block finishes with URL $CloseTag = $Len; } - if(preg_match('/[!,.?:]+$/',substr($Str, $i, $CloseTag), $Match)) { + if (preg_match('/[!,.?:]+$/',substr($Str, $i, $CloseTag), $Match)) { $CloseTag -= strlen($Match[0]); } $URL = substr($Str, $i, $CloseTag); - if(substr($URL, -1) == ')' && substr_count($URL, '(') < substr_count($URL, ')')) { + if (substr($URL, -1) == ')' && substr_count($URL, '(') < substr_count($URL, ')')) { $CloseTag--; $URL = substr($URL, 0, -1); } @@ -332,17 +332,17 @@ private function parse ($Str) { // strcspn returns the number of characters after the offset $i, not after the beginning of the string // Therefore, we use += instead of the = everywhere else $i += $CloseTag; // 5d) Move the pointer past the end of the [/close] tag. - } elseif($WikiLink == true || $TagName == 'n') { + } elseif ($WikiLink == true || $TagName == 'n') { // Don't need to do anything - empty tag with no closing - } elseif($TagName === '*' || $TagName === '#') { + } elseif ($TagName === '*' || $TagName === '#') { // We're in a list. Find where it ends $NewLine = $i; do { // Look for \n[*] $NewLine = strpos($Str, "\n", $NewLine+1); - } while($NewLine!== false && substr($Str, $NewLine+1, 3) == '['.$TagName.']'); + } while ($NewLine!== false && substr($Str, $NewLine+1, 3) == '['.$TagName.']'); $CloseTag = $NewLine; - if($CloseTag === false) { // block finishes with list + if ($CloseTag === false) { // block finishes with list $CloseTag = $Len; } $Block = substr($Str, $i, $CloseTag-$i); // Get the list @@ -355,7 +355,7 @@ private function parse ($Str) { $NumInCloses = -1; $InOpenRegex = '/\[('.$TagName.')'; - if($MaxAttribs>0) { + if ($MaxAttribs > 0) { $InOpenRegex.="(=[^\n'\"\[\]]+)?"; } $InOpenRegex.='\]/i'; @@ -365,7 +365,7 @@ private function parse ($Str) { // (as the first close tag won't do - it's been opened again) do { $CloseTag = stripos($Str, '[/'.$TagName.']', $CloseTag+1); - if($CloseTag === false) { + if ($CloseTag === false) { $CloseTag = $Len; break; } else { @@ -374,14 +374,14 @@ private function parse ($Str) { // Is there another open tag inside this one? $OpenTag = preg_match($InOpenRegex, $Str, $InTag, PREG_OFFSET_CAPTURE, $InTagPos+1); - if(!$OpenTag || $InTag[0][1]>$CloseTag) { + if (!$OpenTag || $InTag[0][1] > $CloseTag) { break; } else { $InTagPos = $InTag[0][1]; $NumInOpens++; } - } while($NumInOpens>$NumInCloses); + } while ($NumInOpens > $NumInCloses); // Find the internal block inside the tag @@ -398,7 +398,7 @@ private function parse ($Str) { break; case 'url': $Array[$ArrayPos] = array('Type'=>'img', 'Attr'=>$Attrib, 'Val'=>$Block); - if(empty($Attrib)) { // [url]http://...[/url] - always set URL to attribute + if (empty($Attrib)) { // [url]http://...[/url] - always set URL to attribute $Array[$ArrayPos] = array('Type'=>'url', 'Attr'=>$Block, 'Val'=>''); } else { $Array[$ArrayPos] = array('Type'=>'url', 'Attr'=>$Attrib, 'Val'=>$this->parse($Block)); @@ -409,7 +409,7 @@ private function parse ($Str) { break; case 'img': case 'image': - if(empty($Block)) { + if (empty($Block)) { $Block = $Attrib; } $Array[$ArrayPos] = array('Type'=>'img', 'Val'=>$Block); @@ -417,7 +417,7 @@ private function parse ($Str) { case 'aud': case 'mp3': case 'audio': - if(empty($Block)) { + if (empty($Block)) { $Block = $Attrib; } $Array[$ArrayPos] = array('Type'=>'aud', 'Val'=>$Block); @@ -472,7 +472,7 @@ private function parse ($Str) { $Array[$ArrayPos]['Val'] = explode('['.$TagName.']', $Block); $Array[$ArrayPos]['ListType'] = $TagName === '*' ? 'ul' : 'ol'; $Array[$ArrayPos]['Tag'] = $TagName; - foreach($Array[$ArrayPos]['Val'] as $Key=>$Val) { + foreach ($Array[$ArrayPos]['Val'] as $Key=>$Val) { $Array[$ArrayPos]['Val'][$Key] = $this->parse(trim($Val)); } break; @@ -480,14 +480,14 @@ private function parse ($Str) { $ArrayPos--; break; // n serves only to disrupt bbcode (backwards compatibility - use [pre]) default: - if($WikiLink == true) { + if ($WikiLink == true) { $Array[$ArrayPos] = array('Type'=>'wiki','Val'=>$TagName); } else { // Basic tags, like [b] or [size=5] $Array[$ArrayPos] = array('Type'=>$TagName, 'Val'=>$this->parse($Block)); - if(!empty($Attrib) && $MaxAttribs>0) { + if (!empty($Attrib) && $MaxAttribs>0) { $Array[$ArrayPos]['Attr'] = strtolower($Attrib); } } @@ -512,7 +512,7 @@ public function parse_toc ($Min = 3) foreach ($this->Headlines as $t) { $n = (int) $t[0]; - if($i === 0 && $n > 1) $off = $n - $level; + if ($i === 0 && $n > 1) $off = $n - $level; $this->headline_level($n, $level, $list, $i, $off); $list .= sprintf('
'.$this->to_html($Block['Val']).''; } @@ -714,21 +714,21 @@ private function to_html ($Array) { } } else { - $Str.='Mature content has been blocked. You can choose to view mature content by editing your settings.'; + $Str.='Mature content has been blocked. You can choose to view mature content by editing your settings.'; } break; case 'img': - if($this->NoImg>0 && $this->valid_url($Block['Val'])) { + if ($this->NoImg>0 && $this->valid_url($Block['Val'])) { $Str.=''.$Block['Val'].' (image)'; break; } - if(!$this->valid_url($Block['Val'], '\.(jpe?g|gif|png|bmp|tiff)')) { + if (!$this->valid_url($Block['Val'], '\.(jpe?g|gif|png|bmp|tiff)')) { $Str.='[img]'.$Block['Val'].'[/img]'; } else { $LocalURL = $this->local_url($Block['Val']); - if($LocalURL) { + if ($LocalURL) { $Str.=''; - } elseif(check_perms('site_proxy_images')) { + } elseif (check_perms('site_proxy_images')) { $Str.=''; } else { $Str.=''; @@ -737,11 +737,11 @@ private function to_html ($Array) { break; case 'aud': - if($this->NoImg>0 && $this->valid_url($Block['Val'])) { + if ($this->NoImg>0 && $this->valid_url($Block['Val'])) { $Str.=''.$Block['Val'].' (audio)'; break; } - if(!$this->valid_url($Block['Val'], '\.(mp3|ogg|wav)')) { + if (!$this->valid_url($Block['Val'], '\.(mp3|ogg|wav)')) { $Str.='[aud]'.$Block['Val'].'[/aud]'; } else { //TODO: Proxy this for staff? @@ -751,7 +751,7 @@ private function to_html ($Array) { case 'url': // Make sure the URL has a label - if(empty($Block['Val'])) { + if (empty($Block['Val'])) { $Block['Val'] = $Block['Attr']; $NoName = true; // If there isn't a Val for this } else { @@ -759,12 +759,12 @@ private function to_html ($Array) { $NoName = false; } - if(!$this->valid_url($Block['Attr'])) { + if (!$this->valid_url($Block['Attr'])) { $Str.='[url='.$Block['Attr'].']'.$Block['Val'].'[/url]'; } else { $LocalURL = $this->local_url($Block['Attr']); - if($LocalURL) { - if($NoName) { $Block['Val'] = substr($LocalURL,1); } + if ($LocalURL) { + if ($NoName) { $Block['Val'] = substr($LocalURL,1); } $Str.=''.$Block['Val'].''; } else { $Str.=''.$Block['Val'].''; @@ -773,7 +773,7 @@ private function to_html ($Array) { break; case 'inlineurl': - if(!$this->valid_url($Block['Attr'], '', true)) { + if (!$this->valid_url($Block['Attr'], '', true)) { $Array = $this->parse($Block['Attr']); $Block['Attr'] = $Array; $Str.=$this->to_html($Block['Attr']); @@ -781,7 +781,7 @@ private function to_html ($Array) { else { $LocalURL = $this->local_url($Block['Attr']); - if($LocalURL) { + if ($LocalURL) { $Str.=''.substr($LocalURL,1).''; } else { $Str.=''.$Block['Attr'].''; @@ -798,8 +798,8 @@ private function to_html ($Array) { private function raw_text ($Array) { $Str = ''; - foreach($Array as $Block) { - if(is_string($Block)) { + foreach ($Array as $Block) { + if (is_string($Block)) { $Str.=$Block; continue; } @@ -829,14 +829,14 @@ private function raw_text ($Array) { $Str.=$Block['Val']; break; case 'list': - foreach($Block['Val'] as $Line) { + foreach ($Block['Val'] as $Line) { $Str.=$Block['Tag'].$this->raw_text($Line); } break; case 'url': // Make sure the URL has a label - if(empty($Block['Val'])) { + if (empty($Block['Val'])) { $Block['Val'] = $Block['Attr']; } else { $Block['Val'] = $this->raw_text($Block['Val']); @@ -846,7 +846,7 @@ private function raw_text ($Array) { break; case 'inlineurl': - if(!$this->valid_url($Block['Attr'], '', true)) { + if (!$this->valid_url($Block['Attr'], '', true)) { $Array = $this->parse($Block['Attr']); $Block['Attr'] = $Array; $Str.=$this->raw_text($Block['Attr']); @@ -863,7 +863,7 @@ private function raw_text ($Array) { private function smileys ($Str) { global $LoggedUser; - if(!empty($LoggedUser['DisableSmileys'])) { + if (!empty($LoggedUser['DisableSmileys'])) { return $Str; } $Str = strtr($Str, $this->Smileys); diff --git a/gazelle.sql b/gazelle.sql index e7649206..5e77083a 100644 --- a/gazelle.sql +++ b/gazelle.sql @@ -214,6 +214,16 @@ CREATE TABLE `concerts` ( KEY `TopicID` (`TopicID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `disable_list` ( + `Nick` varchar(255) COLLATE utf8_bin NOT NULL, + `Username` varchar(255) COLLATE utf8_bin NOT NULL, + `UserID` int(10) unsigned NOT NULL, + `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `Moderator` varchar(255) COLLATE utf8_bin DEFAULT NULL, + PRIMARY KEY (`Nick`), + KEY `UserID` (`UserID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + CREATE TABLE `do_not_upload` ( `ID` int(10) NOT NULL AUTO_INCREMENT, `Name` varchar(255) COLLATE utf8_bin NOT NULL, diff --git a/sections/tools/data/bitcoin_balance.php b/sections/tools/data/bitcoin_balance.php index 048aa7a9..e56ce2d9 100644 --- a/sections/tools/data/bitcoin_balance.php +++ b/sections/tools/data/bitcoin_balance.php @@ -1,5 +1,7 @@ -if(!check_perms('admin_donor_log')) { error(403); } +if (!check_perms('admin_donor_log')) { + error(403); +} include(SERVER_ROOT.'/sections/donate/config.php'); @@ -7,8 +9,11 @@ $Balance = btc_balance() . " BTC"; $Receiveds = btc_received(); -$DB->query("SELECT i.UserID, i.BitcoinAddress FROM users_info AS i JOIN users_main AS m ON m.ID = i.UserID - WHERE BitcoinAddress IS NOT NULL ORDER BY m.Username ASC"); +$DB->query("SELECT i.UserID, i.BitcoinAddress + FROM users_info AS i + JOIN users_main AS m ON m.ID = i.UserID + WHERE BitcoinAddress IS NOT NULL + ORDER BY m.Username ASC"); ?>
Access |
=Users::format_username($UserID, true, true, true, true)?> | @@ -23,8 +26,10 @@
There are currently =number_format($Results)?> users queued by the system and =number_format($TotalDisabled)?> already disabled.