1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 05:54:41 +01:00
This commit is contained in:
Daniil Gentili 2018-06-29 14:00:21 +02:00
commit c07ab02c66
6 changed files with 24 additions and 32 deletions

19
.vscode/launch.json vendored
View File

@ -1,19 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9002
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${workspaceRoot}/testing.php",
"cwd": "${fileDirname}",
"port": 9000
}
]
}

View File

View File

@ -2,9 +2,19 @@
namespace phpseclib\Math;
if (PHP_MAJOR_VERSION < 7 && !(class_exists('\Phar') && \Phar::running())) {
if (PHP_MAJOR_VERSION < 7 && !(class_exists('\\Phar') && \Phar::running())) {
throw new \Exception('MadelineProto requires php 7 to run');
}
if (defined('HHVM_VERSION')) {
$engines = [['PHP64', ['OpenSSL']], ['BCMath', ['OpenSSL']], ['PHP32', ['OpenSSL']]];
foreach ($engines as $engine) {
try {
\phpseclib\Math\BigInteger::setEngine($engine[0], isset($engine[1]) ? $engine[1] : []);
break;
} catch (\Exception $e) {
}
}
}
class BigIntegor
{

View File

@ -74,18 +74,6 @@ class Logger
$this->colors[self::WARNING] = implode(';', [self::foreground['white'], self::set['dim'], self::background['red']]);
$this->colors[self::ERROR] = implode(';', [self::foreground['white'], self::set['bold'], self::background['red']]);
$this->colors[self::FATAL_ERROR] = implode(';', [self::foreground['red'], self::set['bold'], self::background['light_gray']]);
if (!self::$printed) {
$this->colors[self::NOTICE] = implode(';', [self::foreground['light_gray'], self::set['bold'], self::background['blue']]);
$this->logger('MadelineProto');
$this->logger('Copyright (C) 2016-2018 Daniil Gentili');
$this->logger('Licensed under AGPLv3');
$this->logger('https://github.com/danog/MadelineProto');
$this->colors[self::NOTICE] = implode(';', [self::foreground['yellow'], self::set['bold']]);
self::$printed = true;
}
}
public static function log($param, $level = self::NOTICE)
@ -100,6 +88,17 @@ class Logger
if ($level > $this->level || $this->mode === 0) {
return false;
}
if (!self::$printed) {
self::$printed = true;
$this->colors[self::NOTICE] = implode(';', [self::foreground['light_gray'], self::set['bold'], self::background['blue']]);
$this->logger('MadelineProto');
$this->logger('Copyright (C) 2016-2018 Daniil Gentili');
$this->logger('Licensed under AGPLv3');
$this->logger('https://github.com/danog/MadelineProto');
$this->colors[self::NOTICE] = implode(';', [self::foreground['yellow'], self::set['bold']]);
}
if ($this->mode === 4) {
return call_user_func_array($this->optional, [$param, $level]);
}

View File

@ -32,6 +32,7 @@ composer update
cd ..
$php7to5 convert --copy-all phar7 phar5 >/dev/null
find phar5 -type f -exec sed 's/\w* \.\.\./.../' -i {} +
[ "$TRAVIS_BRANCH" != "master" ] && branch="-$TRAVIS_BRANCH" || branch=""

View File

@ -32,6 +32,7 @@ cp -a ../src vendor/danog/madelineproto
cd ..
$php7to5 convert --copy-all phar7 phar5 >/dev/null
find phar5 -type f -exec sed 's/\w* \.\.\./.../' -i {} +
php makephar.php phar5 madeline.phar $(cat .git/refs/heads/master)