Merge remote
This commit is contained in:
commit
c1e2c93af7
@ -49,7 +49,7 @@ class Logger
|
||||
* 4 - Call callable provided in logger_param. logger_param must accept two parameters: array $message, int $level
|
||||
* $message is an array containing the messages the log, $level, is the logging level
|
||||
*/
|
||||
public static function constructor($mode, $optional = null, $prefix = '', $level = self::NOTICE, $max_size = 100*1024*1024)
|
||||
public static function constructor($mode, $optional = null, $prefix = '', $level = self::NOTICE, $max_size = 100 * 1024 * 1024)
|
||||
{
|
||||
self::$default = new self($mode, $optional, $prefix, $level, $max_size);
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ class MTProto
|
||||
'logger' => php_sapi_name() === 'cli' ? 3 : 2,
|
||||
// overwrite previous setting and echo logs
|
||||
'logger_level' => Logger::VERBOSE,
|
||||
'max_size' => 100*1024*1024,
|
||||
'max_size' => 100 * 1024 * 1024,
|
||||
// Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function.
|
||||
'rollbar_token' => '',
|
||||
], 'max_tries' => [
|
||||
@ -576,9 +576,9 @@ class MTProto
|
||||
Exception::$rollbar = false;
|
||||
RPCErrorException::$rollbar = false;
|
||||
}
|
||||
$this->logger = new \danog\MadelineProto\Logger($this->settings['logger']['logger'], isset($this->settings['logger']['logger_param']) ? $this->settings['logger']['logger_param'] : '', isset($this->authorization['user']) ? isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id'] : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE, isset($this->settings['logger']['max_size']) ? $this->settings['logger']['max_size'] : 100*1024*1024);
|
||||
$this->logger = new \danog\MadelineProto\Logger($this->settings['logger']['logger'], isset($this->settings['logger']['logger_param']) ? $this->settings['logger']['logger_param'] : '', isset($this->authorization['user']) ? isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id'] : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE, isset($this->settings['logger']['max_size']) ? $this->settings['logger']['max_size'] : 100 * 1024 * 1024);
|
||||
if (!\danog\MadelineProto\Logger::$default) {
|
||||
\danog\MadelineProto\Logger::constructor($this->settings['logger']['logger'], $this->settings['logger']['logger_param'], isset($this->authorization['user']) ? isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id'] : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE, isset($this->settings['logger']['max_size']) ? $this->settings['logger']['max_size'] : 100*1024*1024);
|
||||
\danog\MadelineProto\Logger::constructor($this->settings['logger']['logger'], $this->settings['logger']['logger_param'], isset($this->authorization['user']) ? isset($this->authorization['user']['username']) ? $this->authorization['user']['username'] : $this->authorization['user']['id'] : '', isset($this->settings['logger']['logger_level']) ? $this->settings['logger']['logger_level'] : Logger::VERBOSE, isset($this->settings['logger']['max_size']) ? $this->settings['logger']['max_size'] : 100 * 1024 * 1024);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,10 +38,10 @@ trait AuthKeyHandler
|
||||
* ]
|
||||
*
|
||||
* @return ResPQ [
|
||||
* int128 $nonce : The value of nonce is selected randomly by the server
|
||||
* int128 $server_nonce : The value of server_nonce is selected randomly by the server
|
||||
* string $pq : This is a representation of a natural number (in binary big endian format). This number is the product of two different odd prime numbers
|
||||
* Vector long $server_public_key_fingerprints : This is a list of public RSA key fingerprints
|
||||
* int128 $nonce : The value of nonce is selected randomly by the server
|
||||
* int128 $server_nonce : The value of server_nonce is selected randomly by the server
|
||||
* string $pq : This is a representation of a natural number (in binary big endian format). This number is the product of two different odd prime numbers
|
||||
* Vector long $server_public_key_fingerprints : This is a list of public RSA key fingerprints
|
||||
* ]
|
||||
*/
|
||||
$nonce = $this->random(16);
|
||||
@ -580,7 +580,6 @@ trait AuthKeyHandler
|
||||
$this->updates_state['sync_loading'] = false;
|
||||
$this->handle_pending_updates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function sync_authorization($id)
|
||||
|
@ -133,7 +133,6 @@ trait TL
|
||||
$key++;
|
||||
}
|
||||
} else {
|
||||
|
||||
foreach ($TL_dict['constructors'] as $key => $value) {
|
||||
$TL_dict['constructors'][$key]['id'] = $this->pack_signed_int($TL_dict['constructors'][$key]['id']);
|
||||
}
|
||||
@ -315,7 +314,7 @@ trait TL
|
||||
throw new Exception(\danog\MadelineProto\Lang::$current_lang['array_invalid']);
|
||||
}
|
||||
if (isset($object['_'])) {
|
||||
throw new Exception('You must provide an array of '.$type['subtype']." objects, not a ".$type['subtype']." object. Example: [['_' => ".$type['subtype'].", ... ]]");
|
||||
throw new Exception('You must provide an array of '.$type['subtype'].' objects, not a '.$type['subtype']." object. Example: [['_' => ".$type['subtype'].', ... ]]');
|
||||
}
|
||||
$concat = $this->constructors->find_by_predicate('vector')['id'];
|
||||
$concat .= $this->pack_unsigned_int(count($object));
|
||||
|
@ -34,19 +34,22 @@ trait TOS
|
||||
$this->logger->logger('By declining the TOS, the currently logged in account will be PERMANENTLY DELETED.', \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||
$this->logger->logger('Read the following TOS very carefully: ', \danog\MadelineProto\Logger::ERROR);
|
||||
$this->logger->logger($this->tos);
|
||||
|
||||
throw new \danog\MadelineProto\Exception('TOS action required, check the logs', 0, null, 'MadelineProto', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function accept_tos()
|
||||
{
|
||||
$this->tos['accepted'] = $this->method_call('help.acceptTermsOfService', ['id' => $this->tos['terms_of_service']['id']], ['datacenter' => $this->datacenter->curdc]);
|
||||
if ($this->tos['accepted']) {
|
||||
$this->logger->logger('TOS accepted successfully');
|
||||
} else {
|
||||
throw new \danog\MadelineProto\Exception('An error occurred while accepting the TOS');
|
||||
}
|
||||
$this->tos['accepted'] = $this->method_call('help.acceptTermsOfService', ['id' => $this->tos['terms_of_service']['id']], ['datacenter' => $this->datacenter->curdc]);
|
||||
if ($this->tos['accepted']) {
|
||||
$this->logger->logger('TOS accepted successfully');
|
||||
} else {
|
||||
throw new \danog\MadelineProto\Exception('An error occurred while accepting the TOS');
|
||||
}
|
||||
}
|
||||
|
||||
public function decline_tos()
|
||||
{
|
||||
$this->method_call('account.deleteAccount', ['reason' => 'Decline ToS update'], ['datacenter' => $this->datacenter->curdc]);
|
||||
|
Loading…
Reference in New Issue
Block a user