Skip to content

Commit 1491b65

Browse files
authored
Merge pull request #1 from kyshnirev/m1
у mail.ru есть несколько доменов почтовых ящиков
2 parents 853314b + 8ec5de7 commit 1491b65

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

CloudMailRu.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<?php
2-
32
/**
43
* Класс для работы с облаком https://cloud.mail.ru.
54
* @author <popov_si@mail.ru>
65
* @license GNU GPL v2.0
76
*/
8-
97
class CloudMailRu
108
{
119

12-
function __construct($user, $pass)
10+
function __construct($user, $pass, $domain = 'mail.ru')
1311
{
1412

1513
$this->user = $user;
@@ -20,6 +18,7 @@ function __construct($user, $pass)
2018
$this->build = '';
2119
$this->upload_url = '';
2220
$this->ch = '';
21+
$this->domain = $domain;
2322
}
2423

2524
function __destruct()
@@ -35,7 +34,7 @@ function login()
3534
$post_data = array(
3635
"page" => "https://cloud.mail.ru/?from=promo",
3736
"FailPage" => "",
38-
"Domain" => "mail.ru",
37+
"Domain" => $this->domain,
3938
"Login" => $this->user,
4039
"Password" => $this->pass,
4140
"new_auth_form" => "1"
@@ -90,8 +89,8 @@ function getDir($dir)
9089
. '&api=2'
9190
. '&build=' . $this->build
9291
. '&x-page-id=' . $this->x_page_id
93-
. '&email=' . $this->user . '%40mail.ru'
94-
. '&x-email=' . $this->user . '%40mail.ru'
92+
. '&email=' . $this->user . '%40' . $this->domain
93+
. '&x-email=' . $this->user . '%40' . $this->domain
9594
. '&token=' . $this->token . '&_=1433249148810';
9695

9796
$this->_curl_init($url);
@@ -113,10 +112,10 @@ function addDir($dir)
113112
. 'api=2'
114113
. '&build=' . $this->build
115114
. '&conflict=rename'
116-
. '&email=' . $this->user . '%40mail.ru'
115+
. '&email=' . $this->user . '%40' . $this->domain
117116
. '&home=' . $dir
118117
. '&token=' . $this->token
119-
. '&x-email=' . $this->user . '%40mail.ru'
118+
. '&x-email=' . $this->user . '%40' . $this->domain
120119
. '&x-page-id=' . $this->x_page_id;
121120

122121
$this->_curl_init($url);
@@ -174,7 +173,7 @@ private function loadFile_to_cloud($file_name)
174173

175174
$url = $this->upload_url
176175
. '?cloud_domain=1'
177-
. '&x-email=' . $this->user . '%40mail.ru'
176+
. '&x-email=' . $this->user . '%40' . $this->domain
178177
. '&fileapi' . $_time;
179178

180179
$post_data = array("file" => "@" . $file_name);
@@ -204,12 +203,12 @@ private function addFile_to_cloud($arr, $dir_cloud)
204203
. 'api=2'
205204
. '&build=' . $this->build
206205
. '&conflict=rename'
207-
. '&email=' . $this->user . '%40mail.ru'
206+
. '&email=' . $this->user . '%40' . $this->domain
208207
. '&home=' . $dir_cloud
209208
. '&hash=' . $arr[0]
210209
. '&size=' . $arr[1]
211210
. '&token=' . $this->token
212-
. '&x-email=' . $this->user . '%40mail.ru'
211+
. '&x-email=' . $this->user . '%40' . $this->domain
213212
. '&x-page-id=' . $this->x_page_id;
214213

215214
$this->_curl_init($url);
@@ -230,10 +229,10 @@ function removeFile_from_cloud($dir_cloud)
230229
$post_data = ''
231230
. 'api=2'
232231
. '&build=' . $this->build
233-
. '&email=' . $this->user . '%40mail.ru'
232+
. '&email=' . $this->user . '%40' . $this->domain
234233
. '&home=' . $dir_cloud
235234
. '&token=' . $this->token
236-
. '&x-email=' . $this->user . '%40mail.ru'
235+
. '&x-email=' . $this->user . '%40' . $this->domain
237236
. '&x-page-id=' . $this->x_page_id;
238237

239238
$this->_curl_init($url);
@@ -254,10 +253,10 @@ function publishFile($file_path)
254253
$post_data = ''
255254
. 'api=2'
256255
. '&build=' . $this->build
257-
. '&email=' . $this->user . '%40mail.ru'
256+
. '&email=' . $this->user . '%40' . $this->domain
258257
. '&home=' . $file_path
259258
. '&token=' . $this->token
260-
. '&x-email=' . $this->user . '%40mail.ru'
259+
. '&x-email=' . $this->user . '%40' . $this->domain
261260
. '&x-page-id=' . $this->x_page_id;
262261

263262
$this->_curl_init($url);

0 commit comments

Comments
 (0)