Apply fixes from StyleCI
This commit is contained in:
parent
080bb0e9f0
commit
3eca1368b2
@ -94,7 +94,7 @@ trait PeerHandler
|
|||||||
case 'userEmpty':
|
case 'userEmpty':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \danog\MadelineProto\Exception('Invalid user provided at key ' . $key . ': ' . var_export($user, true));
|
throw new \danog\MadelineProto\Exception('Invalid user provided at key '.$key.': '.var_export($user, true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ trait PeerHandler
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \danog\MadelineProto\Exception('Invalid chat provided at key ' . $key . ': ' . var_export($chat, true));
|
throw new \danog\MadelineProto\Exception('Invalid chat provided at key '.$key.': '.var_export($chat, true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,7 +336,7 @@ trait PeerHandler
|
|||||||
case 'channelForbidden':
|
case 'channelForbidden':
|
||||||
throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN');
|
throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN');
|
||||||
default:
|
default:
|
||||||
throw new \danog\MadelineProto\Exception('Invalid constructor given ' . var_export($id, true));
|
throw new \danog\MadelineProto\Exception('Invalid constructor given '.var_export($id, true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ trait PeerHandler
|
|||||||
$id = $this->to_supergroup($matches[1]);
|
$id = $this->to_supergroup($matches[1]);
|
||||||
}
|
}
|
||||||
if (preg_match('/^chat#(\d*)/', $id, $matches)) {
|
if (preg_match('/^chat#(\d*)/', $id, $matches)) {
|
||||||
$id = '-' . $matches[1];
|
$id = '-'.$matches[1];
|
||||||
}
|
}
|
||||||
if (preg_match('/^user#(\d*)/', $id, $matches)) {
|
if (preg_match('/^user#(\d*)/', $id, $matches)) {
|
||||||
$id = $matches[1];
|
$id = $matches[1];
|
||||||
@ -370,9 +370,9 @@ trait PeerHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true && $recursive) {
|
if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true && $recursive) {
|
||||||
$dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id=' . $id, false, stream_context_create(['http' => ['timeout' => 2]])), true);
|
$dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http' => ['timeout' => 2]])), true);
|
||||||
if (isset($dbres['ok']) && $dbres['ok']) {
|
if (isset($dbres['ok']) && $dbres['ok']) {
|
||||||
$this->resolve_username('@' . $dbres['result']);
|
$this->resolve_username('@'.$dbres['result']);
|
||||||
|
|
||||||
return $this->get_info($id, false);
|
return $this->get_info($id, false);
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ trait PeerHandler
|
|||||||
throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN');
|
throw new \danog\MadelineProto\RPCErrorException('CHAT_FORBIDDEN');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \danog\MadelineProto\Exception('Invalid constructor given ' . var_export($constructor, true));
|
throw new \danog\MadelineProto\Exception('Invalid constructor given '.var_export($constructor, true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,7 +648,7 @@ trait PeerHandler
|
|||||||
foreach ($filters as $filter) {
|
foreach ($filters as $filter) {
|
||||||
$this->recurse_alphabet_search_participants($full['InputChannel'], $filter, $q, $total_count, $res);
|
$this->recurse_alphabet_search_participants($full['InputChannel'], $filter, $q, $total_count, $res);
|
||||||
}
|
}
|
||||||
$this->logger->logger('Fetched ' . count($res['participants']) . " out of $total_count");
|
$this->logger->logger('Fetched '.count($res['participants'])." out of $total_count");
|
||||||
$res['participants'] = array_values($res['participants']);
|
$res['participants'] = array_values($res['participants']);
|
||||||
}
|
}
|
||||||
if (!$fullfetch) {
|
if (!$fullfetch) {
|
||||||
@ -668,7 +668,7 @@ trait PeerHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ($x = 'a'; $x !== 'aa' && $total_count > count($res['participants']); $x++) {
|
for ($x = 'a'; $x !== 'aa' && $total_count > count($res['participants']); $x++) {
|
||||||
$this->recurse_alphabet_search_participants($channel, $filter, $q . $x, $total_count, $res);
|
$this->recurse_alphabet_search_participants($channel, $filter, $q.$x, $total_count, $res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,7 +743,7 @@ trait PeerHandler
|
|||||||
}
|
}
|
||||||
$res['participants'][$participant['user_id']] = $newres;
|
$res['participants'][$participant['user_id']] = $newres;
|
||||||
}
|
}
|
||||||
$this->logger->logger('Fetched ' . count($gres['participants']) . " channel participants with filter $filter, query $q, offset $offset, limit $limit, hash $hash: " . ($cached ? 'cached' : 'not cached') . ', ' . ($offset + count($gres['participants'])) . ' participants out of ' . $gres['count'] . ', in total fetched ' . count($res['participants']) . ' out of ' . $total_count);
|
$this->logger->logger('Fetched '.count($gres['participants'])." channel participants with filter $filter, query $q, offset $offset, limit $limit, hash $hash: ".($cached ? 'cached' : 'not cached').', '.($offset + count($gres['participants'])).' participants out of '.$gres['count'].', in total fetched '.count($res['participants']).' out of '.$total_count);
|
||||||
$offset += count($gres['participants']);
|
$offset += count($gres['participants']);
|
||||||
} while (count($gres['participants']));
|
} while (count($gres['participants']));
|
||||||
|
|
||||||
@ -809,7 +809,7 @@ trait PeerHandler
|
|||||||
$id = isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id'];
|
$id = isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id'];
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_URL, 'https://id.pwrtelegram.xyz/db' . $this->settings['pwr']['db_token'] . '/addnewmadeline?d=pls&from=' . $id);
|
curl_setopt($ch, CURLOPT_URL, 'https://id.pwrtelegram.xyz/db'.$this->settings['pwr']['db_token'].'/addnewmadeline?d=pls&from='.$id);
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
|
||||||
@ -823,7 +823,7 @@ trait PeerHandler
|
|||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
unlink($path);
|
unlink($path);
|
||||||
}
|
}
|
||||||
$this->logger->logger('======= COULD NOT STORE IN DB DUE TO ' . $e->getMessage() . ' =============', \danog\MadelineProto\Logger::VERBOSE);
|
$this->logger->logger('======= COULD NOT STORE IN DB DUE TO '.$e->getMessage().' =============', \danog\MadelineProto\Logger::VERBOSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -832,7 +832,7 @@ trait PeerHandler
|
|||||||
try {
|
try {
|
||||||
$res = $this->method_call('contacts.resolveUsername', ['username' => str_replace('@', '', $username)], ['datacenter' => $this->datacenter->curdc]);
|
$res = $this->method_call('contacts.resolveUsername', ['username' => str_replace('@', '', $username)], ['datacenter' => $this->datacenter->curdc]);
|
||||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||||
$this->logger->logger('Username resolution failed with error ' . $e->getMessage(), \danog\MadelineProto\Logger::ERROR);
|
$this->logger->logger('Username resolution failed with error '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR);
|
||||||
if (strpos($e->rpc, 'FLOOD_WAIT_') === 0 || $e->rpc === 'AUTH_KEY_UNREGISTERED' || $e->rpc === 'USERNAME_INVALID') {
|
if (strpos($e->rpc, 'FLOOD_WAIT_') === 0 || $e->rpc === 'AUTH_KEY_UNREGISTERED' || $e->rpc === 'USERNAME_INVALID') {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user