/** * Save a xavi for the bot. * * @param string $xavi The xavi to save. * @param array $infos The informations needed to save the xavi. * * @return bool */ public static function post($xavi, $infos = []) { $http = new Http(); $http->setHeader('Content-Type', 'application/x-www-form-urlencoded'); $response = $http->post('http://xat.com/json/xavi/put.php', ['s' => 60, 'au' => 'undefined', 't' => $infos['y']['t'], 'j' => 'undefined', 'u' => Configure::read('Bot.id'), 'k' => $infos['y']['I'], 'v' => 'undefined', 'i' => $infos['y']['i'], 'xavi' => $xavi]); if ($response->isOk() && $response->getBody() == "OK") { return true; } return false; }
/** * Get information about the Gcontrol power. * * @param array $roomInfo An array of the Gcontrol configuration. * * @return false|string */ protected static function _getGcontrolInfo($roomInfo) { if (!is_array($roomInfo)) { return false; } $phrase = 'Gcontrol info : '; $rank = isset($roomInfo['mg']) ? static::$_rankValue[(int) $roomInfo['mg']] : static::$_rankValue[7]; $phrase .= ' Make Guest : ' . $rank; $type = isset($roomInfo['mb']) ? static::$_rankValue[(int) $roomInfo['mb']] : static::$_rankValue[8]; $phrase .= ' Make Member : ' . $type; $type = isset($roomInfo['mm']) ? static::$_rankValue[(int) $roomInfo['mm']] : static::$_rankValue[11]; $phrase .= ' Make Moderator : ' . $type; $type = isset($roomInfo['kk']) ? static::$_rankValue[(int) $roomInfo['kk']] : static::$_rankValue[7]; $phrase .= ' Kick : ' . $type; $type = isset($roomInfo['bn']) ? static::$_rankValue[(int) $roomInfo['bn']] : static::$_rankValue[7]; $phrase .= ' Ban : ' . $type; $type = isset($roomInfo['ubn']) ? static::$_rankValue[(int) $roomInfo['ubn']] : static::$_rankValue[7]; $phrase .= ' Unban : ' . $type; $type = isset($roomInfo['mbt']) ? $roomInfo['mbt'] : '6'; $phrase .= ' Mod Max Ban Time : ' . $type; $type = isset($roomInfo['obt']) ? (int) $roomInfo['obt'] === 0 ? 'Forever' : $roomInfo['obt'] : 'Forever'; $phrase .= ' Owner Max Ban Time : ' . $type; $type = isset($roomInfo['ss']) ? static::$_rankValue[(int) $roomInfo['ss']] : static::$_rankValue[10]; $phrase .= ' Set Scroller : ' . $type; $type = isset($roomInfo['lkd']) ? static::$_rankValue[(int) $roomInfo['lkd']] : static::$_rankValue[0]; $phrase .= ' Must be Locked : ' . $type; $type = isset($roomInfo['rgd']) ? static::$_rankValue[(int) $roomInfo['rgd']] : static::$_rankValue[0]; $phrase .= ' Must be Registered : ' . $type; $type = isset($roomInfo['bst']) ? $roomInfo['bst'] : '0'; $phrase .= ' Preferred Blast : ' . $type; $type = isset($roomInfo['prm']) ? static::$_rankValue[(int) $roomInfo['prm']] : static::$_rankValue[5]; $phrase .= ' Can Promote : ' . $type; $type = isset($roomInfo['bge']) ? static::$_rankValue[(int) $roomInfo['bge']] : static::$_rankValue[7]; $phrase .= ' Barge In : ' . $type; $type = isset($roomInfo['mxt']) ? $roomInfo['mxt'] : '10'; $phrase .= ' Max Toons : ' . $type; $type = isset($roomInfo['ads']) ? $roomInfo['ads'] : '0'; $phrase .= ' Ads Position : ' . $type; $type = isset($roomInfo['sme']) ? static::$_rankValue[(int) $roomInfo['sme']] : static::$_rankValue[7]; $phrase .= ' Silent Member : ' . $type; $type = isset($roomInfo['dnc']) ? static::$_rankValue[(int) $roomInfo['dnc']] : static::$_rankValue[14]; $phrase .= ' Can be Dunced : ' . $type; $type = isset($roomInfo['bdg']) ? static::$_rankValue[(int) $roomInfo['bdg']] : static::$_rankValue[10]; $phrase .= ' Can Award Badge : ' . $type; $type = isset($roomInfo['ns']) ? static::$_rankValue[(int) $roomInfo['ns']] : static::$_rankValue[7]; $phrase .= ' Can Naughty Step : ' . $type; $type = isset($roomInfo['yl']) ? static::$_rankValue[(int) $roomInfo['yl']] : static::$_rankValue[7]; $phrase .= ' Can Yellow Card : ' . $type; $type = isset($roomInfo['p']) ? static::$_rankValue[(int) $roomInfo['p']] : static::$_rankValue[10]; $phrase .= ' Protect Mode : ' . $type; $type = isset($roomInfo['pd']) ? $roomInfo['pd'] : '1'; $phrase .= ' Protect Default : ' . $type; $type = isset($roomInfo['pt']) ? $roomInfo['pt'] : '1'; $phrase .= ' Protect Time (hours) : ' . $type; $type = isset($roomInfo['ka']) ? static::$_rankValue[(int) $roomInfo['ka']] : static::$_rankValue[10]; $phrase .= ' Kick All : ' . $type; $type = isset($roomInfo['mft']) ? $roomInfo['mft'] : '4'; $phrase .= ' Member Flood Trust : ' . $type; $type = isset($roomInfo['ft']) ? $roomInfo['ft'] : '50'; $phrase .= ' Flood Threshold : ' . $type; $http = new Http(); $response = $http->post('http://pastebin.com/api/api_post.php', ['api_option' => 'paste', 'api_dev_key' => Configure::read('Pastebin.apiDevKey'), 'api_user_key' => '', 'api_paste_private' => Configure::read('Pastebin.apiPastePrivate'), 'api_paste_expire_date' => Configure::read('Pastebin.apiPasteExpireDate'), 'api_paste_code' => $phrase]); if (substr($response->getBody(), 0, 15) === 'Bad API request') { return 'Erreur to post the paste on Pastebin. Error : ' . $response->body; } $phrase = 'Gcontrol info : ' . $response->body; return $phrase; }