Apply fixes from StyleCI
This commit is contained in:
parent
1cb3c35ac8
commit
86d146c977
7
bot.php
7
bot.php
@ -12,7 +12,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/'));
|
||||
|
||||
/**
|
||||
/*
|
||||
* Various ways to load MadelineProto
|
||||
*/
|
||||
if (!file_exists(__DIR__.'/vendor/autoload.php')) {
|
||||
@ -29,12 +29,14 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
{
|
||||
public function onAny($update)
|
||||
{
|
||||
\danog\MadelineProto\Logger::log("Received an update of type ".$update['_']);
|
||||
\danog\MadelineProto\Logger::log('Received an update of type '.$update['_']);
|
||||
}
|
||||
|
||||
public function onUpdateNewChannelMessage($update)
|
||||
{
|
||||
$this->onUpdateNewMessage($update);
|
||||
}
|
||||
|
||||
public function onUpdateNewMessage($update)
|
||||
{
|
||||
if (isset($update['message']['out']) && $update['message']['out']) {
|
||||
@ -63,7 +65,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e'], 'updates' => ['handle_updates' => true]]; //, 'connection_settings' => ['all' => ['test_mode' => true]]];
|
||||
|
||||
try {
|
||||
|
@ -1,51 +1,52 @@
|
||||
<?php
|
||||
|
||||
$index = '';
|
||||
$files = glob('docs/docs/*md');
|
||||
foreach ($files as $file) {
|
||||
$base = basename($file, '.md');
|
||||
if ($base === 'CREATING_A_CLIENT') {
|
||||
$orderedfiles[0] = $file;
|
||||
} else if ($base === 'LOGIN') {
|
||||
} elseif ($base === 'LOGIN') {
|
||||
$orderedfiles[1] = $file;
|
||||
} else if ($base === 'FEATURES') {
|
||||
} elseif ($base === 'FEATURES') {
|
||||
$orderedfiles[2] = $file;
|
||||
} else if ($base === 'REQUIREMENTS') {
|
||||
} elseif ($base === 'REQUIREMENTS') {
|
||||
$orderedfiles[3] = $file;
|
||||
} else if ($base === 'INSTALLATION') {
|
||||
} elseif ($base === 'INSTALLATION') {
|
||||
$orderedfiles[4] = $file;
|
||||
} else if ($base === 'UPDATES') {
|
||||
} elseif ($base === 'UPDATES') {
|
||||
$orderedfiles[5] = $file;
|
||||
} else if ($base === 'SETTINGS') {
|
||||
} elseif ($base === 'SETTINGS') {
|
||||
$orderedfiles[6] = $file;
|
||||
} else if ($base === 'SELF') {
|
||||
} elseif ($base === 'SELF') {
|
||||
$orderedfiles[7] = $file;
|
||||
} else if ($base === 'EXCEPTIONS') {
|
||||
} elseif ($base === 'EXCEPTIONS') {
|
||||
$orderedfiles[8] = $file;
|
||||
} else if ($base === 'FLOOD_WAIT') {
|
||||
} elseif ($base === 'FLOOD_WAIT') {
|
||||
$orderedfiles[9] = $file;
|
||||
} else if ($base === 'LOGGING') {
|
||||
} elseif ($base === 'LOGGING') {
|
||||
$orderedfiles[10] = $file;
|
||||
} else if ($base === 'USING_METHODS') {
|
||||
} elseif ($base === 'USING_METHODS') {
|
||||
$orderedfiles[11] = $file;
|
||||
} else if ($base === 'FILES') {
|
||||
} elseif ($base === 'FILES') {
|
||||
$orderedfiles[12] = $file;
|
||||
} else if ($base === 'CHAT_INFO') {
|
||||
} elseif ($base === 'CHAT_INFO') {
|
||||
$orderedfiles[13] = $file;
|
||||
} else if ($base === 'DIALOGS') {
|
||||
} elseif ($base === 'DIALOGS') {
|
||||
$orderedfiles[14] = $file;
|
||||
} else if ($base === 'INLINE_BUTTONS') {
|
||||
} elseif ($base === 'INLINE_BUTTONS') {
|
||||
$orderedfiles[15] = $file;
|
||||
} else if ($base === 'CALLS') {
|
||||
} elseif ($base === 'CALLS') {
|
||||
$orderedfiles[16] = $file;
|
||||
} else if ($base === 'SECRET_CHATS') {
|
||||
} elseif ($base === 'SECRET_CHATS') {
|
||||
$orderedfiles[17] = $file;
|
||||
} else if ($base === 'LUA') {
|
||||
} elseif ($base === 'LUA') {
|
||||
$orderedfiles[18] = $file;
|
||||
} else if ($base === 'PROXY') {
|
||||
} elseif ($base === 'PROXY') {
|
||||
$orderedfiles[19] = $file;
|
||||
} else if ($base === 'CONTRIB') {
|
||||
} elseif ($base === 'CONTRIB') {
|
||||
$orderedfiles[20] = $file;
|
||||
} else if ($base === 'TEMPLATES') {
|
||||
} elseif ($base === 'TEMPLATES') {
|
||||
$orderedfiles[21] = $file;
|
||||
}
|
||||
ksort($orderedfiles);
|
||||
@ -53,12 +54,12 @@ foreach ($files as $file) {
|
||||
ksort($orderedfiles);
|
||||
foreach ($orderedfiles as $key => $filename) {
|
||||
$lines = explode("\n", file_get_contents($filename));
|
||||
while (end($lines) === '' || strpos(end($lines), "Next")) {
|
||||
unset($lines[count($lines)-1]);
|
||||
while (end($lines) === '' || strpos(end($lines), 'Next')) {
|
||||
unset($lines[count($lines) - 1]);
|
||||
}
|
||||
if (isset($orderedfiles[$key+1])) {
|
||||
$nextfile = "https://docs.madelineproto.xyz/docs/".basename($orderedfiles[$key+1], '.md').".html";
|
||||
$prevfile = $key === 0 ? "https://docs.madelineproto.xyz" : "https://docs.madelineproto.xyz/docs/".basename($orderedfiles[$key-1], '.md').".html";
|
||||
if (isset($orderedfiles[$key + 1])) {
|
||||
$nextfile = 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key + 1], '.md').'.html';
|
||||
$prevfile = $key === 0 ? 'https://docs.madelineproto.xyz' : 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key - 1], '.md').'.html';
|
||||
$lines[count($lines)] = "\n<form action=\"$prevfile\"><input type=\"submit\" value=\"Previous section\" /></form><form action=\"$nextfile\"><input type=\"submit\" value=\"Next section\" /></form>";
|
||||
} else {
|
||||
$lines[count($lines)] = "\n<form action=\"https://docs.madelineproto.xyz/#very-complex-and-complete-examples\"><input type=\"submit\" value=\"Next section\" /></form>";
|
||||
@ -68,13 +69,13 @@ foreach ($orderedfiles as $key => $filename) {
|
||||
preg_match('|^# (.*)|', $file = file_get_contents($filename), $matches);
|
||||
$title = $matches[1];
|
||||
preg_match_all('|( *)\* \[(.*)\]\(#(.*)\)|', $file, $matches);
|
||||
$file = "https://docs.madelineproto.xyz/docs/".basename($filename, '.md').".html";
|
||||
$file = 'https://docs.madelineproto.xyz/docs/'.basename($filename, '.md').'.html';
|
||||
$index .= "* [$title]($file)\n";
|
||||
if (basename($filename) !== 'FEATURES.md') {
|
||||
foreach ($matches[1] as $key => $match) {
|
||||
$spaces = " $match";
|
||||
$name = $matches[2][$key];
|
||||
$url = $file."#".$matches[3][$key];
|
||||
$url = $file.'#'.$matches[3][$key];
|
||||
$index .= "$spaces* [$name]($url)\n";
|
||||
}
|
||||
}
|
||||
|
@ -9,498 +9,496 @@
|
||||
You should have received a copy of the GNU General Public License along with MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
|
||||
class Lang
|
||||
{
|
||||
public static $lang = array (
|
||||
'it' =>
|
||||
array (
|
||||
'phpseclib_fork' => 'Per favore installa questo fork di phpseclib: https://github.com/danog/phpseclib',
|
||||
'inst_dc' => 'Istanziamento dei DataCenter...',
|
||||
'load_rsa' => 'Caricamento delle chiavi RSA...',
|
||||
'TL_translation' => 'Translazione degli schemi TL...',
|
||||
'dh_prime_check_0' => 'Esecuzione dei check dh_prime (0/3)...',
|
||||
'nearest_dc' => 'Siamo in %s, il DC più vicino è %d.',
|
||||
'serialization_ofd' => 'La serializzazione non è aggiornata, reistanziamento dell\'oggetto in corso!',
|
||||
'getupdates_deserialization' => 'Ottenimento aggiornamenti dopo deserializzazione...',
|
||||
'shutdown_reader_pool' => 'Chiusura pool di lettura, %d thread rimasti',
|
||||
'threading_on' => 'IL THREADING È ABILITATO',
|
||||
'socket_reader' => 'Lettore socket su DC %s: ',
|
||||
'socket_status_1' => 'CREAZIONE',
|
||||
'socket_status_2' => 'INVIO',
|
||||
'socket_status_3' => 'ATTESA',
|
||||
'socket_status_4' => 'PRONTO',
|
||||
'socket_status_5' => 'AVVIATO',
|
||||
'api_not_set' => 'Devi specificare una chiave ed un ID API, ottienili su https://my.telegram.org',
|
||||
'session_corrupted' => 'La sessione si è corrotta!',
|
||||
'reset_session_seqno' => 'Resettando ID sessione e numero di sequenza sul DC %s...',
|
||||
'gen_perm_auth_key' => 'Generando chiave di autorizzazione permanente per il DC %s...',
|
||||
'gen_temp_auth_key' => 'Generando chiave di autorizzazione temporanea per il DC %s...',
|
||||
'copy_auth_dcs' => 'Copiando autorizzazione dal DC %s al DC %s...',
|
||||
'write_client_info' => 'Scrittura info sul client (eseguendo nel contempo il metodo %s)...',
|
||||
'config_updated' => 'La configurazione è stata aggiornata!',
|
||||
'length_not_4' => 'La lunghezza non è uguale a 4',
|
||||
'length_not_8' => 'La lunghezza non è uguale a 8',
|
||||
'value_bigger_than_2147483647' => 'Il valore fornito (%s) è maggiore di 2147483647',
|
||||
'value_smaller_than_2147483648' => 'Il valore fornito (%s) è minore di -2147483648',
|
||||
'value_bigger_than_9223372036854775807' => 'Il valore fornito (%s) è maggiore di 9223372036854775807',
|
||||
public static $lang = [
|
||||
'it' => [
|
||||
'phpseclib_fork' => 'Per favore installa questo fork di phpseclib: https://github.com/danog/phpseclib',
|
||||
'inst_dc' => 'Istanziamento dei DataCenter...',
|
||||
'load_rsa' => 'Caricamento delle chiavi RSA...',
|
||||
'TL_translation' => 'Translazione degli schemi TL...',
|
||||
'dh_prime_check_0' => 'Esecuzione dei check dh_prime (0/3)...',
|
||||
'nearest_dc' => 'Siamo in %s, il DC più vicino è %d.',
|
||||
'serialization_ofd' => 'La serializzazione non è aggiornata, reistanziamento dell\'oggetto in corso!',
|
||||
'getupdates_deserialization' => 'Ottenimento aggiornamenti dopo deserializzazione...',
|
||||
'shutdown_reader_pool' => 'Chiusura pool di lettura, %d thread rimasti',
|
||||
'threading_on' => 'IL THREADING È ABILITATO',
|
||||
'socket_reader' => 'Lettore socket su DC %s: ',
|
||||
'socket_status_1' => 'CREAZIONE',
|
||||
'socket_status_2' => 'INVIO',
|
||||
'socket_status_3' => 'ATTESA',
|
||||
'socket_status_4' => 'PRONTO',
|
||||
'socket_status_5' => 'AVVIATO',
|
||||
'api_not_set' => 'Devi specificare una chiave ed un ID API, ottienili su https://my.telegram.org',
|
||||
'session_corrupted' => 'La sessione si è corrotta!',
|
||||
'reset_session_seqno' => 'Resettando ID sessione e numero di sequenza sul DC %s...',
|
||||
'gen_perm_auth_key' => 'Generando chiave di autorizzazione permanente per il DC %s...',
|
||||
'gen_temp_auth_key' => 'Generando chiave di autorizzazione temporanea per il DC %s...',
|
||||
'copy_auth_dcs' => 'Copiando autorizzazione dal DC %s al DC %s...',
|
||||
'write_client_info' => 'Scrittura info sul client (eseguendo nel contempo il metodo %s)...',
|
||||
'config_updated' => 'La configurazione è stata aggiornata!',
|
||||
'length_not_4' => 'La lunghezza non è uguale a 4',
|
||||
'length_not_8' => 'La lunghezza non è uguale a 8',
|
||||
'value_bigger_than_2147483647' => 'Il valore fornito (%s) è maggiore di 2147483647',
|
||||
'value_smaller_than_2147483648' => 'Il valore fornito (%s) è minore di -2147483648',
|
||||
'value_bigger_than_9223372036854775807' => 'Il valore fornito (%s) è maggiore di 9223372036854775807',
|
||||
'value_smaller_than_9223372036854775808' => 'Il valore fornito (%s) è minore di -9223372036854775808',
|
||||
'value_bigger_than_4294967296' => 'Il valore fornito (%s) è maggiore di 4294967296',
|
||||
'value_smaller_than_0' => 'Il valore fornito (%s) è minore di 0',
|
||||
'encode_double_error' => 'Non sono riuscito a codificare il numero a virgola mobile fornito',
|
||||
'file_not_exist' => 'Il file specificato non esiste',
|
||||
'deserialization_error' => 'C\'è stato un errore durante la deserializzazione',
|
||||
'rsa_init' => 'Istanziamento di \\phpseclib\\Crypt\\RSA in corso...',
|
||||
'loading_key' => 'Caricamento della chiave in corso...',
|
||||
'computing_fingerprint' => 'Calcolo del fingerprint in corso...',
|
||||
'rsa_encrypting' => 'Criptando con chiave RSA...',
|
||||
'rpc_tg_error' => 'Telegram ha ritornato un errore RPC: %s (%s), causato da %s:%sTL trace:',
|
||||
'v_error' => '506572206661766f726520616767696f726e612071756573746120696e7374616c6c617a696f6e65206469204d6164656c696e6550726f746f20636f6e206769742070756c6c206520636f6d706f73657220757064617465',
|
||||
'v_tgerror' => '506572206661766f726520616767696f726e61207068702d6c69627467766f6970',
|
||||
'no_mode_specified' => 'Nessuna modalità di logging è stata specificata!',
|
||||
'constructor_function_uncalled' => 'Il metodo costruttore non è stato ancora chiamato! Per favore chiama il metodo costruttore prima di usare questo metodo.',
|
||||
'proxy_class_invalid' => 'È stata specificata una classe proxy errata!',
|
||||
'socket_con_error' => 'Connessione fallita.',
|
||||
'protocol_not_implemented' => 'Questo protocollo non è stato ancora implementato.',
|
||||
'protocol_invalid' => 'È stato fornito un protocollo non valido',
|
||||
'nothing_in_socket' => 'Non c\'è niente nel socket!',
|
||||
'wrong_length_read' => 'ATTENZIONE: Non sono stati letti abbastanza byte (dovevo leggere %s, ho letto %s)!',
|
||||
'no_data_in_socket' => 'Non ci sono dati nel socket!',
|
||||
'dc_con_start' => 'Connessione al DC %s in corso...',
|
||||
'dc_con_stop' => 'Disconnessione dal DC %s in corso...',
|
||||
'dc_con_test_start' => 'Connessione al DC %s (server %s, %s, %s)...',
|
||||
'script_not_exist' => 'Lo script fornito non esiste',
|
||||
'apifactory_start' => 'Sto avviando la fabbrica di API...',
|
||||
'madelineproto_ready' => 'MadelineProto è pronto!',
|
||||
'logout_error' => 'C\'è stato un errore durante il logout!',
|
||||
'logout_ok' => 'Il logout è stato eseguito correttamente!',
|
||||
'already_logged_in' => 'Questa istanza di MadelineProto è già loggata, prima faccio il logout...',
|
||||
'login_ok' => 'Il login è stato eseguito correttamente!',
|
||||
'login_user' => 'Sto eseguendo il login come utente normale...',
|
||||
'login_bot' => 'Sto eseguendo il login come bot...',
|
||||
'login_code_sending' => 'Sto inviando il codice...',
|
||||
'login_code_sent' => 'Il codice è stato inviato correttamente! Una volta ricevuto il codice dovrai usare la funzione complete_phone_login.',
|
||||
'login_code_uncalled' => 'Non sto aspettando il codice! Usa la funzione phone_login.',
|
||||
'login_2fa_enabled' => 'L\'autenticazione a due fattori è abilitata, dovrai chiamare il metodo complete_2fa_login...',
|
||||
'login_need_signup' => 'Questo numero non è registrato su telegram, dovrai chiamare la funzione complete_signup...',
|
||||
'login_auth_key' => 'Sto facendo il login con la chiave di autorizzazione...',
|
||||
'not_logged_in' => 'Non ho ancora fatto il login!',
|
||||
'signup_uncalled' => 'Chiama prima le funzioni phone_login e complete_phone_login.',
|
||||
'signing_up' => 'Mi sto registrando su telegram come utente normale...',
|
||||
'signup_ok' => 'Mi sono registrato su Telegram!',
|
||||
'2fa_uncalled' => 'Non sto aspettando la password, chiama prima le funzioni phone_login e complete_phone_login!',
|
||||
'getting_dialogs' => 'Sto ottenendo la lista delle chat...',
|
||||
'libtgvoip_required' => 'È necessario installare l\'estensione php-libtgvoip per accettare e gestire chiamate vocali, vistate https://docs.madelineproto.xyz per più info.',
|
||||
'peer_not_in_db' => 'Questo utente/gruppo/canale non è presente nel database interno MadelineProto',
|
||||
'calling_user' => 'Sto chiamando %s...',
|
||||
'generating_a' => 'Sto generando a...',
|
||||
'generating_g_a' => 'Sto generando g_a...',
|
||||
'call_error_1' => 'Impossibile trovare ed accettare la chiamata %s',
|
||||
'accepting_call' => 'Sto accettando una chiamata da %s...',
|
||||
'generating_b' => 'Sto generando b...',
|
||||
'call_already_accepted' => 'La chiamata %s è già stata accettata.',
|
||||
'call_already_declined' => 'La chiamata %s è già stata annullata.',
|
||||
'call_error_2' => 'Impossibile trovare e confermare la chiamata %s',
|
||||
'call_confirming' => 'Sto confermando una chiamata da %s',
|
||||
'call_error_3' => 'Impossibile trovare e completare la chiamata %s',
|
||||
'call_completing' => 'Sto completando una chiamata da %s...',
|
||||
'invalid_g_a' => 'g_a non valido!',
|
||||
'fingerprint_invalid' => 'fingerprint della chiave non valido!',
|
||||
'call_discarding' => 'Sto rifiutando la chiamata %s...',
|
||||
'call_set_rating' => 'Sto inviando la recensione della chiamata %s...',
|
||||
'call_debug_saving' => 'Sto inviando i dati di debug della chiamata %s...',
|
||||
'TL_loading' => 'Sto caricando gli schemi TL...',
|
||||
'file_parsing' => 'Leggendo %s...',
|
||||
'crc32_mismatch' => 'CRC32 non valido (%s diverso da %s) per %s',
|
||||
'src_file_invalid' => 'È stato fornito un file sorgente non valido: ',
|
||||
'translating_obj' => 'Traducendo gli oggetti...',
|
||||
'translating_methods' => 'Traducendo i metodi...',
|
||||
'bool_error' => 'Non sono riuscito ad estrarre un booleano',
|
||||
'not_numeric' => 'Il valore fornito non è numerico',
|
||||
'long_not_16' => 'Il valore fornito non è lungo 16 byte',
|
||||
'long_not_32' => 'Il valore fornito non è lungo 32 byte',
|
||||
'long_not_64' => 'Il valore fornito non è lungo 64 byte',
|
||||
'array_invalid' => 'Il valore fornito non è un array',
|
||||
'predicate_not_set' => 'Il predicato (valore sotto chiave _, esempio [\'_\' => \'inputPeer\']) non è impostato!',
|
||||
'type_extract_error' => 'Impossibile estrarre il tipo "%s"',
|
||||
'method_not_found' => 'Impossibile trovare il seguente metodo: ',
|
||||
'params_missing' => 'Non hai fornito un parametro obbligatorio, rileggi la documentazione API',
|
||||
'sec_peer_not_in_db' => 'La chat segreta non è presente nel database interno MadelineProto',
|
||||
'stream_handle_invalid' => 'Il valore fornito non è uno stream',
|
||||
'length_too_big' => 'Il valore fornito è troppo lungo',
|
||||
'deserialize_not_str' => 'Il valore generato non è una stringa',
|
||||
'type_extract_error_id' => 'Non sono riuscito ad estrarre il tipo %s con ID %s',
|
||||
'vector_invalid' => 'ID vettore non valido: ',
|
||||
'constructor_not_found' => 'Costruttore non trovato per tipo: ',
|
||||
'rand_bytes_too_small' => 'random_bytes è troppo corto!',
|
||||
'botapi_conversion_error' => 'NOn sono risucito a convertire %s in un oggetto bot API',
|
||||
'non_text_conversion' => 'Non posso ancora convertire messaggi media',
|
||||
'last_byte_invalid' => 'L\'ultimo byte non è valido',
|
||||
'file_type_invalid' => 'È stato fornito un tipo file errato',
|
||||
'recreate_temp_auth_key' => 'Sono stato costretto a rigenerare la chiave di autorizzazione temporanea',
|
||||
'resetting_auth_key' => 'ATTENZIONE: Sto resettando la chiave temporanea...',
|
||||
'shutting_down_reader_pool' => 'Chisura pool di lettura',
|
||||
'shutting_down_handler_pool' => 'Chiusura pool di gestione per DC %s, %d thread rimasti',
|
||||
'secret_chat_skipping' => 'Non ho la chat segreta %s nel database, ignorando messaggio',
|
||||
'fingerprint_mismatch' => 'Fingerprint della chiave non valido',
|
||||
'msg_data_length_too_big' => 'message_data_length è troppo grande',
|
||||
'length_not_divisible_16' => 'La lunghezza dei dati decifrati non è divisibile per 16',
|
||||
'msg_key_mismatch' => 'msg_key non valido',
|
||||
'rand_bytes_too_short' => 'random_bytes è troppo corto!',
|
||||
'resending_unsupported' => 'IL riinvio di messaggi non è ancora supportato',
|
||||
'unrecognized_dec_msg' => 'È stato ricevuto un messaggio decifrato sconosciuto: ',
|
||||
'serializing_madelineproto' => 'Sto serializzando MadelineProto...',
|
||||
'req_pq' => 'Sto richiedendo pq...',
|
||||
'done' => 'Fatto!',
|
||||
'cdn_reupload' => 'Il file non è disponibile sul nostro CDN, richiedo la copia!',
|
||||
'stored_on_cdn' => 'Il file è scaricabile tramite CDN!',
|
||||
),
|
||||
'en' =>
|
||||
array (
|
||||
'req_pq' => 'Requesting pq...',
|
||||
'done' => 'Done!',
|
||||
'cdn_reupload' => 'File is not stored on CDN, requesting reupload!',
|
||||
'stored_on_cdn' => 'File is stored on CDN!',
|
||||
'serializing_madelineproto' => 'Serializing MadelineProto...',
|
||||
'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib',
|
||||
'inst_dc' => 'Istantiating DataCenter...',
|
||||
'load_rsa' => 'Loading RSA keys...',
|
||||
'TL_translation' => 'Translating TL schemas...',
|
||||
'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...',
|
||||
'nearest_dc' => 'We\'re in %s, nearest DC is %d.',
|
||||
'serialization_ofd' => 'Serialization is out of date, reconstructing object!',
|
||||
'getupdates_deserialization' => 'Getting updates after deserialization...',
|
||||
'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left',
|
||||
'threading_on' => 'THREADING IS ENABLED',
|
||||
'socket_reader' => 'Socket reader on DC %s: ',
|
||||
'socket_status_1' => 'CREATING',
|
||||
'socket_status_2' => 'SUBMITTING',
|
||||
'socket_status_3' => 'WAITING',
|
||||
'socket_status_4' => 'READY',
|
||||
'socket_status_5' => 'WORKING',
|
||||
'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org',
|
||||
'session_corrupted' => 'The session is corrupted!',
|
||||
'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...',
|
||||
'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...',
|
||||
'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...',
|
||||
'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...',
|
||||
'write_client_info' => 'Writing client info (also executing %s)...',
|
||||
'config_updated' => 'Updated config!',
|
||||
'length_not_4' => 'Length is not equal to 4',
|
||||
'length_not_8' => 'Length is not equal to 8',
|
||||
'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647',
|
||||
'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648',
|
||||
'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807',
|
||||
'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808',
|
||||
'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296',
|
||||
'value_smaller_than_0' => 'Provided value %s is smaller than 0',
|
||||
'encode_double_error' => 'Could not properly encode double',
|
||||
'file_not_exist' => 'File does not exist',
|
||||
'deserialization_error' => 'An error occurred on deserialization',
|
||||
'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...',
|
||||
'loading_key' => 'Loading key...',
|
||||
'computing_fingerprint' => 'Computing fingerprint...',
|
||||
'rsa_encrypting' => 'Encrypting with rsa key...',
|
||||
'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:',
|
||||
'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e',
|
||||
'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970',
|
||||
'no_mode_specified' => 'No mode was specified!',
|
||||
'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.',
|
||||
'proxy_class_invalid' => 'Invalid proxy class provided!',
|
||||
'socket_con_error' => 'Connection: couldn\'t connect to socket.',
|
||||
'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.',
|
||||
'protocol_invalid' => 'Connection: invalid protocol specified.',
|
||||
'nothing_in_socket' => 'Nothing in the socket!',
|
||||
'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!',
|
||||
'no_data_in_socket' => 'No data in the socket!',
|
||||
'dc_con_start' => 'Connecting to DC %s...',
|
||||
'dc_con_stop' => 'Disconnecting from DC %s...',
|
||||
'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...',
|
||||
'script_not_exist' => 'Provided script does not exist',
|
||||
'apifactory_start' => 'Running APIFactory...',
|
||||
'madelineproto_ready' => 'MadelineProto is ready!',
|
||||
'logout_error' => 'An error occurred while logging out!',
|
||||
'logout_ok' => 'Logged out successfully!',
|
||||
'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...',
|
||||
'login_ok' => 'Logged in successfully!',
|
||||
'login_user' => 'Logging in as a normal user...',
|
||||
'login_bot' => 'Logging in as a bot...',
|
||||
'login_code_sending' => 'Sending code...',
|
||||
'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.',
|
||||
'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first',
|
||||
'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...',
|
||||
'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...',
|
||||
'login_auth_key' => 'Logging in using auth key...',
|
||||
'not_logged_in' => 'I\'m not logged in!',
|
||||
'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!',
|
||||
'signing_up' => 'Signing up as a normal user...',
|
||||
'signup_ok' => 'Signed up in successfully!',
|
||||
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!',
|
||||
'getting_dialogs' => 'Getting dialogs...',
|
||||
'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.',
|
||||
'peer_not_in_db' => 'This peer is not present in the internal peer database',
|
||||
'calling_user' => 'Calling %s...',
|
||||
'generating_a' => 'Generating a...',
|
||||
'generating_g_a' => 'Generating g_a...',
|
||||
'call_error_1' => 'Could not find and accept call %s',
|
||||
'accepting_call' => 'Accepting call from %s...',
|
||||
'generating_b' => 'Generating b...',
|
||||
'call_already_accepted' => 'Call %s already accepted',
|
||||
'call_already_declined' => 'Call %s already declined',
|
||||
'call_error_2' => 'Could not find and confirm call %s',
|
||||
'call_confirming' => 'Confirming call from %s...',
|
||||
'call_error_3' => 'Could not find and complete call %s',
|
||||
'call_completing' => 'Completing call from %s...',
|
||||
'invalid_g_a' => 'Invalid g_a!',
|
||||
'fingerprint_invalid' => 'Invalid key fingerprint!',
|
||||
'call_discarding' => 'Discarding call %s...',
|
||||
'call_set_rating' => 'Setting rating for call %s...',
|
||||
'call_debug_saving' => 'Saving debug data for call %s...',
|
||||
'TL_loading' => 'Loading TL schemes...',
|
||||
'file_parsing' => 'Parsing %s...',
|
||||
'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s',
|
||||
'src_file_invalid' => 'Invalid source file was provided: ',
|
||||
'translating_obj' => 'Translating objects...',
|
||||
'translating_methods' => 'Translating methods...',
|
||||
'bool_error' => 'Could not extract boolean',
|
||||
'not_numeric' => 'Given value isn\'t numeric',
|
||||
'long_not_16' => 'Given value is not 16 bytes long',
|
||||
'long_not_32' => 'Given value is not 32 bytes long',
|
||||
'long_not_64' => 'Given value is not 64 bytes long',
|
||||
'array_invalid' => 'You didn\'t provide a valid array',
|
||||
'predicate_not_set' => 'Predicate (value under _) was not set!',
|
||||
'type_extract_error' => 'Could not extract type "%s"',
|
||||
'method_not_found' => 'Could not find method: ',
|
||||
'params_missing' => 'Missing required parameter',
|
||||
'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database',
|
||||
'stream_handle_invalid' => 'An invalid stream handle was provided.',
|
||||
'length_too_big' => 'Length is too big',
|
||||
'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string',
|
||||
'type_extract_error_id' => 'Could not extract type: %s with id %s',
|
||||
'vector_invalid' => 'Invalid vector constructor: ',
|
||||
'constructor_not_found' => 'Constructor not found for type: ',
|
||||
'rand_bytes_too_small' => 'random_bytes is too small!',
|
||||
'botapi_conversion_error' => 'Can\'t convert %s to a bot API object',
|
||||
'non_text_conversion' => 'Can\'t convert non text messages yet!',
|
||||
'last_byte_invalid' => 'Invalid last byte',
|
||||
'file_type_invalid' => 'Invalid file type detected (%s)',
|
||||
'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key',
|
||||
'resetting_auth_key' => 'WARNING: Resetting auth key...',
|
||||
'shutting_down_reader_pool' => 'Shutting down reader pool ',
|
||||
'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left',
|
||||
'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...',
|
||||
'fingerprint_mismatch' => 'Key fingerprint mismatch',
|
||||
'msg_data_length_too_big' => 'message_data_length is too big',
|
||||
'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16',
|
||||
'msg_key_mismatch' => 'msg_key mismatch',
|
||||
'rand_bytes_too_short' => 'random_bytes is too short!',
|
||||
'resending_unsupported' => 'Resending of messages is not yet supported',
|
||||
'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ',
|
||||
'method_req_pq' => '',
|
||||
'method_req_pq_param_nonce' => '',
|
||||
'method_req_pq_multi' => '',
|
||||
'method_req_pq_multi_param_nonce' => '',
|
||||
'method_req_DH_params' => '',
|
||||
'method_req_DH_params_param_nonce' => '',
|
||||
'method_req_DH_params_param_server_nonce' => '',
|
||||
'method_req_DH_params_param_p' => '',
|
||||
'method_req_DH_params_param_q' => '',
|
||||
'method_req_DH_params_param_public_key_fingerprint' => '',
|
||||
'method_req_DH_params_param_encrypted_data' => '',
|
||||
'method_set_client_DH_params' => '',
|
||||
'method_set_client_DH_params_param_nonce' => '',
|
||||
'method_set_client_DH_params_param_server_nonce' => '',
|
||||
'method_set_client_DH_params_param_encrypted_data' => '',
|
||||
'method_rpc_drop_answer' => '',
|
||||
'method_rpc_drop_answer_param_req_msg_id' => '',
|
||||
'method_get_future_salts' => '',
|
||||
'method_get_future_salts_param_num' => '',
|
||||
'method_ping' => '',
|
||||
'method_ping_param_ping_id' => '',
|
||||
'method_ping_delay_disconnect' => '',
|
||||
'method_ping_delay_disconnect_param_ping_id' => '',
|
||||
'value_bigger_than_4294967296' => 'Il valore fornito (%s) è maggiore di 4294967296',
|
||||
'value_smaller_than_0' => 'Il valore fornito (%s) è minore di 0',
|
||||
'encode_double_error' => 'Non sono riuscito a codificare il numero a virgola mobile fornito',
|
||||
'file_not_exist' => 'Il file specificato non esiste',
|
||||
'deserialization_error' => 'C\'è stato un errore durante la deserializzazione',
|
||||
'rsa_init' => 'Istanziamento di \\phpseclib\\Crypt\\RSA in corso...',
|
||||
'loading_key' => 'Caricamento della chiave in corso...',
|
||||
'computing_fingerprint' => 'Calcolo del fingerprint in corso...',
|
||||
'rsa_encrypting' => 'Criptando con chiave RSA...',
|
||||
'rpc_tg_error' => 'Telegram ha ritornato un errore RPC: %s (%s), causato da %s:%sTL trace:',
|
||||
'v_error' => '506572206661766f726520616767696f726e612071756573746120696e7374616c6c617a696f6e65206469204d6164656c696e6550726f746f20636f6e206769742070756c6c206520636f6d706f73657220757064617465',
|
||||
'v_tgerror' => '506572206661766f726520616767696f726e61207068702d6c69627467766f6970',
|
||||
'no_mode_specified' => 'Nessuna modalità di logging è stata specificata!',
|
||||
'constructor_function_uncalled' => 'Il metodo costruttore non è stato ancora chiamato! Per favore chiama il metodo costruttore prima di usare questo metodo.',
|
||||
'proxy_class_invalid' => 'È stata specificata una classe proxy errata!',
|
||||
'socket_con_error' => 'Connessione fallita.',
|
||||
'protocol_not_implemented' => 'Questo protocollo non è stato ancora implementato.',
|
||||
'protocol_invalid' => 'È stato fornito un protocollo non valido',
|
||||
'nothing_in_socket' => 'Non c\'è niente nel socket!',
|
||||
'wrong_length_read' => 'ATTENZIONE: Non sono stati letti abbastanza byte (dovevo leggere %s, ho letto %s)!',
|
||||
'no_data_in_socket' => 'Non ci sono dati nel socket!',
|
||||
'dc_con_start' => 'Connessione al DC %s in corso...',
|
||||
'dc_con_stop' => 'Disconnessione dal DC %s in corso...',
|
||||
'dc_con_test_start' => 'Connessione al DC %s (server %s, %s, %s)...',
|
||||
'script_not_exist' => 'Lo script fornito non esiste',
|
||||
'apifactory_start' => 'Sto avviando la fabbrica di API...',
|
||||
'madelineproto_ready' => 'MadelineProto è pronto!',
|
||||
'logout_error' => 'C\'è stato un errore durante il logout!',
|
||||
'logout_ok' => 'Il logout è stato eseguito correttamente!',
|
||||
'already_logged_in' => 'Questa istanza di MadelineProto è già loggata, prima faccio il logout...',
|
||||
'login_ok' => 'Il login è stato eseguito correttamente!',
|
||||
'login_user' => 'Sto eseguendo il login come utente normale...',
|
||||
'login_bot' => 'Sto eseguendo il login come bot...',
|
||||
'login_code_sending' => 'Sto inviando il codice...',
|
||||
'login_code_sent' => 'Il codice è stato inviato correttamente! Una volta ricevuto il codice dovrai usare la funzione complete_phone_login.',
|
||||
'login_code_uncalled' => 'Non sto aspettando il codice! Usa la funzione phone_login.',
|
||||
'login_2fa_enabled' => 'L\'autenticazione a due fattori è abilitata, dovrai chiamare il metodo complete_2fa_login...',
|
||||
'login_need_signup' => 'Questo numero non è registrato su telegram, dovrai chiamare la funzione complete_signup...',
|
||||
'login_auth_key' => 'Sto facendo il login con la chiave di autorizzazione...',
|
||||
'not_logged_in' => 'Non ho ancora fatto il login!',
|
||||
'signup_uncalled' => 'Chiama prima le funzioni phone_login e complete_phone_login.',
|
||||
'signing_up' => 'Mi sto registrando su telegram come utente normale...',
|
||||
'signup_ok' => 'Mi sono registrato su Telegram!',
|
||||
'2fa_uncalled' => 'Non sto aspettando la password, chiama prima le funzioni phone_login e complete_phone_login!',
|
||||
'getting_dialogs' => 'Sto ottenendo la lista delle chat...',
|
||||
'libtgvoip_required' => 'È necessario installare l\'estensione php-libtgvoip per accettare e gestire chiamate vocali, vistate https://docs.madelineproto.xyz per più info.',
|
||||
'peer_not_in_db' => 'Questo utente/gruppo/canale non è presente nel database interno MadelineProto',
|
||||
'calling_user' => 'Sto chiamando %s...',
|
||||
'generating_a' => 'Sto generando a...',
|
||||
'generating_g_a' => 'Sto generando g_a...',
|
||||
'call_error_1' => 'Impossibile trovare ed accettare la chiamata %s',
|
||||
'accepting_call' => 'Sto accettando una chiamata da %s...',
|
||||
'generating_b' => 'Sto generando b...',
|
||||
'call_already_accepted' => 'La chiamata %s è già stata accettata.',
|
||||
'call_already_declined' => 'La chiamata %s è già stata annullata.',
|
||||
'call_error_2' => 'Impossibile trovare e confermare la chiamata %s',
|
||||
'call_confirming' => 'Sto confermando una chiamata da %s',
|
||||
'call_error_3' => 'Impossibile trovare e completare la chiamata %s',
|
||||
'call_completing' => 'Sto completando una chiamata da %s...',
|
||||
'invalid_g_a' => 'g_a non valido!',
|
||||
'fingerprint_invalid' => 'fingerprint della chiave non valido!',
|
||||
'call_discarding' => 'Sto rifiutando la chiamata %s...',
|
||||
'call_set_rating' => 'Sto inviando la recensione della chiamata %s...',
|
||||
'call_debug_saving' => 'Sto inviando i dati di debug della chiamata %s...',
|
||||
'TL_loading' => 'Sto caricando gli schemi TL...',
|
||||
'file_parsing' => 'Leggendo %s...',
|
||||
'crc32_mismatch' => 'CRC32 non valido (%s diverso da %s) per %s',
|
||||
'src_file_invalid' => 'È stato fornito un file sorgente non valido: ',
|
||||
'translating_obj' => 'Traducendo gli oggetti...',
|
||||
'translating_methods' => 'Traducendo i metodi...',
|
||||
'bool_error' => 'Non sono riuscito ad estrarre un booleano',
|
||||
'not_numeric' => 'Il valore fornito non è numerico',
|
||||
'long_not_16' => 'Il valore fornito non è lungo 16 byte',
|
||||
'long_not_32' => 'Il valore fornito non è lungo 32 byte',
|
||||
'long_not_64' => 'Il valore fornito non è lungo 64 byte',
|
||||
'array_invalid' => 'Il valore fornito non è un array',
|
||||
'predicate_not_set' => 'Il predicato (valore sotto chiave _, esempio [\'_\' => \'inputPeer\']) non è impostato!',
|
||||
'type_extract_error' => 'Impossibile estrarre il tipo "%s"',
|
||||
'method_not_found' => 'Impossibile trovare il seguente metodo: ',
|
||||
'params_missing' => 'Non hai fornito un parametro obbligatorio, rileggi la documentazione API',
|
||||
'sec_peer_not_in_db' => 'La chat segreta non è presente nel database interno MadelineProto',
|
||||
'stream_handle_invalid' => 'Il valore fornito non è uno stream',
|
||||
'length_too_big' => 'Il valore fornito è troppo lungo',
|
||||
'deserialize_not_str' => 'Il valore generato non è una stringa',
|
||||
'type_extract_error_id' => 'Non sono riuscito ad estrarre il tipo %s con ID %s',
|
||||
'vector_invalid' => 'ID vettore non valido: ',
|
||||
'constructor_not_found' => 'Costruttore non trovato per tipo: ',
|
||||
'rand_bytes_too_small' => 'random_bytes è troppo corto!',
|
||||
'botapi_conversion_error' => 'NOn sono risucito a convertire %s in un oggetto bot API',
|
||||
'non_text_conversion' => 'Non posso ancora convertire messaggi media',
|
||||
'last_byte_invalid' => 'L\'ultimo byte non è valido',
|
||||
'file_type_invalid' => 'È stato fornito un tipo file errato',
|
||||
'recreate_temp_auth_key' => 'Sono stato costretto a rigenerare la chiave di autorizzazione temporanea',
|
||||
'resetting_auth_key' => 'ATTENZIONE: Sto resettando la chiave temporanea...',
|
||||
'shutting_down_reader_pool' => 'Chisura pool di lettura',
|
||||
'shutting_down_handler_pool' => 'Chiusura pool di gestione per DC %s, %d thread rimasti',
|
||||
'secret_chat_skipping' => 'Non ho la chat segreta %s nel database, ignorando messaggio',
|
||||
'fingerprint_mismatch' => 'Fingerprint della chiave non valido',
|
||||
'msg_data_length_too_big' => 'message_data_length è troppo grande',
|
||||
'length_not_divisible_16' => 'La lunghezza dei dati decifrati non è divisibile per 16',
|
||||
'msg_key_mismatch' => 'msg_key non valido',
|
||||
'rand_bytes_too_short' => 'random_bytes è troppo corto!',
|
||||
'resending_unsupported' => 'IL riinvio di messaggi non è ancora supportato',
|
||||
'unrecognized_dec_msg' => 'È stato ricevuto un messaggio decifrato sconosciuto: ',
|
||||
'serializing_madelineproto' => 'Sto serializzando MadelineProto...',
|
||||
'req_pq' => 'Sto richiedendo pq...',
|
||||
'done' => 'Fatto!',
|
||||
'cdn_reupload' => 'Il file non è disponibile sul nostro CDN, richiedo la copia!',
|
||||
'stored_on_cdn' => 'Il file è scaricabile tramite CDN!',
|
||||
],
|
||||
'en' => [
|
||||
'req_pq' => 'Requesting pq...',
|
||||
'done' => 'Done!',
|
||||
'cdn_reupload' => 'File is not stored on CDN, requesting reupload!',
|
||||
'stored_on_cdn' => 'File is stored on CDN!',
|
||||
'serializing_madelineproto' => 'Serializing MadelineProto...',
|
||||
'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib',
|
||||
'inst_dc' => 'Istantiating DataCenter...',
|
||||
'load_rsa' => 'Loading RSA keys...',
|
||||
'TL_translation' => 'Translating TL schemas...',
|
||||
'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...',
|
||||
'nearest_dc' => 'We\'re in %s, nearest DC is %d.',
|
||||
'serialization_ofd' => 'Serialization is out of date, reconstructing object!',
|
||||
'getupdates_deserialization' => 'Getting updates after deserialization...',
|
||||
'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left',
|
||||
'threading_on' => 'THREADING IS ENABLED',
|
||||
'socket_reader' => 'Socket reader on DC %s: ',
|
||||
'socket_status_1' => 'CREATING',
|
||||
'socket_status_2' => 'SUBMITTING',
|
||||
'socket_status_3' => 'WAITING',
|
||||
'socket_status_4' => 'READY',
|
||||
'socket_status_5' => 'WORKING',
|
||||
'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org',
|
||||
'session_corrupted' => 'The session is corrupted!',
|
||||
'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...',
|
||||
'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...',
|
||||
'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...',
|
||||
'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...',
|
||||
'write_client_info' => 'Writing client info (also executing %s)...',
|
||||
'config_updated' => 'Updated config!',
|
||||
'length_not_4' => 'Length is not equal to 4',
|
||||
'length_not_8' => 'Length is not equal to 8',
|
||||
'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647',
|
||||
'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648',
|
||||
'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807',
|
||||
'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808',
|
||||
'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296',
|
||||
'value_smaller_than_0' => 'Provided value %s is smaller than 0',
|
||||
'encode_double_error' => 'Could not properly encode double',
|
||||
'file_not_exist' => 'File does not exist',
|
||||
'deserialization_error' => 'An error occurred on deserialization',
|
||||
'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...',
|
||||
'loading_key' => 'Loading key...',
|
||||
'computing_fingerprint' => 'Computing fingerprint...',
|
||||
'rsa_encrypting' => 'Encrypting with rsa key...',
|
||||
'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:',
|
||||
'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e',
|
||||
'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970',
|
||||
'no_mode_specified' => 'No mode was specified!',
|
||||
'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.',
|
||||
'proxy_class_invalid' => 'Invalid proxy class provided!',
|
||||
'socket_con_error' => 'Connection: couldn\'t connect to socket.',
|
||||
'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.',
|
||||
'protocol_invalid' => 'Connection: invalid protocol specified.',
|
||||
'nothing_in_socket' => 'Nothing in the socket!',
|
||||
'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!',
|
||||
'no_data_in_socket' => 'No data in the socket!',
|
||||
'dc_con_start' => 'Connecting to DC %s...',
|
||||
'dc_con_stop' => 'Disconnecting from DC %s...',
|
||||
'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...',
|
||||
'script_not_exist' => 'Provided script does not exist',
|
||||
'apifactory_start' => 'Running APIFactory...',
|
||||
'madelineproto_ready' => 'MadelineProto is ready!',
|
||||
'logout_error' => 'An error occurred while logging out!',
|
||||
'logout_ok' => 'Logged out successfully!',
|
||||
'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...',
|
||||
'login_ok' => 'Logged in successfully!',
|
||||
'login_user' => 'Logging in as a normal user...',
|
||||
'login_bot' => 'Logging in as a bot...',
|
||||
'login_code_sending' => 'Sending code...',
|
||||
'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.',
|
||||
'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first',
|
||||
'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...',
|
||||
'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...',
|
||||
'login_auth_key' => 'Logging in using auth key...',
|
||||
'not_logged_in' => 'I\'m not logged in!',
|
||||
'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!',
|
||||
'signing_up' => 'Signing up as a normal user...',
|
||||
'signup_ok' => 'Signed up in successfully!',
|
||||
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!',
|
||||
'getting_dialogs' => 'Getting dialogs...',
|
||||
'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.',
|
||||
'peer_not_in_db' => 'This peer is not present in the internal peer database',
|
||||
'calling_user' => 'Calling %s...',
|
||||
'generating_a' => 'Generating a...',
|
||||
'generating_g_a' => 'Generating g_a...',
|
||||
'call_error_1' => 'Could not find and accept call %s',
|
||||
'accepting_call' => 'Accepting call from %s...',
|
||||
'generating_b' => 'Generating b...',
|
||||
'call_already_accepted' => 'Call %s already accepted',
|
||||
'call_already_declined' => 'Call %s already declined',
|
||||
'call_error_2' => 'Could not find and confirm call %s',
|
||||
'call_confirming' => 'Confirming call from %s...',
|
||||
'call_error_3' => 'Could not find and complete call %s',
|
||||
'call_completing' => 'Completing call from %s...',
|
||||
'invalid_g_a' => 'Invalid g_a!',
|
||||
'fingerprint_invalid' => 'Invalid key fingerprint!',
|
||||
'call_discarding' => 'Discarding call %s...',
|
||||
'call_set_rating' => 'Setting rating for call %s...',
|
||||
'call_debug_saving' => 'Saving debug data for call %s...',
|
||||
'TL_loading' => 'Loading TL schemes...',
|
||||
'file_parsing' => 'Parsing %s...',
|
||||
'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s',
|
||||
'src_file_invalid' => 'Invalid source file was provided: ',
|
||||
'translating_obj' => 'Translating objects...',
|
||||
'translating_methods' => 'Translating methods...',
|
||||
'bool_error' => 'Could not extract boolean',
|
||||
'not_numeric' => 'Given value isn\'t numeric',
|
||||
'long_not_16' => 'Given value is not 16 bytes long',
|
||||
'long_not_32' => 'Given value is not 32 bytes long',
|
||||
'long_not_64' => 'Given value is not 64 bytes long',
|
||||
'array_invalid' => 'You didn\'t provide a valid array',
|
||||
'predicate_not_set' => 'Predicate (value under _) was not set!',
|
||||
'type_extract_error' => 'Could not extract type "%s"',
|
||||
'method_not_found' => 'Could not find method: ',
|
||||
'params_missing' => 'Missing required parameter',
|
||||
'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database',
|
||||
'stream_handle_invalid' => 'An invalid stream handle was provided.',
|
||||
'length_too_big' => 'Length is too big',
|
||||
'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string',
|
||||
'type_extract_error_id' => 'Could not extract type: %s with id %s',
|
||||
'vector_invalid' => 'Invalid vector constructor: ',
|
||||
'constructor_not_found' => 'Constructor not found for type: ',
|
||||
'rand_bytes_too_small' => 'random_bytes is too small!',
|
||||
'botapi_conversion_error' => 'Can\'t convert %s to a bot API object',
|
||||
'non_text_conversion' => 'Can\'t convert non text messages yet!',
|
||||
'last_byte_invalid' => 'Invalid last byte',
|
||||
'file_type_invalid' => 'Invalid file type detected (%s)',
|
||||
'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key',
|
||||
'resetting_auth_key' => 'WARNING: Resetting auth key...',
|
||||
'shutting_down_reader_pool' => 'Shutting down reader pool ',
|
||||
'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left',
|
||||
'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...',
|
||||
'fingerprint_mismatch' => 'Key fingerprint mismatch',
|
||||
'msg_data_length_too_big' => 'message_data_length is too big',
|
||||
'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16',
|
||||
'msg_key_mismatch' => 'msg_key mismatch',
|
||||
'rand_bytes_too_short' => 'random_bytes is too short!',
|
||||
'resending_unsupported' => 'Resending of messages is not yet supported',
|
||||
'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ',
|
||||
'method_req_pq' => '',
|
||||
'method_req_pq_param_nonce' => '',
|
||||
'method_req_pq_multi' => '',
|
||||
'method_req_pq_multi_param_nonce' => '',
|
||||
'method_req_DH_params' => '',
|
||||
'method_req_DH_params_param_nonce' => '',
|
||||
'method_req_DH_params_param_server_nonce' => '',
|
||||
'method_req_DH_params_param_p' => '',
|
||||
'method_req_DH_params_param_q' => '',
|
||||
'method_req_DH_params_param_public_key_fingerprint' => '',
|
||||
'method_req_DH_params_param_encrypted_data' => '',
|
||||
'method_set_client_DH_params' => '',
|
||||
'method_set_client_DH_params_param_nonce' => '',
|
||||
'method_set_client_DH_params_param_server_nonce' => '',
|
||||
'method_set_client_DH_params_param_encrypted_data' => '',
|
||||
'method_rpc_drop_answer' => '',
|
||||
'method_rpc_drop_answer_param_req_msg_id' => '',
|
||||
'method_get_future_salts' => '',
|
||||
'method_get_future_salts_param_num' => '',
|
||||
'method_ping' => '',
|
||||
'method_ping_param_ping_id' => '',
|
||||
'method_ping_delay_disconnect' => '',
|
||||
'method_ping_delay_disconnect_param_ping_id' => '',
|
||||
'method_ping_delay_disconnect_param_disconnect_delay' => '',
|
||||
'method_destroy_session' => '',
|
||||
'method_destroy_session_param_session_id' => '',
|
||||
'method_http_wait' => '',
|
||||
'method_http_wait_param_max_delay' => '',
|
||||
'method_http_wait_param_wait_after' => '',
|
||||
'method_http_wait_param_max_wait' => '',
|
||||
),
|
||||
);
|
||||
|
||||
'method_destroy_session' => '',
|
||||
'method_destroy_session_param_session_id' => '',
|
||||
'method_http_wait' => '',
|
||||
'method_http_wait_param_max_delay' => '',
|
||||
'method_http_wait_param_wait_after' => '',
|
||||
'method_http_wait_param_max_wait' => '',
|
||||
],
|
||||
];
|
||||
|
||||
// THIS WILL BE OVERWRITTEN BY $lang["en"]
|
||||
public static $current_lang = array (
|
||||
'req_pq' => 'Requesting pq...',
|
||||
'done' => 'Done!',
|
||||
'cdn_reupload' => 'File is not stored on CDN, requesting reupload!',
|
||||
'stored_on_cdn' => 'File is stored on CDN!',
|
||||
'serializing_madelineproto' => 'Serializing MadelineProto...',
|
||||
'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib',
|
||||
'inst_dc' => 'Istantiating DataCenter...',
|
||||
'load_rsa' => 'Loading RSA keys...',
|
||||
'TL_translation' => 'Translating TL schemas...',
|
||||
'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...',
|
||||
'nearest_dc' => 'We\'re in %s, nearest DC is %d.',
|
||||
'serialization_ofd' => 'Serialization is out of date, reconstructing object!',
|
||||
'getupdates_deserialization' => 'Getting updates after deserialization...',
|
||||
'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left',
|
||||
'threading_on' => 'THREADING IS ENABLED',
|
||||
'socket_reader' => 'Socket reader on DC %s: ',
|
||||
'socket_status_1' => 'CREATING',
|
||||
'socket_status_2' => 'SUBMITTING',
|
||||
'socket_status_3' => 'WAITING',
|
||||
'socket_status_4' => 'READY',
|
||||
'socket_status_5' => 'WORKING',
|
||||
'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org',
|
||||
'session_corrupted' => 'The session is corrupted!',
|
||||
'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...',
|
||||
'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...',
|
||||
'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...',
|
||||
'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...',
|
||||
'write_client_info' => 'Writing client info (also executing %s)...',
|
||||
'config_updated' => 'Updated config!',
|
||||
'length_not_4' => 'Length is not equal to 4',
|
||||
'length_not_8' => 'Length is not equal to 8',
|
||||
'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647',
|
||||
'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648',
|
||||
'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807',
|
||||
'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808',
|
||||
'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296',
|
||||
'value_smaller_than_0' => 'Provided value %s is smaller than 0',
|
||||
'encode_double_error' => 'Could not properly encode double',
|
||||
'file_not_exist' => 'File does not exist',
|
||||
'deserialization_error' => 'An error occurred on deserialization',
|
||||
'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...',
|
||||
'loading_key' => 'Loading key...',
|
||||
'computing_fingerprint' => 'Computing fingerprint...',
|
||||
'rsa_encrypting' => 'Encrypting with rsa key...',
|
||||
'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:',
|
||||
'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e',
|
||||
'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970',
|
||||
'no_mode_specified' => 'No mode was specified!',
|
||||
'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.',
|
||||
'proxy_class_invalid' => 'Invalid proxy class provided!',
|
||||
'socket_con_error' => 'Connection: couldn\'t connect to socket.',
|
||||
'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.',
|
||||
'protocol_invalid' => 'Connection: invalid protocol specified.',
|
||||
'nothing_in_socket' => 'Nothing in the socket!',
|
||||
'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!',
|
||||
'no_data_in_socket' => 'No data in the socket!',
|
||||
'dc_con_start' => 'Connecting to DC %s...',
|
||||
'dc_con_stop' => 'Disconnecting from DC %s...',
|
||||
'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...',
|
||||
'script_not_exist' => 'Provided script does not exist',
|
||||
'apifactory_start' => 'Running APIFactory...',
|
||||
'madelineproto_ready' => 'MadelineProto is ready!',
|
||||
'logout_error' => 'An error occurred while logging out!',
|
||||
'logout_ok' => 'Logged out successfully!',
|
||||
'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...',
|
||||
'login_ok' => 'Logged in successfully!',
|
||||
'login_user' => 'Logging in as a normal user...',
|
||||
'login_bot' => 'Logging in as a bot...',
|
||||
'login_code_sending' => 'Sending code...',
|
||||
'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.',
|
||||
'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first',
|
||||
'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...',
|
||||
'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...',
|
||||
'login_auth_key' => 'Logging in using auth key...',
|
||||
'not_logged_in' => 'I\'m not logged in!',
|
||||
'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!',
|
||||
'signing_up' => 'Signing up as a normal user...',
|
||||
'signup_ok' => 'Signed up in successfully!',
|
||||
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!',
|
||||
'getting_dialogs' => 'Getting dialogs...',
|
||||
'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.',
|
||||
'peer_not_in_db' => 'This peer is not present in the internal peer database',
|
||||
'calling_user' => 'Calling %s...',
|
||||
'generating_a' => 'Generating a...',
|
||||
'generating_g_a' => 'Generating g_a...',
|
||||
'call_error_1' => 'Could not find and accept call %s',
|
||||
'accepting_call' => 'Accepting call from %s...',
|
||||
'generating_b' => 'Generating b...',
|
||||
'call_already_accepted' => 'Call %s already accepted',
|
||||
'call_already_declined' => 'Call %s already declined',
|
||||
'call_error_2' => 'Could not find and confirm call %s',
|
||||
'call_confirming' => 'Confirming call from %s...',
|
||||
'call_error_3' => 'Could not find and complete call %s',
|
||||
'call_completing' => 'Completing call from %s...',
|
||||
'invalid_g_a' => 'Invalid g_a!',
|
||||
'fingerprint_invalid' => 'Invalid key fingerprint!',
|
||||
'call_discarding' => 'Discarding call %s...',
|
||||
'call_set_rating' => 'Setting rating for call %s...',
|
||||
'call_debug_saving' => 'Saving debug data for call %s...',
|
||||
'TL_loading' => 'Loading TL schemes...',
|
||||
'file_parsing' => 'Parsing %s...',
|
||||
'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s',
|
||||
'src_file_invalid' => 'Invalid source file was provided: ',
|
||||
'translating_obj' => 'Translating objects...',
|
||||
'translating_methods' => 'Translating methods...',
|
||||
'bool_error' => 'Could not extract boolean',
|
||||
'not_numeric' => 'Given value isn\'t numeric',
|
||||
'long_not_16' => 'Given value is not 16 bytes long',
|
||||
'long_not_32' => 'Given value is not 32 bytes long',
|
||||
'long_not_64' => 'Given value is not 64 bytes long',
|
||||
'array_invalid' => 'You didn\'t provide a valid array',
|
||||
'predicate_not_set' => 'Predicate (value under _) was not set!',
|
||||
'type_extract_error' => 'Could not extract type "%s"',
|
||||
'method_not_found' => 'Could not find method: ',
|
||||
'params_missing' => 'Missing required parameter',
|
||||
'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database',
|
||||
'stream_handle_invalid' => 'An invalid stream handle was provided.',
|
||||
'length_too_big' => 'Length is too big',
|
||||
'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string',
|
||||
'type_extract_error_id' => 'Could not extract type: %s with id %s',
|
||||
'vector_invalid' => 'Invalid vector constructor: ',
|
||||
'constructor_not_found' => 'Constructor not found for type: ',
|
||||
'rand_bytes_too_small' => 'random_bytes is too small!',
|
||||
'botapi_conversion_error' => 'Can\'t convert %s to a bot API object',
|
||||
'non_text_conversion' => 'Can\'t convert non text messages yet!',
|
||||
'last_byte_invalid' => 'Invalid last byte',
|
||||
'file_type_invalid' => 'Invalid file type detected (%s)',
|
||||
'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key',
|
||||
'resetting_auth_key' => 'WARNING: Resetting auth key...',
|
||||
'shutting_down_reader_pool' => 'Shutting down reader pool ',
|
||||
'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left',
|
||||
'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...',
|
||||
'fingerprint_mismatch' => 'Key fingerprint mismatch',
|
||||
'msg_data_length_too_big' => 'message_data_length is too big',
|
||||
'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16',
|
||||
'msg_key_mismatch' => 'msg_key mismatch',
|
||||
'rand_bytes_too_short' => 'random_bytes is too short!',
|
||||
'resending_unsupported' => 'Resending of messages is not yet supported',
|
||||
'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ',
|
||||
'method_req_pq' => '',
|
||||
'method_req_pq_param_nonce' => '',
|
||||
'method_req_pq_multi' => '',
|
||||
'method_req_pq_multi_param_nonce' => '',
|
||||
'method_req_DH_params' => '',
|
||||
'method_req_DH_params_param_nonce' => '',
|
||||
'method_req_DH_params_param_server_nonce' => '',
|
||||
'method_req_DH_params_param_p' => '',
|
||||
'method_req_DH_params_param_q' => '',
|
||||
'method_req_DH_params_param_public_key_fingerprint' => '',
|
||||
'method_req_DH_params_param_encrypted_data' => '',
|
||||
'method_set_client_DH_params' => '',
|
||||
'method_set_client_DH_params_param_nonce' => '',
|
||||
'method_set_client_DH_params_param_server_nonce' => '',
|
||||
'method_set_client_DH_params_param_encrypted_data' => '',
|
||||
'method_rpc_drop_answer' => '',
|
||||
'method_rpc_drop_answer_param_req_msg_id' => '',
|
||||
'method_get_future_salts' => '',
|
||||
'method_get_future_salts_param_num' => '',
|
||||
'method_ping' => '',
|
||||
'method_ping_param_ping_id' => '',
|
||||
'method_ping_delay_disconnect' => '',
|
||||
'method_ping_delay_disconnect_param_ping_id' => '',
|
||||
public static $current_lang = [
|
||||
'req_pq' => 'Requesting pq...',
|
||||
'done' => 'Done!',
|
||||
'cdn_reupload' => 'File is not stored on CDN, requesting reupload!',
|
||||
'stored_on_cdn' => 'File is stored on CDN!',
|
||||
'serializing_madelineproto' => 'Serializing MadelineProto...',
|
||||
'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib',
|
||||
'inst_dc' => 'Istantiating DataCenter...',
|
||||
'load_rsa' => 'Loading RSA keys...',
|
||||
'TL_translation' => 'Translating TL schemas...',
|
||||
'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...',
|
||||
'nearest_dc' => 'We\'re in %s, nearest DC is %d.',
|
||||
'serialization_ofd' => 'Serialization is out of date, reconstructing object!',
|
||||
'getupdates_deserialization' => 'Getting updates after deserialization...',
|
||||
'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left',
|
||||
'threading_on' => 'THREADING IS ENABLED',
|
||||
'socket_reader' => 'Socket reader on DC %s: ',
|
||||
'socket_status_1' => 'CREATING',
|
||||
'socket_status_2' => 'SUBMITTING',
|
||||
'socket_status_3' => 'WAITING',
|
||||
'socket_status_4' => 'READY',
|
||||
'socket_status_5' => 'WORKING',
|
||||
'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org',
|
||||
'session_corrupted' => 'The session is corrupted!',
|
||||
'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...',
|
||||
'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...',
|
||||
'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...',
|
||||
'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...',
|
||||
'write_client_info' => 'Writing client info (also executing %s)...',
|
||||
'config_updated' => 'Updated config!',
|
||||
'length_not_4' => 'Length is not equal to 4',
|
||||
'length_not_8' => 'Length is not equal to 8',
|
||||
'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647',
|
||||
'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648',
|
||||
'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807',
|
||||
'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808',
|
||||
'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296',
|
||||
'value_smaller_than_0' => 'Provided value %s is smaller than 0',
|
||||
'encode_double_error' => 'Could not properly encode double',
|
||||
'file_not_exist' => 'File does not exist',
|
||||
'deserialization_error' => 'An error occurred on deserialization',
|
||||
'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...',
|
||||
'loading_key' => 'Loading key...',
|
||||
'computing_fingerprint' => 'Computing fingerprint...',
|
||||
'rsa_encrypting' => 'Encrypting with rsa key...',
|
||||
'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:',
|
||||
'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e',
|
||||
'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970',
|
||||
'no_mode_specified' => 'No mode was specified!',
|
||||
'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.',
|
||||
'proxy_class_invalid' => 'Invalid proxy class provided!',
|
||||
'socket_con_error' => 'Connection: couldn\'t connect to socket.',
|
||||
'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.',
|
||||
'protocol_invalid' => 'Connection: invalid protocol specified.',
|
||||
'nothing_in_socket' => 'Nothing in the socket!',
|
||||
'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!',
|
||||
'no_data_in_socket' => 'No data in the socket!',
|
||||
'dc_con_start' => 'Connecting to DC %s...',
|
||||
'dc_con_stop' => 'Disconnecting from DC %s...',
|
||||
'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...',
|
||||
'script_not_exist' => 'Provided script does not exist',
|
||||
'apifactory_start' => 'Running APIFactory...',
|
||||
'madelineproto_ready' => 'MadelineProto is ready!',
|
||||
'logout_error' => 'An error occurred while logging out!',
|
||||
'logout_ok' => 'Logged out successfully!',
|
||||
'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...',
|
||||
'login_ok' => 'Logged in successfully!',
|
||||
'login_user' => 'Logging in as a normal user...',
|
||||
'login_bot' => 'Logging in as a bot...',
|
||||
'login_code_sending' => 'Sending code...',
|
||||
'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.',
|
||||
'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first',
|
||||
'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...',
|
||||
'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...',
|
||||
'login_auth_key' => 'Logging in using auth key...',
|
||||
'not_logged_in' => 'I\'m not logged in!',
|
||||
'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!',
|
||||
'signing_up' => 'Signing up as a normal user...',
|
||||
'signup_ok' => 'Signed up in successfully!',
|
||||
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!',
|
||||
'getting_dialogs' => 'Getting dialogs...',
|
||||
'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.',
|
||||
'peer_not_in_db' => 'This peer is not present in the internal peer database',
|
||||
'calling_user' => 'Calling %s...',
|
||||
'generating_a' => 'Generating a...',
|
||||
'generating_g_a' => 'Generating g_a...',
|
||||
'call_error_1' => 'Could not find and accept call %s',
|
||||
'accepting_call' => 'Accepting call from %s...',
|
||||
'generating_b' => 'Generating b...',
|
||||
'call_already_accepted' => 'Call %s already accepted',
|
||||
'call_already_declined' => 'Call %s already declined',
|
||||
'call_error_2' => 'Could not find and confirm call %s',
|
||||
'call_confirming' => 'Confirming call from %s...',
|
||||
'call_error_3' => 'Could not find and complete call %s',
|
||||
'call_completing' => 'Completing call from %s...',
|
||||
'invalid_g_a' => 'Invalid g_a!',
|
||||
'fingerprint_invalid' => 'Invalid key fingerprint!',
|
||||
'call_discarding' => 'Discarding call %s...',
|
||||
'call_set_rating' => 'Setting rating for call %s...',
|
||||
'call_debug_saving' => 'Saving debug data for call %s...',
|
||||
'TL_loading' => 'Loading TL schemes...',
|
||||
'file_parsing' => 'Parsing %s...',
|
||||
'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s',
|
||||
'src_file_invalid' => 'Invalid source file was provided: ',
|
||||
'translating_obj' => 'Translating objects...',
|
||||
'translating_methods' => 'Translating methods...',
|
||||
'bool_error' => 'Could not extract boolean',
|
||||
'not_numeric' => 'Given value isn\'t numeric',
|
||||
'long_not_16' => 'Given value is not 16 bytes long',
|
||||
'long_not_32' => 'Given value is not 32 bytes long',
|
||||
'long_not_64' => 'Given value is not 64 bytes long',
|
||||
'array_invalid' => 'You didn\'t provide a valid array',
|
||||
'predicate_not_set' => 'Predicate (value under _) was not set!',
|
||||
'type_extract_error' => 'Could not extract type "%s"',
|
||||
'method_not_found' => 'Could not find method: ',
|
||||
'params_missing' => 'Missing required parameter',
|
||||
'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database',
|
||||
'stream_handle_invalid' => 'An invalid stream handle was provided.',
|
||||
'length_too_big' => 'Length is too big',
|
||||
'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string',
|
||||
'type_extract_error_id' => 'Could not extract type: %s with id %s',
|
||||
'vector_invalid' => 'Invalid vector constructor: ',
|
||||
'constructor_not_found' => 'Constructor not found for type: ',
|
||||
'rand_bytes_too_small' => 'random_bytes is too small!',
|
||||
'botapi_conversion_error' => 'Can\'t convert %s to a bot API object',
|
||||
'non_text_conversion' => 'Can\'t convert non text messages yet!',
|
||||
'last_byte_invalid' => 'Invalid last byte',
|
||||
'file_type_invalid' => 'Invalid file type detected (%s)',
|
||||
'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key',
|
||||
'resetting_auth_key' => 'WARNING: Resetting auth key...',
|
||||
'shutting_down_reader_pool' => 'Shutting down reader pool ',
|
||||
'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left',
|
||||
'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...',
|
||||
'fingerprint_mismatch' => 'Key fingerprint mismatch',
|
||||
'msg_data_length_too_big' => 'message_data_length is too big',
|
||||
'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16',
|
||||
'msg_key_mismatch' => 'msg_key mismatch',
|
||||
'rand_bytes_too_short' => 'random_bytes is too short!',
|
||||
'resending_unsupported' => 'Resending of messages is not yet supported',
|
||||
'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ',
|
||||
'method_req_pq' => '',
|
||||
'method_req_pq_param_nonce' => '',
|
||||
'method_req_pq_multi' => '',
|
||||
'method_req_pq_multi_param_nonce' => '',
|
||||
'method_req_DH_params' => '',
|
||||
'method_req_DH_params_param_nonce' => '',
|
||||
'method_req_DH_params_param_server_nonce' => '',
|
||||
'method_req_DH_params_param_p' => '',
|
||||
'method_req_DH_params_param_q' => '',
|
||||
'method_req_DH_params_param_public_key_fingerprint' => '',
|
||||
'method_req_DH_params_param_encrypted_data' => '',
|
||||
'method_set_client_DH_params' => '',
|
||||
'method_set_client_DH_params_param_nonce' => '',
|
||||
'method_set_client_DH_params_param_server_nonce' => '',
|
||||
'method_set_client_DH_params_param_encrypted_data' => '',
|
||||
'method_rpc_drop_answer' => '',
|
||||
'method_rpc_drop_answer_param_req_msg_id' => '',
|
||||
'method_get_future_salts' => '',
|
||||
'method_get_future_salts_param_num' => '',
|
||||
'method_ping' => '',
|
||||
'method_ping_param_ping_id' => '',
|
||||
'method_ping_delay_disconnect' => '',
|
||||
'method_ping_delay_disconnect_param_ping_id' => '',
|
||||
'method_ping_delay_disconnect_param_disconnect_delay' => '',
|
||||
'method_destroy_session' => '',
|
||||
'method_destroy_session_param_session_id' => '',
|
||||
'method_http_wait' => '',
|
||||
'method_http_wait_param_max_delay' => '',
|
||||
'method_http_wait_param_wait_after' => '',
|
||||
'method_http_wait_param_max_wait' => '',
|
||||
);
|
||||
}
|
||||
'method_destroy_session' => '',
|
||||
'method_destroy_session_param_session_id' => '',
|
||||
'method_http_wait' => '',
|
||||
'method_http_wait_param_max_delay' => '',
|
||||
'method_http_wait_param_wait_after' => '',
|
||||
'method_http_wait_param_max_wait' => '',
|
||||
];
|
||||
}
|
||||
|
@ -2,10 +2,9 @@
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$MadelineProto = new \danog\MadelineProto\API('session.madeline');//, ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']]);
|
||||
$MadelineProto = new \danog\MadelineProto\API('session.madeline'); //, ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']]);
|
||||
$me = $MadelineProto->start();
|
||||
|
||||
|
||||
$me = $MadelineProto->get_self();
|
||||
|
||||
\danog\MadelineProto\Logger::log($me);
|
||||
|
@ -12,7 +12,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/'));
|
||||
|
||||
/**
|
||||
/*
|
||||
* Various ways to load MadelineProto
|
||||
*/
|
||||
if (!file_exists(__DIR__.'/vendor/autoload.php')) {
|
||||
@ -31,6 +31,7 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
{
|
||||
$this->onUpdateNewMessage($update);
|
||||
}
|
||||
|
||||
public function onUpdateNewMessage($update)
|
||||
{
|
||||
if (isset($update['message']['out']) && $update['message']['out']) {
|
||||
@ -59,7 +60,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e'], 'updates' => ['handle_updates' => true]]; //, 'connection_settings' => ['all' => ['test_mode' => true]]];
|
||||
|
||||
try {
|
||||
|
@ -12,7 +12,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/'));
|
||||
|
||||
/**
|
||||
/*
|
||||
* Various ways to load MadelineProto
|
||||
*/
|
||||
if (!file_exists(__DIR__.'/vendor/autoload.php')) {
|
||||
@ -25,20 +25,23 @@ if (!file_exists(__DIR__.'/vendor/autoload.php')) {
|
||||
require_once 'vendor/autoload.php';
|
||||
}
|
||||
|
||||
|
||||
class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
{
|
||||
private $sent = [-440592694 => true];
|
||||
public function onUpdateNewEncryptedMessage($update) {
|
||||
|
||||
public function onUpdateNewEncryptedMessage($update)
|
||||
{
|
||||
try {
|
||||
if (isset($update['message']['decrypted_message']['media'])) \danog\MadelineProto\Logger::log($this->download_to_dir($update, '.'));
|
||||
if (isset($update['message']['decrypted_message']['media'])) {
|
||||
\danog\MadelineProto\Logger::log($this->download_to_dir($update, '.'));
|
||||
}
|
||||
if (isset($this->sent[$update['message']['chat_id']])) {
|
||||
return;
|
||||
}
|
||||
$secret_media = [];
|
||||
|
||||
// Photo uploaded as document, secret chat
|
||||
|
||||
|
||||
$inputEncryptedFile = $this->upload_encrypted('tests/faust.jpg', 'fausticorn.jpg'); // This gets an inputFile object with file name magic
|
||||
$secret_media['document_photo'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/faust.jpg'), 'caption' => 'This file was uploaded using MadelineProto', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'faust.jpg', 'size' => filesize('tests/faust.jpg'), 'attributes' => [['_' => 'documentAttributeImageSize', 'w' => 1280, 'h' => 914]]]]];
|
||||
|
||||
@ -87,9 +90,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (file_exists('.env')) {
|
||||
echo 'Loading .env...'.PHP_EOL;
|
||||
$dotenv = new Dotenv\Dotenv(getcwd());
|
||||
@ -99,7 +99,6 @@ if (file_exists('.env')) {
|
||||
echo 'Loading settings...'.PHP_EOL;
|
||||
$settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];
|
||||
|
||||
|
||||
try {
|
||||
$MadelineProto = new \danog\MadelineProto\API('s.madeline', $settings);
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
@ -109,4 +108,4 @@ try {
|
||||
}
|
||||
$MadelineProto->start();
|
||||
$MadelineProto->setEventHandler('\EventHandler');
|
||||
$MadelineProto->loop();
|
||||
$MadelineProto->loop();
|
||||
|
@ -10,7 +10,6 @@ You should have received a copy of the GNU General Public License along with Mad
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
class HttpProxy implements \danog\MadelineProto\Proxy
|
||||
{
|
||||
private $domain;
|
||||
@ -18,7 +17,9 @@ class HttpProxy implements \danog\MadelineProto\Proxy
|
||||
private $protocol;
|
||||
private $extra;
|
||||
private $sock;
|
||||
public function __construct($domain, $type, $protocol) {
|
||||
|
||||
public function __construct($domain, $type, $protocol)
|
||||
{
|
||||
if (!in_array($domain, [AF_INET, AF_INET6])) {
|
||||
throw new \danog\MadelineProto\Exception('Wrong protocol family provided');
|
||||
}
|
||||
@ -32,41 +33,53 @@ class HttpProxy implements \danog\MadelineProto\Proxy
|
||||
$this->type = $type;
|
||||
$this->protocol = $protocol;
|
||||
}
|
||||
public function setExtra(array $extra = []) {
|
||||
|
||||
public function setExtra(array $extra = [])
|
||||
{
|
||||
$this->extra = $extra;
|
||||
$name = $this->protocol === PHP_INT_MAX ? '\\FSocket' : '\\Socket';
|
||||
$this->sock = new $name(strlen(@inet_pton($this->extra['address'])) !== 4 ? \AF_INET6 : \AF_INET, \SOCK_STREAM, $this->protocol);
|
||||
}
|
||||
public function setOption($level, $name, $value) {
|
||||
|
||||
public function setOption($level, $name, $value)
|
||||
{
|
||||
return $this->sock->setOption($level, $name, $value);
|
||||
}
|
||||
|
||||
public function getOption($level, $name) {
|
||||
public function getOption($level, $name)
|
||||
{
|
||||
return $this->sock->getOption($level, $name);
|
||||
}
|
||||
|
||||
public function setBlocking($blocking) {
|
||||
public function setBlocking($blocking)
|
||||
{
|
||||
return $this->sock->setBlocking($blocking);
|
||||
}
|
||||
|
||||
public function bind($address, $port = 0) {
|
||||
public function bind($address, $port = 0)
|
||||
{
|
||||
throw new \danog\MadelineProto\Exception('Not Implemented');
|
||||
}
|
||||
|
||||
public function listen($backlog = 0) {
|
||||
throw new \danog\MadelineProto\Exception('Not Implemented');
|
||||
}
|
||||
public function accept() {
|
||||
public function listen($backlog = 0)
|
||||
{
|
||||
throw new \danog\MadelineProto\Exception('Not Implemented');
|
||||
}
|
||||
|
||||
|
||||
public function select(array &$read, array &$write, array &$except, $tv_sec, $tv_usec = 0) {
|
||||
public function accept()
|
||||
{
|
||||
throw new \danog\MadelineProto\Exception('Not Implemented');
|
||||
}
|
||||
public function connect($address, $port = 0) {
|
||||
|
||||
public function select(array &$read, array &$write, array &$except, $tv_sec, $tv_usec = 0)
|
||||
{
|
||||
throw new \danog\MadelineProto\Exception('Not Implemented');
|
||||
}
|
||||
|
||||
public function connect($address, $port = 0)
|
||||
{
|
||||
$this->sock->connect($this->extra['address'], $this->extra['port']);
|
||||
|
||||
|
||||
try {
|
||||
if (strlen(inet_pton($address)) !== 4) {
|
||||
$address = '['.$address.']';
|
||||
@ -77,12 +90,16 @@ class HttpProxy implements \danog\MadelineProto\Proxy
|
||||
$response = $this->read_http_payload();
|
||||
if ($response['code'] !== 200) {
|
||||
\danog\MadelineProto\Logger::log(trim($response['body']));
|
||||
|
||||
throw new \danog\MadelineProto\Exception($response['description'], $response['code']);
|
||||
}
|
||||
\danog\MadelineProto\Logger::log('Connected to '.$address.':'.$port.' via http');
|
||||
|
||||
return true;
|
||||
}
|
||||
private function http_read($length) {
|
||||
|
||||
private function http_read($length)
|
||||
{
|
||||
$packet = '';
|
||||
while (strlen($packet) < $length) {
|
||||
$packet .= $this->sock->read($length - strlen($packet));
|
||||
@ -90,8 +107,10 @@ class HttpProxy implements \danog\MadelineProto\Proxy
|
||||
throw new \danog\MadelineProto\NothingInTheSocketException(\danog\MadelineProto\Lang::$current_lang['nothing_in_socket']);
|
||||
}
|
||||
}
|
||||
|
||||
return $packet;
|
||||
}
|
||||
|
||||
public function read_http_line()
|
||||
{
|
||||
$line = '';
|
||||
@ -127,35 +146,43 @@ class HttpProxy implements \danog\MadelineProto\Proxy
|
||||
|
||||
return ['protocol' => $protocol, 'code' => $code, 'description' => $description, 'body' => $read, 'headers' => $headers];
|
||||
}
|
||||
|
||||
public function read($length, $flags = 0) {
|
||||
|
||||
public function read($length, $flags = 0)
|
||||
{
|
||||
$read = $this->sock->read($length, $flags);
|
||||
if ($read === 0) {
|
||||
throw new \danog\MadelineProto\Exception('pls reconnect');
|
||||
}
|
||||
|
||||
return $read;
|
||||
}
|
||||
|
||||
public function write($buffer, $length = -1) {
|
||||
public function write($buffer, $length = -1)
|
||||
{
|
||||
return $this->sock->write($buffer, $length);
|
||||
}
|
||||
|
||||
public function send($data, $length, $flags) {
|
||||
public function send($data, $length, $flags)
|
||||
{
|
||||
throw new \danog\MadelineProto\Exception('Not Implemented');
|
||||
}
|
||||
|
||||
public function close() {
|
||||
public function close()
|
||||
{
|
||||
$this->sock->close();
|
||||
}
|
||||
|
||||
public function getPeerName($port = true) {
|
||||
public function getPeerName($port = true)
|
||||
{
|
||||
throw new \danog\MadelineProto\Exception('Not Implemented');
|
||||
}
|
||||
|
||||
public function getSockName($port = true) {
|
||||
public function getSockName($port = true)
|
||||
{
|
||||
throw new \danog\MadelineProto\Exception('Not Implemented');
|
||||
}
|
||||
public function getProxyHeaders() {
|
||||
|
||||
|
||||
public function getProxyHeaders()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ class API extends APIFactory
|
||||
if (isset($unserialized->API)) {
|
||||
$this->API = $unserialized->API;
|
||||
$this->APIFactory();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -178,6 +179,7 @@ class API extends APIFactory
|
||||
if (is_null($this->session)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Serialization::serialize($params, $this);
|
||||
}
|
||||
}
|
||||
|
@ -572,6 +572,7 @@ Any json-encodable data.
|
||||
');
|
||||
\danog\MadelineProto\Logger::log('Done!', \danog\MadelineProto\Logger::NOTICE);
|
||||
}
|
||||
|
||||
public $template = '<?php
|
||||
/*
|
||||
Copyright 2016-2018 Daniil Gentili
|
||||
@ -593,12 +594,12 @@ class Lang
|
||||
// THIS WILL BE OVERWRITTEN BY $lang["en"]
|
||||
public static $current_lang = %s;
|
||||
}';
|
||||
|
||||
public function add_to_lang($key) {
|
||||
|
||||
public function add_to_lang($key)
|
||||
{
|
||||
if (!isset(\danog\MadelineProto\Lang::$lang['en'][$key])) {
|
||||
\danog\MadelineProto\Lang::$lang['en'][$key] = '';
|
||||
file_put_contents(__DIR__.'/Lang.php', sprintf($this->template, var_export(\danog\MadelineProto\Lang::$lang, true), var_export(\danog\MadelineProto\Lang::$lang['en'], true)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -130,22 +130,22 @@ trait Constructors
|
||||
$ptype = 'Bool';
|
||||
}
|
||||
$human_ptype = $ptype;
|
||||
if (strpos($type, 'Input') === 0 && in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer'])&& !isset($this->settings['td'])) {
|
||||
if (strpos($type, 'Input') === 0 && in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'Username, chat ID, Update, Message or '.$ptype;
|
||||
}
|
||||
if (strpos($type, 'Input') === 0 && in_array($ptype, ['InputMedia', 'InputDocument', 'InputPhoto'])&& !isset($this->settings['td'])) {
|
||||
if (strpos($type, 'Input') === 0 && in_array($ptype, ['InputMedia', 'InputDocument', 'InputPhoto']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'MessageMedia, Message, Update or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputMessage'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['InputMessage']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'Message ID or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputEncryptedChat'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['InputEncryptedChat']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'Secret chat ID, Update, EncryptedMessage or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputFile'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['InputFile']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'File path or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputEncryptedFile'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['InputEncryptedFile']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'File path or '.$ptype;
|
||||
}
|
||||
$table .= '|'.str_replace('_', '\\_', $param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.str_replace('_', '\\_', $human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.(isset($param['pow']) || $this->constructors->find_by_predicate(lcfirst($param['type']).'Empty') || ($data['type'] === 'InputMedia' && $param['name'] === 'mime_type') || ($data['type'] === 'DocumentAttribute' && in_array($param['name'], ['w', 'h', 'duration'])) ? 'Optional' : 'Yes').'|';
|
||||
|
@ -73,7 +73,7 @@ trait Methods
|
||||
';
|
||||
if (!isset($this->td_descriptions['methods'][$data['method']])) {
|
||||
$this->add_to_lang('method_'.$data['method']);
|
||||
|
||||
|
||||
if (\danog\MadelineProto\Lang::$lang['en']['method_'.$data['method']] !== '') {
|
||||
$this->td_descriptions['methods'][$data['method']]['description'] = \danog\MadelineProto\Lang::$lang['en']['method_'.$data['method']];
|
||||
}
|
||||
@ -106,19 +106,19 @@ trait Methods
|
||||
$ptype = 'Bool';
|
||||
}
|
||||
$human_ptype = 'CLICK ME '.$ptype;
|
||||
if (in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'Username, chat ID, Update, Message or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputMedia', 'InputPhoto', 'InputDocument'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['InputMedia', 'InputPhoto', 'InputDocument']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'MessageMedia, Update, Message or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputMessage'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['InputMessage']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'Message ID or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputEncryptedChat'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['InputEncryptedChat']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'Secret chat ID, Update, EncryptedMessage or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputFile'])&& !isset($this->settings['td'])) {
|
||||
if (in_array($ptype, ['InputFile']) && !isset($this->settings['td'])) {
|
||||
$human_ptype = 'File path or '.$ptype;
|
||||
}
|
||||
if (in_array($ptype, ['InputEncryptedFile']) && !isset($this->settings['td'])) {
|
||||
@ -132,7 +132,7 @@ trait Methods
|
||||
$this->td_descriptions['methods'][$data['method']]['params'][$param['name']] = \danog\MadelineProto\Lang::$lang['en']['method_'.$data['method'].'_param_'.$param['name'].'_type_'.$param['type']];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($this->td_descriptions['methods'][$data['method']])) {
|
||||
$table .= $this->td_descriptions['methods'][$data['method']]['params'][$param['name']].'|';
|
||||
}
|
||||
|
@ -15,12 +15,14 @@ namespace danog\MadelineProto;
|
||||
|
||||
class EventHandler extends APIFactory
|
||||
{
|
||||
public function __construct($MadelineProto) {
|
||||
public function __construct($MadelineProto)
|
||||
{
|
||||
$this->API = $MadelineProto;
|
||||
foreach ($this->API->get_method_namespaces() as $namespace) {
|
||||
$this->{$namespace} = new APIFactory($namespace, $this->API);
|
||||
}
|
||||
}
|
||||
|
||||
public function &__get($name)
|
||||
{
|
||||
if ($name === 'settings') {
|
||||
|
@ -17,14 +17,20 @@ class FileCallback implements FileCallbackInterface
|
||||
{
|
||||
private $file;
|
||||
private $callback;
|
||||
public function __construct($file, $callback) {
|
||||
|
||||
public function __construct($file, $callback)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->callback = $callback;
|
||||
}
|
||||
public function getFile() {
|
||||
|
||||
public function getFile()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
public function __invoke($percent) {
|
||||
|
||||
public function __invoke($percent)
|
||||
{
|
||||
$this->callback($percent);
|
||||
}
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ namespace danog\MadelineProto;
|
||||
interface FileCallbackInterface
|
||||
{
|
||||
public function getFile();
|
||||
|
||||
public function __invoke($percent);
|
||||
}
|
||||
|
@ -130,7 +130,11 @@ class Logger
|
||||
}
|
||||
if (!is_string($param)) {
|
||||
$parame = json_encode($param, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
if ($parame == '') $param = var_export($param, true); else $param = $parame;
|
||||
if ($parame == '') {
|
||||
$param = var_export($param, true);
|
||||
} else {
|
||||
$param = $parame;
|
||||
}
|
||||
}
|
||||
$param = str_pad(basename(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]['file'], '.php').$prefix.': ', 16 + strlen($prefix))."\t".$param;
|
||||
/*if (self::$isatty) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -198,7 +198,9 @@ trait CallHandler
|
||||
$only_updates = false;
|
||||
if ($last_recv === $this->datacenter->sockets[$aargs['datacenter']]->last_recv) { // the socket is dead, resend request
|
||||
$this->close_and_reopen($aargs['datacenter']);
|
||||
if ($this->altervista) continue 2;
|
||||
if ($this->altervista) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
//if ($this->datacenter->sockets[$aargs['datacenter']]->last_recv < time() - 1 && $this->is_http($aargs['datacenter'])) {
|
||||
// $this->close_and_reopen($aargs['datacenter']);
|
||||
|
@ -87,7 +87,9 @@ trait Files
|
||||
{
|
||||
return $this->upload($file, $file_name, $cb, true);
|
||||
}
|
||||
public function gen_all_file($media) {
|
||||
|
||||
public function gen_all_file($media)
|
||||
{
|
||||
$res = [$this->constructors->find_by_predicate($media['_'])['type'] => $media];
|
||||
switch ($media['_']) {
|
||||
case 'messageMediaPhoto':
|
||||
@ -131,10 +133,12 @@ trait Files
|
||||
default:
|
||||
throw new \danog\MadelineProto\Exception('Could not convert media object');
|
||||
}
|
||||
return $res;
|
||||
|
||||
return $res;
|
||||
}
|
||||
public function get_file_info($constructor) {
|
||||
|
||||
public function get_file_info($constructor)
|
||||
{
|
||||
if (is_string($constructor)) {
|
||||
$constructor = $this->unpack_file_id($constructor)['MessageMedia'];
|
||||
}
|
||||
@ -146,8 +150,10 @@ trait Files
|
||||
case 'message':
|
||||
$constructor = $constructor['media'];
|
||||
}
|
||||
|
||||
return $this->gen_all_file($constructor);
|
||||
}
|
||||
|
||||
public function get_download_info($message_media)
|
||||
{
|
||||
if (is_string($message_media)) {
|
||||
|
@ -41,7 +41,7 @@ trait MessageHandler
|
||||
\danog\MadelineProto\Logger::log("Inside of msg_container, sending {$message['_']} as encrypted message to DC $datacenter", \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||
$message['_'] = 'MTmessage';
|
||||
$messages[] = $message;
|
||||
$this->datacenter->sockets[$datacenter]->outgoing_messages[$message['msg_id']] = ['seq_no' => $message['seqno'], 'response' => -1];//, 'content' => $this->deserialize($message['body'], ['type' => '', 'datacenter' => $datacenter])];
|
||||
$this->datacenter->sockets[$datacenter]->outgoing_messages[$message['msg_id']] = ['seq_no' => $message['seqno'], 'response' => -1]; //, 'content' => $this->deserialize($message['body'], ['type' => '', 'datacenter' => $datacenter])];
|
||||
}
|
||||
$message_data = $this->serialize_object(['type' => ''], ['_' => 'msg_container', 'messages' => $messages], 'lol');
|
||||
$message_id = $this->generate_message_id($datacenter);
|
||||
|
@ -267,6 +267,7 @@ trait PeerHandler
|
||||
if (!isset($this->secret_chats[$id])) {
|
||||
throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['sec_peer_not_in_db']);
|
||||
}
|
||||
|
||||
return $this->secret_chats[$id];
|
||||
case 'updateNewMessage':
|
||||
case 'updateNewChannelMessage':
|
||||
@ -753,6 +754,7 @@ trait PeerHandler
|
||||
if (strpos($e->rpc, 'FLOOD_WAIT_') === 0 || $e->rpc === 'AUTH_KEY_UNREGISTERED' || $e->rpc === 'USERNAME_INVALID') {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
if ($res['_'] === 'contacts.resolvedPeer') {
|
||||
|
@ -13,77 +13,85 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
/**
|
||||
* Wrapper for my.telegram.org
|
||||
* Wrapper for my.telegram.org.
|
||||
*/
|
||||
class MyTelegramOrgWrapper
|
||||
{
|
||||
private $logged = false;
|
||||
public function __construct($number) {
|
||||
|
||||
public function __construct($number)
|
||||
{
|
||||
if (!extension_loaded('curl')) {
|
||||
throw new Exception(['extension', 'curl']);
|
||||
}
|
||||
$this->number = $number;
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/auth/send_password");
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/auth/send_password');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(["phone" => $number]));
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['phone' => $number]));
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
|
||||
|
||||
$headers = array();
|
||||
$headers[] = "Origin: https://my.telegram.org";
|
||||
$headers[] = "Accept-Encoding: gzip, deflate, br";
|
||||
$headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
|
||||
$headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
|
||||
$headers[] = "Content-Type: application/x-www-form-urlencoded; charset=UTF-8";
|
||||
$headers[] = "Accept: application/json, text/javascript, */*; q=0.01";
|
||||
$headers[] = "Referer: https://my.telegram.org/auth";
|
||||
$headers[] = "X-Requested-With: XMLHttpRequest";
|
||||
$headers[] = "Connection: keep-alive";
|
||||
$headers[] = "Dnt: 1";
|
||||
$headers = [];
|
||||
$headers[] = 'Origin: https://my.telegram.org';
|
||||
$headers[] = 'Accept-Encoding: gzip, deflate, br';
|
||||
$headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
|
||||
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
|
||||
$headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
|
||||
$headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
|
||||
$headers[] = 'Referer: https://my.telegram.org/auth';
|
||||
$headers[] = 'X-Requested-With: XMLHttpRequest';
|
||||
$headers[] = 'Connection: keep-alive';
|
||||
$headers[] = 'Dnt: 1';
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
throw new Exception('Curl error: ' . curl_error($ch));
|
||||
throw new Exception('Curl error: '.curl_error($ch));
|
||||
}
|
||||
curl_close ($ch);
|
||||
curl_close($ch);
|
||||
$resulta = json_decode($result, true);
|
||||
if (!isset($resulta['random_hash'])) throw new Exception($result);
|
||||
$this->hash = $resulta["random_hash"];
|
||||
if (!isset($resulta['random_hash'])) {
|
||||
throw new Exception($result);
|
||||
}
|
||||
$this->hash = $resulta['random_hash'];
|
||||
}
|
||||
public function complete_login($password) {
|
||||
if ($this->logged) throw new Exception('Already logged in!');
|
||||
|
||||
public function complete_login($password)
|
||||
{
|
||||
if ($this->logged) {
|
||||
throw new Exception('Already logged in!');
|
||||
}
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/auth/login");
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/auth/login');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(["phone" => $this->number, "random_hash" => $this->hash, "password" => $password]));
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['phone' => $this->number, 'random_hash' => $this->hash, 'password' => $password]));
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
|
||||
|
||||
$headers = array();
|
||||
$headers[] = "Origin: https://my.telegram.org";
|
||||
$headers[] = "Accept-Encoding: gzip, deflate, br";
|
||||
$headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
|
||||
$headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
|
||||
$headers[] = "Content-Type: application/x-www-form-urlencoded; charset=UTF-8";
|
||||
$headers[] = "Accept: application/json, text/javascript, */*; q=0.01";
|
||||
$headers[] = "Referer: https://my.telegram.org/auth";
|
||||
$headers[] = "X-Requested-With: XMLHttpRequest";
|
||||
$headers[] = "Connection: keep-alive";
|
||||
$headers[] = "Dnt: 1";
|
||||
$headers = [];
|
||||
$headers[] = 'Origin: https://my.telegram.org';
|
||||
$headers[] = 'Accept-Encoding: gzip, deflate, br';
|
||||
$headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
|
||||
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
|
||||
$headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
|
||||
$headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
|
||||
$headers[] = 'Referer: https://my.telegram.org/auth';
|
||||
$headers[] = 'X-Requested-With: XMLHttpRequest';
|
||||
$headers[] = 'Connection: keep-alive';
|
||||
$headers[] = 'Dnt: 1';
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
throw new Exception('Curl error: ' . curl_error($ch));
|
||||
throw new Exception('Curl error: '.curl_error($ch));
|
||||
}
|
||||
curl_close ($ch);
|
||||
curl_close($ch);
|
||||
|
||||
list($response_headers, $response_content) = preg_split('/(\r\n){2}/', $result, 2);
|
||||
switch ($response_content) {
|
||||
@ -93,146 +101,168 @@ class MyTelegramOrgWrapper
|
||||
default:
|
||||
throw new Exception($response_content);
|
||||
}
|
||||
$this->token = explode(";", explode("stel_token=", $response_headers)[1])[0];
|
||||
$this->token = explode(';', explode('stel_token=', $response_headers)[1])[0];
|
||||
|
||||
return $this->logged = true;
|
||||
}
|
||||
public function logged_in() { return $this->logged; }
|
||||
public function has_app() {
|
||||
if (!$this->logged) throw new Exception('Not logged in!');
|
||||
|
||||
public function logged_in()
|
||||
{
|
||||
return $this->logged;
|
||||
}
|
||||
|
||||
public function has_app()
|
||||
{
|
||||
if (!$this->logged) {
|
||||
throw new Exception('Not logged in!');
|
||||
}
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/apps");
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
|
||||
$headers = array();
|
||||
$headers[] = "Dnt: 1";
|
||||
$headers[] = "Accept-Encoding: gzip, deflate, sdch, br";
|
||||
$headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
|
||||
$headers[] = "Upgrade-Insecure-Requests: 1";
|
||||
$headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
|
||||
$headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
|
||||
$headers[] = "Referer: https://my.telegram.org/";
|
||||
$headers[] = "Cookie: stel_token=".$this->token;
|
||||
$headers[] = "Connection: keep-alive";
|
||||
$headers[] = "Cache-Control: max-age=0";
|
||||
$headers = [];
|
||||
$headers[] = 'Dnt: 1';
|
||||
$headers[] = 'Accept-Encoding: gzip, deflate, sdch, br';
|
||||
$headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
|
||||
$headers[] = 'Upgrade-Insecure-Requests: 1';
|
||||
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
|
||||
$headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
|
||||
$headers[] = 'Referer: https://my.telegram.org/';
|
||||
$headers[] = 'Cookie: stel_token='.$this->token;
|
||||
$headers[] = 'Connection: keep-alive';
|
||||
$headers[] = 'Cache-Control: max-age=0';
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
throw new Exception('Curl error: ' . curl_error($ch));
|
||||
throw new Exception('Curl error: '.curl_error($ch));
|
||||
}
|
||||
curl_close ($ch);
|
||||
curl_close($ch);
|
||||
$title = explode('</title>', explode('<title>', $result)[1])[0];
|
||||
switch ($title) {
|
||||
case 'App configuration': return true;
|
||||
case 'Create new application': $this->creation_hash = explode('"/>', explode('<input type="hidden" name="hash" value="', $result)[1])[0]; return false;
|
||||
case 'Create new application': $this->creation_hash = explode('"/>', explode('<input type="hidden" name="hash" value="', $result)[1])[0];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new Exception($title);
|
||||
}
|
||||
public function get_app() {
|
||||
if (!$this->logged) throw new Exception('Not logged in!');
|
||||
|
||||
public function get_app()
|
||||
{
|
||||
if (!$this->logged) {
|
||||
throw new Exception('Not logged in!');
|
||||
}
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/apps");
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
|
||||
$headers = array();
|
||||
$headers[] = "Dnt: 1";
|
||||
$headers[] = "Accept-Encoding: gzip, deflate, sdch, br";
|
||||
$headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
|
||||
$headers[] = "Upgrade-Insecure-Requests: 1";
|
||||
$headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
|
||||
$headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
|
||||
$headers[] = "Referer: https://my.telegram.org/";
|
||||
$headers[] = "Cookie: stel_token=".$this->token;
|
||||
$headers[] = "Connection: keep-alive";
|
||||
$headers[] = "Cache-Control: max-age=0";
|
||||
$headers = [];
|
||||
$headers[] = 'Dnt: 1';
|
||||
$headers[] = 'Accept-Encoding: gzip, deflate, sdch, br';
|
||||
$headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
|
||||
$headers[] = 'Upgrade-Insecure-Requests: 1';
|
||||
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
|
||||
$headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
|
||||
$headers[] = 'Referer: https://my.telegram.org/';
|
||||
$headers[] = 'Cookie: stel_token='.$this->token;
|
||||
$headers[] = 'Connection: keep-alive';
|
||||
$headers[] = 'Cache-Control: max-age=0';
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
throw new Exception('Curl error: ' . curl_error($ch));
|
||||
throw new Exception('Curl error: '.curl_error($ch));
|
||||
}
|
||||
curl_close ($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$cose = explode('<label for="app_id" class="col-md-4 text-right control-label">App api_id:</label>
|
||||
<div class="col-md-7">
|
||||
<span class="form-control input-xlarge uneditable-input" onclick="this.select();"><strong>', $result);
|
||||
$asd = explode("</strong></span>", $cose["1"]);
|
||||
$api_id = $asd["0"];
|
||||
$asd = explode('</strong></span>', $cose['1']);
|
||||
$api_id = $asd['0'];
|
||||
$cose = explode('<label for="app_hash" class="col-md-4 text-right control-label">App api_hash:</label>
|
||||
<div class="col-md-7">
|
||||
<span class="form-control input-xlarge uneditable-input" onclick="this.select();">', $result);
|
||||
$asd = explode("</span>", $cose["1"]);
|
||||
$api_hash = $asd["0"];
|
||||
$asd = explode('</span>', $cose['1']);
|
||||
$api_hash = $asd['0'];
|
||||
|
||||
return ['api_id' => (int) $api_id, 'api_hash' => $api_hash];
|
||||
}
|
||||
public function create_app($settings) {
|
||||
if (!$this->logged) throw new Exception('Not logged in!');
|
||||
if ($this->has_app()) throw new Exception('The app was already created!');
|
||||
|
||||
public function create_app($settings)
|
||||
{
|
||||
if (!$this->logged) {
|
||||
throw new Exception('Not logged in!');
|
||||
}
|
||||
if ($this->has_app()) {
|
||||
throw new Exception('The app was already created!');
|
||||
}
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/apps/create");
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps/create');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(["hash" => $this->creation_hash, "app_title" => $settings['app_title'], "app_shortname" => $settings['app_shortname'], "app_url" => $settings['app_url'], 'app_platform' => $settings['app_platform'], 'app_desc' => $settings['app_desc']]));
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['hash' => $this->creation_hash, 'app_title' => $settings['app_title'], 'app_shortname' => $settings['app_shortname'], 'app_url' => $settings['app_url'], 'app_platform' => $settings['app_platform'], 'app_desc' => $settings['app_desc']]));
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
|
||||
|
||||
$headers = array();
|
||||
|
||||
$headers = [];
|
||||
$headers[] = "Cookie: stel_token=$token";
|
||||
$headers[] = "Origin: https://my.telegram.org";
|
||||
$headers[] = "Accept-Encoding: gzip, deflate, br";
|
||||
$headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
|
||||
$headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
|
||||
$headers[] = "Content-Type: application/x-www-form-urlencoded; charset=UTF-8";
|
||||
$headers[] = "Accept: */*";
|
||||
$headers[] = "Referer: https://my.telegram.org/apps";
|
||||
$headers[] = "X-Requested-With: XMLHttpRequest";
|
||||
$headers[] = "Connection: keep-alive";
|
||||
$headers[] = "Dnt: 1";
|
||||
$headers[] = 'Origin: https://my.telegram.org';
|
||||
$headers[] = 'Accept-Encoding: gzip, deflate, br';
|
||||
$headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
|
||||
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
|
||||
$headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
|
||||
$headers[] = 'Accept: */*';
|
||||
$headers[] = 'Referer: https://my.telegram.org/apps';
|
||||
$headers[] = 'X-Requested-With: XMLHttpRequest';
|
||||
$headers[] = 'Connection: keep-alive';
|
||||
$headers[] = 'Dnt: 1';
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
throw new Exception('Curl error:' . curl_error($ch));
|
||||
throw new Exception('Curl error:'.curl_error($ch));
|
||||
}
|
||||
curl_close ($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/apps");
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
||||
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
||||
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
|
||||
|
||||
$headers = array();
|
||||
$headers[] = "Dnt: 1";
|
||||
$headers[] = "Accept-Encoding: gzip, deflate, sdch, br";
|
||||
$headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
|
||||
$headers[] = "Upgrade-Insecure-Requests: 1";
|
||||
$headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
|
||||
$headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
|
||||
$headers[] = "Referer: https://my.telegram.org/";
|
||||
|
||||
$headers = [];
|
||||
$headers[] = 'Dnt: 1';
|
||||
$headers[] = 'Accept-Encoding: gzip, deflate, sdch, br';
|
||||
$headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
|
||||
$headers[] = 'Upgrade-Insecure-Requests: 1';
|
||||
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
|
||||
$headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
|
||||
$headers[] = 'Referer: https://my.telegram.org/';
|
||||
$headers[] = "Cookie: stel_token=$token";
|
||||
$headers[] = "Connection: keep-alive";
|
||||
$headers[] = "Cache-Control: max-age=0";
|
||||
$headers[] = 'Connection: keep-alive';
|
||||
$headers[] = 'Cache-Control: max-age=0';
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
throw new Exception('Curl error:' . curl_error($ch));
|
||||
throw new Exception('Curl error:'.curl_error($ch));
|
||||
}
|
||||
curl_close ($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$cose = explode('<label for="app_id" class="col-md-4 text-right control-label">App api_id:</label>
|
||||
<div class="col-md-7">
|
||||
<span class="form-control input-xlarge uneditable-input" onclick="this.select();"><strong>', $result);
|
||||
$asd = explode("</strong></span>", $cose["1"]);
|
||||
$api_id = $asd["0"];
|
||||
$asd = explode('</strong></span>', $cose['1']);
|
||||
$api_id = $asd['0'];
|
||||
$cose = explode('<label for="app_hash" class="col-md-4 text-right control-label">App api_hash:</label>
|
||||
<div class="col-md-7">
|
||||
<span class="form-control input-xlarge uneditable-input" onclick="this.select();">', $result);
|
||||
$asd = explode("</span>", $cose["1"]);
|
||||
$api_hash = $asd["0"];
|
||||
$asd = explode('</span>', $cose['1']);
|
||||
$api_hash = $asd['0'];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class Serialization
|
||||
return $wrote;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Deserialize API class.
|
||||
*
|
||||
* @param string $filename
|
||||
|
@ -170,9 +170,9 @@ class Handler extends \danog\MadelineProto\Connection
|
||||
$exception['rpc_message'] = $e->rpc;
|
||||
$exception['message'] = $e->getMessage();
|
||||
}
|
||||
} else if ($e instanceof \danog\MadelineProto\TL\Exception) {
|
||||
} elseif ($e instanceof \danog\MadelineProto\TL\Exception) {
|
||||
$exception = ['_' => 'socketTLException', 'message' => $e->getMessage()];
|
||||
} else if ($e instanceof \DOMException) {
|
||||
} elseif ($e instanceof \DOMException) {
|
||||
$exception = ['_' => 'socketDOMException', 'message' => $e->getMessage()];
|
||||
} else {
|
||||
$exception = ['_' => 'socketException', 'message' => $e->getMessage()];
|
||||
|
@ -508,7 +508,7 @@ trait TL
|
||||
if (!isset($this->secret_chats[$arguments[$current_argument['name']]])) {
|
||||
throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['sec_peer_not_in_db']);
|
||||
}
|
||||
$arguments[$current_argument['name']] = $this->secret_chats[$arguments[$current_argument['name']]]['InputEncryptedChat'];
|
||||
$arguments[$current_argument['name']] = $this->secret_chats[$arguments[$current_argument['name']]]['InputEncryptedChat'];
|
||||
}
|
||||
}
|
||||
//\danog\MadelineProto\Logger::log('Serializing '.$current_argument['name'].' of type '.$current_argument['type');
|
||||
|
@ -17,7 +17,8 @@ namespace danog\MadelineProto;
|
||||
*/
|
||||
trait Tools
|
||||
{
|
||||
public function gen_vector_hash($ints) {
|
||||
public function gen_vector_hash($ints)
|
||||
{
|
||||
if (\danog\MadelineProto\Logger::$bigint) {
|
||||
$hash = new \phpseclib\Math\BigInteger(0);
|
||||
foreach ($ints as $int) {
|
||||
@ -30,8 +31,10 @@ trait Tools
|
||||
$hash = (($hash * 20261) + 0x80000000 + $int) % 0x80000000;
|
||||
}
|
||||
}
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
public function random($length)
|
||||
{
|
||||
return $length === 0 ? '' : \phpseclib\Crypt\Random::string($length);
|
||||
|
@ -29,7 +29,7 @@ trait ApiStart
|
||||
}
|
||||
$fp = fopen('php://stdin', 'r');
|
||||
$line = rtrim(fgets($fp, 1024));
|
||||
|
||||
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
@ -44,6 +44,7 @@ trait ApiStart
|
||||
4) Click on create application'.PHP_EOL;
|
||||
$app['api_id'] = readline('5) Enter your API ID: ');
|
||||
$app['api_hash'] = readline('6) Enter your API hash: ');
|
||||
|
||||
return $app;
|
||||
} else {
|
||||
$this->my_telegram_org_wrapper = new \danog\MadelineProto\MyTelegramOrgWrapper(readline('Enter a phone number that is already registered on Telegram: '));
|
||||
@ -53,6 +54,7 @@ trait ApiStart
|
||||
} else {
|
||||
$app = $this->my_telegram_org_wrapper->get_app();
|
||||
}
|
||||
|
||||
return $app;
|
||||
}
|
||||
} else {
|
||||
@ -62,16 +64,18 @@ trait ApiStart
|
||||
$app['api_id'] = (int) $_POST['api_id'];
|
||||
$app['api_hash'] = $_POST['api_hash'];
|
||||
$this->getting_api_id = false;
|
||||
|
||||
return $app;
|
||||
} else if (isset($_POST['phone_number'])) {
|
||||
} elseif (isset($_POST['phone_number'])) {
|
||||
$this->web_api_phone_login();
|
||||
} else {
|
||||
$this->web_api_echo();
|
||||
}
|
||||
} else if (!$this->my_telegram_org_wrapper->logged_in()) {
|
||||
} elseif (!$this->my_telegram_org_wrapper->logged_in()) {
|
||||
if (isset($_POST['code'])) {
|
||||
$app = $this->web_api_complete_login();
|
||||
$this->getting_api_id = false;
|
||||
|
||||
return $app;
|
||||
} else {
|
||||
$this->web_api_echo("You didn't provide a phone code!");
|
||||
@ -80,6 +84,7 @@ trait ApiStart
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public function web_api_phone_login()
|
||||
{
|
||||
try {
|
||||
@ -101,6 +106,7 @@ trait ApiStart
|
||||
} else {
|
||||
$app = $this->my_telegram_org_wrapper->get_app();
|
||||
}
|
||||
|
||||
return $app;
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
$this->web_api_echo('ERROR: '.$e->getMessage().'. Try again.');
|
||||
|
@ -34,14 +34,17 @@ trait ApiTemplates
|
||||
{
|
||||
return sprintf($this->web_api_template, $form, $message);
|
||||
}
|
||||
public function get_web_api_template() {
|
||||
|
||||
public function get_web_api_template()
|
||||
{
|
||||
return $this->web_template;
|
||||
}
|
||||
public function set_web_api_template($template) {
|
||||
|
||||
public function set_web_api_template($template)
|
||||
{
|
||||
$this->web_template = $template;
|
||||
}
|
||||
|
||||
|
||||
public function web_api_echo($message = '')
|
||||
{
|
||||
if (!isset($this->my_telegram_org_wrapper)) {
|
||||
@ -58,5 +61,4 @@ trait ApiTemplates
|
||||
echo $this->web_api_echo_template('Enter your code<br><b>'.$message.'</b>', '<input type="text" name="code" placeholder="Code" required/>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ namespace danog\MadelineProto\Wrappers;
|
||||
*/
|
||||
trait Callback
|
||||
{
|
||||
public function setCallback($callback) {
|
||||
public function setCallback($callback)
|
||||
{
|
||||
$this->settings['updates']['callback'] = $callback;
|
||||
$this->settings['updates']['handle_updates'] = true;
|
||||
}
|
||||
|
@ -21,13 +21,15 @@ trait Events
|
||||
public $event_handler;
|
||||
private $event_handler_instance;
|
||||
|
||||
public function setEventHandler($event_handler) {
|
||||
public function setEventHandler($event_handler)
|
||||
{
|
||||
$this->event_handler = $event_handler;
|
||||
$this->settings['updates']['callback'] = [$this, 'event_update_handler'];
|
||||
$this->settings['updates']['handle_updates'] = true;
|
||||
}
|
||||
|
||||
public function event_update_handler($update) {
|
||||
public function event_update_handler($update)
|
||||
{
|
||||
if (!class_exists($this->event_handler) || !is_subclass_of($this->event_handler, '\danog\MadelineProto\EventHandler')) {
|
||||
throw new \danog\MadelineProto\Exception('Wrong event handler was defined');
|
||||
}
|
||||
@ -38,7 +40,7 @@ trait Events
|
||||
$method_name = 'on'.ucfirst($update['_']);
|
||||
if (method_exists($this->event_handler_instance, $method_name)) {
|
||||
$this->event_handler_instance->$method_name($update);
|
||||
} else if (method_exists($this->event_handler_instance, 'onAny')) {
|
||||
} elseif (method_exists($this->event_handler_instance, 'onAny')) {
|
||||
$this->event_handler_instance->onAny($update);
|
||||
}
|
||||
}
|
||||
|
@ -23,18 +23,18 @@ trait Loop
|
||||
if (in_array($this->settings['updates']['callback'], [['danog\\MadelineProto\\API', 'get_updates_update_handler'], 'get_updates_update_handler'])) {
|
||||
return true;
|
||||
}
|
||||
if (php_sapi_name() !== "cli") {
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
try {
|
||||
set_time_limit(-1);
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
register_shutdown_function(function() {
|
||||
register_shutdown_function(function () {
|
||||
\danog\MadelineProto\Logger::log(['Restarting script...']);
|
||||
$a = fsockopen((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'tls' : 'tcp').'://'.$_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']);
|
||||
fwrite($a, $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n"."Host: ".$_SERVER['SERVER_NAME']."\r\n\r\n");
|
||||
fwrite($a, $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n".'Host: '.$_SERVER['SERVER_NAME']."\r\n\r\n");
|
||||
});
|
||||
}
|
||||
}
|
||||
\danog\MadelineProto\Logger::log("Started update loop", \danog\MadelineProto\Logger::NOTICE);
|
||||
\danog\MadelineProto\Logger::log('Started update loop', \danog\MadelineProto\Logger::NOTICE);
|
||||
$offset = 0;
|
||||
if ($max_forks === -1) {
|
||||
while (true) {
|
||||
|
@ -32,10 +32,10 @@ trait Start
|
||||
}
|
||||
$fp = fopen('php://stdin', 'r');
|
||||
$line = rtrim(fgets($fp, 1024));
|
||||
|
||||
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strpos(readline('Do you want to login as user or bot (u/b)? '), 'b') !== false) {
|
||||
$this->bot_login(readline('Enter your bot token: '));
|
||||
} else {
|
||||
@ -88,7 +88,6 @@ trait Start
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function web_phone_login()
|
||||
{
|
||||
try {
|
||||
@ -148,5 +147,4 @@ trait Start
|
||||
$this->web_echo('ERROR: '.$e->getMessage().'. Try again.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ trait Templates
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private $web_template = '<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -62,10 +63,14 @@ trait Templates
|
||||
{
|
||||
return sprintf($this->web_template, $form, $message);
|
||||
}
|
||||
public function get_web_template() {
|
||||
|
||||
public function get_web_template()
|
||||
{
|
||||
return $this->web_template;
|
||||
}
|
||||
public function set_web_template($template) {
|
||||
|
||||
public function set_web_template($template)
|
||||
{
|
||||
$this->web_template = $template;
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ namespace danog\MadelineProto\Wrappers;
|
||||
*/
|
||||
trait Webhook
|
||||
{
|
||||
|
||||
public function setWebhook($hook_url, $pem_path = null) {
|
||||
public function setWebhook($hook_url, $pem_path = null)
|
||||
{
|
||||
$this->pem_path = $pem_path;
|
||||
$this->hook_url = $hook_url;
|
||||
$this->settings['updates']['callback'] = [$this, 'pwr_webhook'];
|
||||
|
@ -12,7 +12,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Various ways to load MadelineProto
|
||||
* Various ways to load MadelineProto.
|
||||
*/
|
||||
if (!file_exists(__DIR__.'/../vendor/autoload.php')) {
|
||||
echo 'You did not run composer update, using madeline.php'.PHP_EOL;
|
||||
@ -24,7 +24,7 @@ if (!file_exists(__DIR__.'/../vendor/autoload.php')) {
|
||||
require_once 'vendor/autoload.php';
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Load .env for settings
|
||||
*/
|
||||
if (file_exists('.env')) {
|
||||
@ -38,23 +38,24 @@ if (getenv('TEST_SECRET_CHAT') == '') {
|
||||
echo 'Loading settings...'.PHP_EOL;
|
||||
$settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];
|
||||
|
||||
/**
|
||||
/*
|
||||
* Load MadelineProto
|
||||
*/
|
||||
echo 'Loading MadelineProto...'.PHP_EOL;
|
||||
|
||||
try {
|
||||
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
echo $e.PHP_EOL;
|
||||
unlink(getcwd().'/testing.madeline');
|
||||
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
||||
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* If this session is not logged in, login
|
||||
*/
|
||||
if ($MadelineProto->get_self() === false) {
|
||||
/**
|
||||
/*
|
||||
* If a BOT_TOKEN is defined in .env, use it to login, else prompt for login info
|
||||
*/
|
||||
if (getenv('BOT_TOKEN') == '') {
|
||||
@ -64,7 +65,7 @@ if ($MadelineProto->get_self() === false) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Test logging
|
||||
*/
|
||||
\danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||
@ -75,11 +76,11 @@ if ($MadelineProto->get_self() === false) {
|
||||
\danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::FATAL_ERROR);
|
||||
|
||||
/**
|
||||
* A small example message to use for tests
|
||||
* A small example message to use for tests.
|
||||
*/
|
||||
$message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sembre) (yo lavorar siempre) (mi labori ĉiam) (я всегда работать) (Ik werkuh altijd) (Ngimbonga ngaso sonke isikhathi ukusebenza)' : ('Travis ci tests in progress: commit '.getenv('TRAVIS_COMMIT').', job '.getenv('TRAVIS_JOB_NUMBER').', PHP version: '.getenv('TRAVIS_PHP_VERSION'));
|
||||
|
||||
/**
|
||||
/*
|
||||
* Try making a phone call
|
||||
*/
|
||||
if (stripos(readline('Do you want to make a call? (y/n): '), 'y') !== false) {
|
||||
@ -93,7 +94,7 @@ if (stripos(readline('Do you want to make a call? (y/n): '), 'y') !== false) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Try receiving a phone call
|
||||
*/
|
||||
if (stripos(readline('Do you want to handle incoming calls? (y/n): '), 'y') !== false) {
|
||||
@ -115,17 +116,17 @@ if (stripos(readline('Do you want to handle incoming calls? (y/n): '), 'y') !==
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Secret chat usage
|
||||
*/
|
||||
if (stripos(readline('Do you want to make the secret chat tests? (y/n): '), 'y') !== false) {
|
||||
/**
|
||||
* Request a secret chat
|
||||
* Request a secret chat.
|
||||
*/
|
||||
$secret_chat_id = $MadelineProto->API->request_secret_chat(getenv('TEST_SECRET_CHAT'));
|
||||
echo 'Waiting for '.getenv('TEST_SECRET_CHAT').' (secret chat id '.$secret_chat_id.') to accept the secret chat...'.PHP_EOL;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Wait until the other party accepts it
|
||||
*/
|
||||
while ($MadelineProto->secret_chat_status($secret_chat_id) !== 2) {
|
||||
@ -133,68 +134,68 @@ if (stripos(readline('Do you want to make the secret chat tests? (y/n): '), 'y')
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a markdown-formatted text message with expiration after 10 seconds
|
||||
* Send a markdown-formatted text message with expiration after 10 seconds.
|
||||
*/
|
||||
$sentMessage = $MadelineProto->messages->sendEncrypted([
|
||||
'peer' => $secret_chat_id,
|
||||
'peer' => $secret_chat_id,
|
||||
'message' => [
|
||||
'_' => 'decryptedMessage',
|
||||
'media' => ['_' => 'decryptedMessageMediaEmpty'], // No media
|
||||
'ttl' => 10, // This message self-destructs 10 seconds after reception
|
||||
'message' => '```'.$message.'```', // Code Markdown
|
||||
'parse_mode' => 'Markdown'
|
||||
]
|
||||
'_' => 'decryptedMessage',
|
||||
'media' => ['_' => 'decryptedMessageMediaEmpty'], // No media
|
||||
'ttl' => 10, // This message self-destructs 10 seconds after reception
|
||||
'message' => '```'.$message.'```', // Code Markdown
|
||||
'parse_mode' => 'Markdown',
|
||||
],
|
||||
]);
|
||||
\danog\MadelineProto\Logger::log($sentMessage, \danog\MadelineProto\Logger::NOTICE);
|
||||
|
||||
/**
|
||||
* Send secret media
|
||||
* Send secret media.
|
||||
*/
|
||||
$secret_media = [];
|
||||
|
||||
// Photo uploaded as document, secret chat
|
||||
$secret_media['document_photo'] = [
|
||||
'peer' => $secret_chat_id,
|
||||
'file' => 'tests/faust.jpg', // The file to send
|
||||
'peer' => $secret_chat_id,
|
||||
'file' => 'tests/faust.jpg', // The file to send
|
||||
'message' => [
|
||||
'_' => 'decryptedMessage',
|
||||
'ttl' => 0, // This message does not self-destruct
|
||||
'_' => 'decryptedMessage',
|
||||
'ttl' => 0, // This message does not self-destruct
|
||||
'message' => '', // No text message, only media
|
||||
'media' => [
|
||||
'_' => 'decryptedMessageMediaDocument',
|
||||
'thumb' => file_get_contents('tests/faust.preview.jpg'), // The thumbnail must be generated manually, it must be in jpg format, 90x90
|
||||
'thumb_w' => 90,
|
||||
'thumb_h' => 90,
|
||||
'mime_type' => mime_content_type('tests/faust.jpg'), // The file's mime type
|
||||
'caption' => 'This file was uploaded using @MadelineProto', // The caption
|
||||
'file_name' => 'faust.jpg', // The file's name
|
||||
'size' => filesize('tests/faust.jpg'), // The file's size
|
||||
'media' => [
|
||||
'_' => 'decryptedMessageMediaDocument',
|
||||
'thumb' => file_get_contents('tests/faust.preview.jpg'), // The thumbnail must be generated manually, it must be in jpg format, 90x90
|
||||
'thumb_w' => 90,
|
||||
'thumb_h' => 90,
|
||||
'mime_type' => mime_content_type('tests/faust.jpg'), // The file's mime type
|
||||
'caption' => 'This file was uploaded using @MadelineProto', // The caption
|
||||
'file_name' => 'faust.jpg', // The file's name
|
||||
'size' => filesize('tests/faust.jpg'), // The file's size
|
||||
'attributes' => [
|
||||
['_' => 'documentAttributeImageSize', 'w' => 1280, 'h' => 914] // Image's resolution
|
||||
]
|
||||
]
|
||||
]
|
||||
['_' => 'documentAttributeImageSize', 'w' => 1280, 'h' => 914], // Image's resolution
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Photo, secret chat
|
||||
$secret_media['photo'] = [
|
||||
'peer' => $secret_chat_id,
|
||||
'file' => 'tests/faust.jpg',
|
||||
'peer' => $secret_chat_id,
|
||||
'file' => 'tests/faust.jpg',
|
||||
'message' => [
|
||||
'_' => 'decryptedMessage',
|
||||
'ttl' => 0,
|
||||
'message' => '',
|
||||
'media' => [
|
||||
'_' => 'decryptedMessageMediaPhoto',
|
||||
'thumb' => file_get_contents('tests/faust.preview.jpg'),
|
||||
'_' => 'decryptedMessage',
|
||||
'ttl' => 0,
|
||||
'message' => '',
|
||||
'media' => [
|
||||
'_' => 'decryptedMessageMediaPhoto',
|
||||
'thumb' => file_get_contents('tests/faust.preview.jpg'),
|
||||
'thumb_w' => 90,
|
||||
'thumb_h' => 90,
|
||||
'caption' => 'This file was uploaded using @MadelineProto',
|
||||
'size' => filesize('tests/faust.jpg'),
|
||||
'w' => 1280,
|
||||
'h' => 914
|
||||
]
|
||||
]
|
||||
'size' => filesize('tests/faust.jpg'),
|
||||
'w' => 1280,
|
||||
'h' => 914,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// GIF, secret chat
|
||||
|
@ -52,11 +52,11 @@ foreach (\danog\MadelineProto\Lang::$current_lang as $key => $value) {
|
||||
$param_type = isset($matches[2]) ? $matches[2] : '';
|
||||
if ($param_name === 'nonce' && $param_type === 'int128') {
|
||||
\danog\MadelineProto\Lang::$lang[$lang_code][$key] = 'Random number for cryptographic security';
|
||||
} else if ($param_name === 'server_nonce' && $param_type === 'int128') {
|
||||
} elseif ($param_name === 'server_nonce' && $param_type === 'int128') {
|
||||
\danog\MadelineProto\Lang::$lang[$lang_code][$key] = 'Random number for cryptographic security, given by server';
|
||||
} else if ($param_name === 'random_id' && $param_type === 'long') {
|
||||
} elseif ($param_name === 'random_id' && $param_type === 'long') {
|
||||
\danog\MadelineProto\Lang::$lang[$lang_code][$key] = 'Random number for cryptographic security';
|
||||
} else if (isset(\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$method_name])) {
|
||||
} elseif (isset(\danog\MadelineProto\MTProto::DISALLOWED_METHODS[$method_name])) {
|
||||
\danog\MadelineProto\Lang::$lang[$lang_code][$key] = \danog\MadelineProto\MTProto::DISALLOWED_METHODS[$method_name];
|
||||
} else {
|
||||
\danog\MadelineProto\Lang::$lang[$lang_code][$key] = readline($value.' => ');
|
||||
|
Loading…
Reference in New Issue
Block a user