This commit is contained in:
Daniil Gentili 2017-01-15 18:00:34 +01:00
commit 3d1486cc0d
6 changed files with 76 additions and 11 deletions

1
.env.example Normal file
View File

@ -0,0 +1 @@
NUMBER=+5521999596772

11
.gitignore vendored
View File

@ -4,6 +4,14 @@ _site
.idea/
*.iml
# Eclipse
.buildpath
.project
.settings
# VI
*.swp
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
@ -76,3 +84,6 @@ web_API.log
db_connect.php
sessions
docs_md
# .evn
.env

View File

@ -10,7 +10,8 @@
"phpseclib/phpseclib": "^2.0",
"paragonie/constant_time_encoding": "^1|^2",
"paragonie/random_compat": "^2.0",
"php": ">=5.6.0"
"php": ">=5.6.0",
"vlucas/phpdotenv": "^2.4"
},
"authors": [
{

61
composer.lock generated
View File

@ -4,7 +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"
],
"content-hash": "3a10bc147a48cd4573bcc9654d3be153",
"hash": "b1210d4490e9d7e46ea39393f02b77d6",
"content-hash": "e220f48be9907b7881feacec0528a3e8",
"packages": [
{
"name": "danog/phpstruct",
@ -57,7 +58,7 @@
"struct",
"unpack"
],
"time": "2016-11-14T15:09:50+00:00"
"time": "2016-11-14 15:09:50"
},
{
"name": "paragonie/constant_time_encoding",
@ -118,7 +119,7 @@
"hex2bin",
"rfc4648"
],
"time": "2016-07-11T20:32:06+00:00"
"time": "2016-07-11 20:32:06"
},
{
"name": "paragonie/random_compat",
@ -166,7 +167,7 @@
"pseudorandom",
"random"
],
"time": "2016-11-07T23:38:38+00:00"
"time": "2016-11-07 23:38:38"
},
{
"name": "phpseclib/phpseclib",
@ -258,7 +259,57 @@
"x.509",
"x509"
],
"time": "2016-10-04T00:57:04+00:00"
"time": "2016-10-04 00:57:04"
},
{
"name": "vlucas/phpdotenv",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c",
"reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"Dotenv\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause-Attribution"
],
"authors": [
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com",
"homepage": "http://www.vancelucas.com"
}
],
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
"keywords": [
"dotenv",
"env",
"environment"
],
"time": "2016-09-01 10:05:43"
}
],
"packages-dev": [],

View File

@ -22,9 +22,9 @@ trait PeerHandler
return $this->API->get_info($id, $recursive);
}
public function get_pwr_chat($id)
public function get_pwr_chat($id, $full = true, $save = true)
{
return $this->API->get_pwr_chat($id);
return $this->API->get_pwr_chat($id, $full, $save);
}
public function peer_isset($id)

View File

@ -20,16 +20,17 @@ if (file_exists('web_data.php')) {
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline');
if (file_exists('number.php') && $MadelineProto === false) {
include_once 'number.php';
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
$MadelineProto = new \danog\MadelineProto\API($settings);
$checkedPhone = $MadelineProto->auth->checkPhone(// auth.checkPhone becomes auth->checkPhone
[
'phone_number' => $number,
'phone_number' => getenv('NUMBER'),
]
);
\danog\MadelineProto\Logger::log($checkedPhone);
$sentCode = $MadelineProto->phone_login($number);
$sentCode = $MadelineProto->phone_login(getenv('NUMBER'));
\danog\MadelineProto\Logger::log($sentCode);
echo 'Enter the code you received: ';
$code = fgets(STDIN, (isset($sentCode['type']['length']) ? $sentCode['type']['length'] : 5) + 1);