Readd support for php 5.6

This commit is contained in:
danogentili 2017-01-21 18:13:28 +03:00
parent 02c94c4049
commit e469f05d64
5 changed files with 25 additions and 124 deletions

View File

@ -24,9 +24,18 @@ The MadelineProto API documentations (old layers) can be found [here](https://gi
## Usage
### Installation
```
git clone https://github.com/danog/MadelineProto
cd MadelineProto
```
Now copy .env.example to .env, edit the its values, read the docs and take a look at testing.php, bot.php.
### Dependencies
This project depends on [PHPStruct](https://github.com/danog/PHPStruct), [phpseclib](https://github.com/phpseclib/phpseclib), https://packagist.org/packages/paragonie/constant_time_encoding and https://packagist.org/packages/paragonie/random_compat
This project depends on [PHPStruct](https://github.com/danog/PHPStruct), [phpseclib](https://github.com/phpseclib/phpseclib)
To install dependencies install composer and run:
```

View File

@ -7,9 +7,7 @@
"keywords": ["telegram", "mtproto", "protocol", "bytes", "messenger", "client", "PHP", "video", "stickers", "audio", "files", "GB"],
"require": {
"danog/phpstruct": "^1.2",
"phpseclib/phpseclib": "dev-master",
"paragonie/constant_time_encoding": "^1|^2",
"paragonie/random_compat": "^2.0",
"phpseclib/phpseclib": "dev-master|^2.0.4",
"php": ">=5.6.0",
"vlucas/phpdotenv": "^2.4"
},

125
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "d06bfa2723677a8dab0625365d056249",
"content-hash": "ec3e1ca82cd0d8b845aa306cf6b2f86d",
"hash": "2620601f51f3b8074fc1fe4b606a9054",
"content-hash": "055f6111941ad34ac71efe5c718ff3d6",
"packages": [
{
"name": "danog/phpstruct",
@ -60,133 +60,22 @@
],
"time": "2016-11-14 15:09:50"
},
{
"name": "paragonie/constant_time_encoding",
"version": "v2.0.3",
"source": {
"type": "git",
"url": "https://github.com/paragonie/constant_time_encoding.git",
"reference": "e085e08c939de49707dbf64315d178d90fbc708d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/e085e08c939de49707dbf64315d178d90fbc708d",
"reference": "e085e08c939de49707dbf64315d178d90fbc708d",
"shasum": ""
},
"require": {
"php": "^7"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"type": "library",
"autoload": {
"psr-4": {
"ParagonIE\\ConstantTime\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com",
"role": "Maintainer"
},
{
"name": "Steve 'Sc00bz' Thomas",
"email": "steve@tobtu.com",
"homepage": "https://www.tobtu.com",
"role": "Original Developer"
}
],
"description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)",
"keywords": [
"base16",
"base32",
"base32_decode",
"base32_encode",
"base64",
"base64_decode",
"base64_encode",
"bin2hex",
"encoding",
"hex",
"hex2bin",
"rfc4648"
],
"time": "2016-07-11 20:32:06"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.4",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"pseudorandom",
"random"
],
"time": "2016-11-07 23:38:38"
},
{
"name": "phpseclib/phpseclib",
"version": "dev-master",
"version": "2.0.x-dev",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "74abcb45ed9de9508c61ab15371f1bc40292b9fd"
"reference": "00325a3050b320f1020aff42f8a44df6048013dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/74abcb45ed9de9508c61ab15371f1bc40292b9fd",
"reference": "74abcb45ed9de9508c61ab15371f1bc40292b9fd",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/00325a3050b320f1020aff42f8a44df6048013dd",
"reference": "00325a3050b320f1020aff42f8a44df6048013dd",
"shasum": ""
},
"require": {
"paragonie/constant_time_encoding": "^1|^2",
"paragonie/random_compat": "^1.4|^2.0",
"php": ">=7.0"
"php": ">=5.3.3"
},
"require-dev": {
"phing/phing": "~2.7",

View File

@ -438,6 +438,7 @@ trait PeerHandler
public function store_db($res, $force = false)
{
if (!isset($this->settings['pwr']) || $this->settings['pwr']['pwr'] === false) {
/*
try {
if (isset($res['username'])) {
shell_exec('curl '.escapeshellarg('https://api.pwrtelegram.xyz/getchat?chat_id=@'.$res['username']).' -s -o /dev/null >/dev/null 2>/dev/null & ');
@ -445,7 +446,7 @@ trait PeerHandler
} catch (\danog\MadelineProto\Exception $e) {
\danog\MadelineProto\Logger::log($e->getMessage());
}
*/
return;
}
if (!empty($res)) {

View File

@ -28,7 +28,11 @@ class RSA
$key = new \phpseclib\Crypt\RSA();
\danog\MadelineProto\Logger::log('Loading key...');
$key->load($rsa_key);
if (method_exists($key, 'load')) {
$key->load($rsa_key);
} else {
$key->loadKey($rsa_key);
}
$this->n = $key->modulus;
$this->e = $key->exponent;