1
1
<?php
2
-
3
2
/**
4
3
* Класс для работы с облаком https://cloud.mail.ru.
5
4
* @author <popov_si@mail.ru>
6
5
* @license GNU GPL v2.0
7
6
*/
8
-
9
7
class CloudMailRu
10
8
{
11
9
12
- function __construct ($ user , $ pass )
10
+ function __construct ($ user , $ pass, $ domain = ' mail.ru ' )
13
11
{
14
12
15
13
$ this ->user = $ user ;
@@ -20,6 +18,7 @@ function __construct($user, $pass)
20
18
$ this ->build = '' ;
21
19
$ this ->upload_url = '' ;
22
20
$ this ->ch = '' ;
21
+ $ this ->domain = $ domain ;
23
22
}
24
23
25
24
function __destruct ()
@@ -35,7 +34,7 @@ function login()
35
34
$ post_data = array (
36
35
"page " => "https://cloud.mail.ru/?from=promo " ,
37
36
"FailPage " => "" ,
38
- "Domain " => " mail.ru " ,
37
+ "Domain " => $ this -> domain ,
39
38
"Login " => $ this ->user ,
40
39
"Password " => $ this ->pass ,
41
40
"new_auth_form " => "1 "
@@ -90,8 +89,8 @@ function getDir($dir)
90
89
. '&api=2 '
91
90
. '&build= ' . $ this ->build
92
91
. '&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
95
94
. '&token= ' . $ this ->token . '&_=1433249148810 ' ;
96
95
97
96
$ this ->_curl_init ($ url );
@@ -113,10 +112,10 @@ function addDir($dir)
113
112
. 'api=2 '
114
113
. '&build= ' . $ this ->build
115
114
. '&conflict=rename '
116
- . '&email= ' . $ this ->user . '%40mail.ru '
115
+ . '&email= ' . $ this ->user . '%40 ' . $ this -> domain
117
116
. '&home= ' . $ dir
118
117
. '&token= ' . $ this ->token
119
- . '&x-email= ' . $ this ->user . '%40mail.ru '
118
+ . '&x-email= ' . $ this ->user . '%40 ' . $ this -> domain
120
119
. '&x-page-id= ' . $ this ->x_page_id ;
121
120
122
121
$ this ->_curl_init ($ url );
@@ -174,7 +173,7 @@ private function loadFile_to_cloud($file_name)
174
173
175
174
$ url = $ this ->upload_url
176
175
. '?cloud_domain=1 '
177
- . '&x-email= ' . $ this ->user . '%40mail.ru '
176
+ . '&x-email= ' . $ this ->user . '%40 ' . $ this -> domain
178
177
. '&fileapi ' . $ _time ;
179
178
180
179
$ post_data = array ("file " => "@ " . $ file_name );
@@ -204,12 +203,12 @@ private function addFile_to_cloud($arr, $dir_cloud)
204
203
. 'api=2 '
205
204
. '&build= ' . $ this ->build
206
205
. '&conflict=rename '
207
- . '&email= ' . $ this ->user . '%40mail.ru '
206
+ . '&email= ' . $ this ->user . '%40 ' . $ this -> domain
208
207
. '&home= ' . $ dir_cloud
209
208
. '&hash= ' . $ arr [0 ]
210
209
. '&size= ' . $ arr [1 ]
211
210
. '&token= ' . $ this ->token
212
- . '&x-email= ' . $ this ->user . '%40mail.ru '
211
+ . '&x-email= ' . $ this ->user . '%40 ' . $ this -> domain
213
212
. '&x-page-id= ' . $ this ->x_page_id ;
214
213
215
214
$ this ->_curl_init ($ url );
@@ -230,10 +229,10 @@ function removeFile_from_cloud($dir_cloud)
230
229
$ post_data = ''
231
230
. 'api=2 '
232
231
. '&build= ' . $ this ->build
233
- . '&email= ' . $ this ->user . '%40mail.ru '
232
+ . '&email= ' . $ this ->user . '%40 ' . $ this -> domain
234
233
. '&home= ' . $ dir_cloud
235
234
. '&token= ' . $ this ->token
236
- . '&x-email= ' . $ this ->user . '%40mail.ru '
235
+ . '&x-email= ' . $ this ->user . '%40 ' . $ this -> domain
237
236
. '&x-page-id= ' . $ this ->x_page_id ;
238
237
239
238
$ this ->_curl_init ($ url );
@@ -254,10 +253,10 @@ function publishFile($file_path)
254
253
$ post_data = ''
255
254
. 'api=2 '
256
255
. '&build= ' . $ this ->build
257
- . '&email= ' . $ this ->user . '%40mail.ru '
256
+ . '&email= ' . $ this ->user . '%40 ' . $ this -> domain
258
257
. '&home= ' . $ file_path
259
258
. '&token= ' . $ this ->token
260
- . '&x-email= ' . $ this ->user . '%40mail.ru '
259
+ . '&x-email= ' . $ this ->user . '%40 ' . $ this -> domain
261
260
. '&x-page-id= ' . $ this ->x_page_id ;
262
261
263
262
$ this ->_curl_init ($ url );
0 commit comments