1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
domain.php
См. документацию.
1<?php
2
12
13
15{
16
17 public function __construct()
18 {
19 }
20
21 public static function isUserExists($token, $domain, $login, &$error)
22 {
24
25 switch ($result)
26 {
27 case 'exists':
28 return true;
29 case 'nouser':
30 case 'no_user':
31 return false;
32 default:
33 $error = self::getErrorCode($error);
34 return null;
35 }
36 }
37
38 public static function addUser($token, $domain, $login, $password, &$error)
39 {
41
42 if ($result !== false)
43 {
44 return true;
45 }
46 else
47 {
48 $error = self::getErrorCode($error);
49 return null;
50 }
51 }
52
53 public static function getRedirectUrl($locale, $token, $domain, $login, $errorUrl, &$error)
54 {
56
57 if ($result !== false)
58 {
59 return CMailYandex::passport($locale, $result, $errorUrl);
60 }
61 else
62 {
63 $error = self::getErrorCode($error);
64 return null;
65 }
66 }
67
68 public static function getUnreadMessagesCount($token, $domain, $login, &$error)
69 {
71
72 if ($result !== false)
73 {
74 return $result;
75 }
76 else
77 {
78 $error = self::getErrorCode($error);
79 return null;
80 }
81 }
82
83 public static function changePassword($token, $domain, $login, $password, &$error)
84 {
85 $result = CMailYandex::editUser($token, $login, array('domain' => $domain, 'password' => $password), $error);
86
87 if ($result !== false)
88 {
89 return true;
90 }
91 else
92 {
93 $error = self::getErrorCode($error);
94 return null;
95 }
96 }
97
98 public static function getDomainStatus($token, $domain, &$error)
99 {
101
102 if ($result !== false)
103 {
104 if (mb_strtolower($result['name']) == $domain)
105 {
106 return array(
107 'domain' => $result['name'],
108 'stage' => $result['status']
109 );
110 }
111 else
112 {
113 $error = self::getErrorCode('not_permitted');
114 return null;
115 }
116 }
117 else
118 {
119 $error = self::getErrorCode($error);
120 return null;
121 }
122 }
123
124 public static function getDomainUsers($token, $domain, &$error)
125 {
126 $users = array();
127
128 $page = 0;
129 do
130 {
131 $result = CMailYandex::getDomainUsers($token, $per_page = 30, ++$page, $error);
132
133 if ($result === false)
134 break;
135
136 foreach ($result['emails'] as $email)
137 {
138 list($login, $emailDomain) = explode('@', $email['name'], 2);
139 if ($emailDomain == $domain)
140 $users[] = $login;
141 }
142 }
143 while ($result['emails_total'] > $per_page*$page);
144
145 if (empty($users) && $error)
146 {
147 $error = self::getErrorCode($error);
148 return null;
149 }
150 else
151 {
152 sort($users);
153 return $users;
154 }
155 }
156
157 public static function setDomainLogo($token, $domain, $logo, &$error)
158 {
159 $result = CMailYandex::addLogo($token, $domain, $logo, $error);
160
161 if ($result !== false)
162 {
163 return $result;
164 }
165 else
166 {
167 $error = self::getErrorCode($error);
168 return null;
169 }
170 }
171
172 public static function deleteUser($token, $domain, $login, &$error)
173 {
175
176 if ($result !== false)
177 {
178 return true;
179 }
180 else
181 {
182 $error = self::getErrorCode($error);
183 return null;
184 }
185 }
186
187 private static function getErrorCode($error)
188 {
189 $errorsList = array(
190 'no_auth' => CMail::ERR_API_DENIED,
191 'not_permitted' => CMail::ERR_API_DENIED,
192 'occupied' => CMail::ERR_API_NAME_OCCUPIED,
193 'no_user' => CMail::ERR_API_USER_NOTFOUND,
194 'not_found' => CMail::ERR_API_USER_NOTFOUND,
195 'no_login' => CMail::ERR_API_EMPTY_NAME,
196 'login-toolong' => CMail::ERR_API_LONG_NAME,
197 'badlogin' => CMail::ERR_API_BAD_NAME,
198 'passwd-empty' => CMail::ERR_API_EMPTY_PASSWORD,
199 'passwd-tooshort' => CMail::ERR_API_SHORT_PASSWORD,
200 'passwd-toolong' => CMail::ERR_API_LONG_PASSWORD,
201 'passwd-likelogin' => CMail::ERR_API_PASSWORD_LIKELOGIN,
202 'badpasswd' => CMail::ERR_API_BAD_PASSWORD
203 );
204
205 $error = explode(',', $error);
206 $error = trim($error[count($error)-1]);
207
208 return array_key_exists($error, $errorsList) ? $errorsList[$error] : CMail::ERR_API_DEFAULT;
209 }
210
211}
$login
Определения change_password.php:8
Определения domain.php:15
__construct()
Определения domain.php:17
static getDomainUsers($token, $domain, &$error)
Определения domain.php:124
static getUnreadMessagesCount($token, $domain, $login, &$error)
Определения domain.php:68
static getRedirectUrl($locale, $token, $domain, $login, $errorUrl, &$error)
Определения domain.php:53
static changePassword($token, $domain, $login, $password, &$error)
Определения domain.php:83
static isUserExists($token, $domain, $login, &$error)
Определения domain.php:21
static getDomainStatus($token, $domain, &$error)
Определения domain.php:98
static setDomainLogo($token, $domain, $logo, &$error)
Определения domain.php:157
static addUser($token, $domain, $login, $password, &$error)
Определения domain.php:38
static deleteUser($token, $domain, $login, &$error)
Определения domain.php:172
const ERR_API_DENIED
Определения mail.php:23
const ERR_API_BAD_NAME
Определения mail.php:31
const ERR_API_BAD_PASSWORD
Определения mail.php:32
const ERR_API_LONG_PASSWORD
Определения mail.php:35
const ERR_API_LONG_NAME
Определения mail.php:34
const ERR_API_EMPTY_PASSWORD
Определения mail.php:29
const ERR_API_EMPTY_NAME
Определения mail.php:28
const ERR_API_USER_NOTFOUND
Определения mail.php:26
const ERR_API_PASSWORD_LIKELOGIN
Определения mail.php:33
const ERR_API_DEFAULT
Определения mail.php:22
const ERR_API_NAME_OCCUPIED
Определения mail.php:25
const ERR_API_SHORT_PASSWORD
Определения mail.php:30
static addLogo($token, $domain, $file, &$error)
Определения yandex.php:205
static editUser($token, $login, $data, &$error)
Определения yandex.php:124
static checkUser($token, $login, &$error)
Определения yandex.php:12
static registerUserToken($token, $login, $password, &$error)
Определения yandex.php:26
static getMailInfo($token, $login, &$error)
Определения yandex.php:90
static deleteUser($token, $login, &$error)
Определения yandex.php:76
static getDomainUsers($token, $per_page=30, $page=0, &$error)
Определения yandex.php:164
static userOAuthToken($token, $domain, $login, &$error)
Определения yandex.php:41
static passport($country, $oauthToken, $errorUrl)
Определения yandex.php:56
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$email
Определения payment.php:49
$page
Определения order_form.php:33
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$password
Определения result.php:7
$error
Определения subscription_card_product.php:20