Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
textareaicon.php
1<?php
9namespace Bitrix\Im;
10
11use Bitrix\Main,
14Loc::loadMessages(__FILE__);
15
17{
18 const CACHE_TTL = 31536000;
19 const CACHE_PATH = '/bx/im/textareaicon/';
20
21 public static function register(array $fields)
22 {
23 $moduleId = $fields['MODULE_ID'];
24 if (strlen($moduleId) <= 0)
25 {
26 return false;
27 }
28
29 $iframe = '';
30 $iframeWidth = 350;
31 $iframeHeight = 250;
32 $jscommand = isset($fields['JS'])? $fields['JS']: '';
33
34 if (isset($fields['IFRAME']))
35 {
36 $check = parse_url($fields['IFRAME']);
37 if (!isset($check['scheme']) && !isset($check['host']))
38 {
39 if (strpos($fields['IFRAME'], '/desktop_app/iframe/') !== 0)
40 {
41 return false;
42 }
43 }
44 else if (!in_array($check['scheme'], Array('http', 'https')) || empty($check['host']))
45 {
46 return false;
47 }
48 $iframe = $fields['IFRAME'].(isset($check['query'])? '&': '?');
49 $iframeWidth = isset($fields['IFRAME_WIDTH']) && intval($fields['IFRAME_WIDTH']) > 250? intval($fields['IFRAME_WIDTH']): $iframeWidth;
50 $iframeHeight = isset($fields['IFRAME_HEIGHT']) && intval($fields['IFRAME_HEIGHT']) > 50? intval($fields['IFRAME_HEIGHT']): $iframeHeight;
51 }
52 else if (!$jscommand)
53 {
54 return false;
55 }
56
57
58 $icon = $fields['ICON_CODE'];
59 if (!$icon)
60 {
61 return false;
62 }
63
64 $iconFileId = intval($fields['ICON_FILE_ID']);
65
66 $hash = isset($fields['HASH'])? substr($fields['HASH'], 0, 32): 'register';
67 $context = isset($fields['CONTEXT'])? $fields['CONTEXT']: 'ALL';
68 $hidden = isset($fields['HIDDEN']) && $fields['HIDDEN'] == 'Y'? 'Y': 'N';
69 $botId = isset($fields['BOT_ID'])? intval($fields['BOT_ID']): 0;
70 if ($botId > 0 && (!\Bitrix\Im\User::getInstance($botId)->isExists() || !\Bitrix\Im\User::getInstance($botId)->isBot()))
71 {
72 $botId = 0;
73 }
74
75 $extranetSupport = isset($fields['EXTRANET_SUPPORT']) && $fields['EXTRANET_SUPPORT'] == 'Y'? 'Y': 'N';
76
77 /* vars for module install */
78 $class = isset($fields['CLASS'])? $fields['CLASS']: '';
79 $methodLangGet = isset($fields['METHOD_LANG_GET'])? $fields['METHOD_LANG_GET']: '';
80
81 /* vars for rest install */
82 $appId = isset($fields['APP_ID'])? $fields['APP_ID']: '';
83 $langSet = isset($fields['LANG'])? $fields['LANG']: Array();
84
85 if ($moduleId == 'rest')
86 {
87 if (empty($langSet))
88 {
89 return false;
90 }
91 }
92 else
93 {
94 if (empty($class) || empty($methodLangGet))
95 {
96 return false;
97 }
98 }
99
100 $icons = self::getListCache();
101 foreach ($icons as $cmd)
102 {
103 if ($botId)
104 {
105 if ($botId == $cmd['BOT_ID'] && $icon == $cmd['ICON_CODE'])
106 {
107 return $cmd['ID'];
108 }
109 }
110 else if ($appId)
111 {
112 if ($appId == $cmd['APP_ID'] && $icon == $cmd['ICON_CODE'])
113 {
114 return $cmd['ID'];
115 }
116 }
117 else if ($moduleId == $cmd['MODULE_ID'] && $icon == $cmd['ICON_CODE'])
118 {
119 return $cmd['ID'];
120 }
121 }
122
123 $result = \Bitrix\Im\Model\TextareaIconTable::add(Array(
124 'HASH' => $hash,
125 'BOT_ID' => $botId,
126 'MODULE_ID' => $moduleId,
127 'ICON_CODE' => $icon,
128 'ICON_FILE_ID' => $iconFileId,
129 'CONTEXT' => ToLower($context),
130 'HIDDEN' => $hidden,
131 'IFRAME' => $iframe,
132 'IFRAME_WIDTH' => $iframeWidth,
133 'IFRAME_HEIGHT' => $iframeHeight,
134 'JS' => $jscommand,
135 'EXTRANET_SUPPORT' => $extranetSupport,
136 'CLASS' => $class,
137 'METHOD_LANG_GET' => $methodLangGet,
138 'APP_ID' => $appId
139 ));
140
141 if (!$result->isSuccess())
142 return false;
143
144 $cache = \Bitrix\Main\Data\Cache::createInstance();
145 $cache->cleanDir(self::CACHE_PATH);
146
147 $iconId = $result->getId();
148
149 if ($moduleId == 'rest')
150 {
151 foreach ($langSet as $lang)
152 {
153 if (!isset($lang['LANGUAGE_ID']) || empty($lang['LANGUAGE_ID']))
154 continue;
155
156 if (!isset($lang['TITLE']) && empty($lang['TITLE']))
157 continue;
158
159 try
160 {
161 \Bitrix\Im\Model\TextareaIconLangTable::add(array(
162 'ICON_ID' => $iconId,
163 'LANGUAGE_ID' => strtolower($lang['LANGUAGE_ID']),
164 'TITLE' => $lang['TITLE'],
165 'DESCRIPTION' => $lang['DESCRIPTION'],
166 'COPYRIGHT' => $lang['COPYRIGHT']
167 ));
168 }
169 catch(Exception $e)
170 {
171 }
172 }
173 }
174
175 return $iconId;
176 }
177
178 public static function unRegister(array $icon)
179 {
180 $iconId = intval($icon['ICON_ID']);
181 $moduleId = isset($icon['MODULE_ID'])? $icon['MODULE_ID']: '';
182 $appId = isset($icon['APP_ID'])? $icon['APP_ID']: '';
183
184 if (intval($iconId) <= 0)
185 return false;
186
187 if (!isset($icon['FORCE']) || $icon['FORCE'] == 'N')
188 {
189 $icons = self::getListCache();
190 if (!isset($icons[$iconId]))
191 return false;
192
193 if (strlen($moduleId) > 0 && $icons[$iconId]['MODULE_ID'] != $moduleId)
194 return false;
195
196 if (strlen($appId) > 0 && $icons[$iconId]['APP_ID'] != $appId)
197 return false;
198 }
199
200 \Bitrix\Im\Model\TextareaIconTable::delete($iconId);
201
202 $orm = \Bitrix\Im\Model\TextareaIconLangTable::getList(Array(
203 'filter' => Array('=ICON_ID' => $iconId)
204 ));
205 while ($row = $orm->fetch())
206 {
207 \Bitrix\Im\Model\TextareaIconLangTable::delete($row['ID']);
208 }
209
210 $cache = \Bitrix\Main\Data\Cache::createInstance();
211 $cache->cleanDir(self::CACHE_PATH);
212
213 if (\Bitrix\Main\Loader::includeModule('pull'))
214 {
215 \CPullStack::AddShared(Array(
216 'module_id' => 'im',
217 'command' => 'deleteTextareaIcon',
218 'params' => Array(
219 'iconId' => $iconId
220 )
221 ));
222 }
223
224 return true;
225 }
226
227 public static function update(array $icon, array $updateFields)
228 {
229 $iconId = intval($icon['ICON_ID']);
230 $userId = intval($icon['USER_ID']);
231 $moduleId = isset($icon['MODULE_ID'])? $icon['MODULE_ID']: '';
232 $appId = isset($icon['APP_ID'])? $icon['APP_ID']: '';
233
234 if (intval($iconId) <= 0)
235 return false;
236
237 $commands = self::getListCache();
238 if (!isset($commands[$iconId]))
239 return false;
240
241 if (strlen($moduleId) > 0 && $commands[$iconId]['MODULE_ID'] != $moduleId)
242 return false;
243
244 if (strlen($appId) > 0 && $commands[$iconId]['APP_ID'] != $appId)
245 return false;
246
247 if (isset($updateFields['LANG']) && $commands[$iconId]['MODULE_ID'] == 'rest')
248 {
249 $orm = \Bitrix\Im\Model\TextareaIconLangTable::getList(Array(
250 'filter' => Array('=ICON_ID' => $iconId)
251 ));
252 while ($row = $orm->fetch())
253 {
254 \Bitrix\Im\Model\TextareaIconLangTable::delete($row['ID']);
255 }
256 foreach ($updateFields['LANG'] as $lang)
257 {
258 if (!isset($lang['LANGUAGE_ID']) || empty($lang['LANGUAGE_ID']))
259 continue;
260
261 if (!isset($lang['TITLE']) && empty($lang['TITLE']))
262 continue;
263
264 try
265 {
266 \Bitrix\Im\Model\TextareaIconLangTable::add(array(
267 'ICON_ID' => $iconId,
268 'LANGUAGE_ID' => strtolower($lang['LANGUAGE_ID']),
269 'TITLE' => $lang['TITLE'],
270 'DESCRIPTION' => $lang['DESCRIPTION'],
271 'COPYRIGHT' => $lang['COPYRIGHT']
272 ));
273 }
274 catch(Exception $e)
275 {
276 }
277 }
278 }
279
280 $update = Array();
281 if (isset($updateFields['CONTEXT']) && !empty($updateFields['CONTEXT']))
282 {
283 $update['CONTEXT'] = ToLower($updateFields['CONTEXT']);
284 }
285 if (isset($updateFields['HASH']) && !empty($updateFields['HASH']))
286 {
287 $update['HASH'] = $updateFields['HASH'];
288 }
289 if (isset($updateFields['HIDDEN']))
290 {
291 $update['HIDDEN'] = $updateFields['HIDDEN'] == 'Y'? 'Y': 'N';
292 }
293 if (isset($updateFields['IFRAME']) && !empty($updateFields['IFRAME']))
294 {
295 $check = parse_url($updateFields['IFRAME']);
296 if (!isset($check['scheme']) && !isset($check['host']))
297 {
298 if (strpos($updateFields['IFRAME'], '/desktop_app/iframe/') !== 0)
299 {
300 return false;
301 }
302 }
303 else if (!in_array($check['scheme'], Array('http', 'https')) || empty($check['host']))
304 {
305 return false;
306 }
307 $update['IFRAME'] = $updateFields['IFRAME'].(isset($check['query'])? '&': '?');
308 }
309 else if (isset($updateFields['JS']) && !empty($updateFields['JS']))
310 {
311 $update['JS'] = $updateFields['JS'];
312 }
313 if (isset($updateFields['IFRAME_WIDTH']))
314 {
315 $update['IFRAME_WIDTH'] = intval($updateFields['IFRAME_WIDTH']) > 250? intval($updateFields['IFRAME_WIDTH']): 350;
316 }
317 if (isset($updateFields['IFRAME_HEIGHT']))
318 {
319 $update['IFRAME_HEIGHT'] = intval($updateFields['IFRAME_HEIGHT']) > 50? intval($updateFields['IFRAME_HEIGHT']): 150;
320 }
321 if (isset($updateFields['ICON_FILE_ID']))
322 {
323 $update['ICON_FILE_ID'] = intval($updateFields['ICON_FILE_ID']);
324 }
325 if (isset($updateFields['CLASS']) && !empty($updateFields['CLASS']))
326 {
327 $update['CLASS'] = $updateFields['CLASS'];
328 }
329 if (isset($updateFields['METHOD_LANG_GET']))
330 {
331 $update['METHOD_LANG_GET'] = $updateFields['METHOD_LANG_GET'];
332 }
333 if (isset($updateFields['EXTRANET_SUPPORT']))
334 {
335 $update['EXTRANET_SUPPORT'] = $updateFields['EXTRANET_SUPPORT'] == 'Y'? 'Y': 'N';
336 }
337
338 if (!empty($update))
339 {
340 \Bitrix\Im\Model\TextareaIconTable::update($iconId, $update);
341
342 $cache = \Bitrix\Main\Data\Cache::createInstance();
343 $cache->cleanDir(self::CACHE_PATH);
344 }
345
346 if (\Bitrix\Main\Loader::includeModule('pull'))
347 {
348 if ($update['HASH'] || $update['CONTEXT'] || $update['IFRAME'] || $update['JS'] || $update['IFRAME_WIDTH'] || $update['IFRAME_HEIGHT'])
349 {
350 \CPullStack::AddShared(Array(
351 'module_id' => 'im',
352 'command' => 'updateTextareaIcon',
353 'params' => Array(
354 'iconId' => $iconId,
355 'userId' => $userId,
356 'hash' => $update['HASH'],
357 'context' => $update['CONTEXT'],
358 'js' => $update['JS'],
359 'iframe' => $update['IFRAME'],
360 'iframeWidth' => $update['IFRAME_WIDTH'],
361 'iframeHeight' => $update['IFRAME_HEIGHT'],
362 )
363 ));
364 }
365 else
366 {
367 \CPullStack::AddShared(Array(
368 'module_id' => 'im',
369 'command' => 'deleteTextareaIcon',
370 'params' => Array(
371 'iconId' => $iconId
372 )
373 ));
374 }
375
376
377 }
378
379 return true;
380 }
381
382 public static function addToken(array $params)
383 {
384 $botId = intval($params['BOT_ID']);
385 $userId = intval($params['USER_ID']);
386
387 Bot\Token::add($botId, $params['DIALOG_ID']);
388 Bot\Token::add($userId, $params['DIALOG_ID']);
389
390 if (!self::isChat($params['DIALOG_ID']))
391 {
392 Bot\Token::add($botId, $params['USER_ID']);
393 }
394
395 return true;
396 }
397
398 public static function addMessage(array $access, array $messageFields)
399 {
400 $iconId = intval($access['ICON_ID']);
401 $moduleId = isset($access['MODULE_ID'])? $access['MODULE_ID']: '';
402 $appId = isset($access['APP_ID'])? $access['APP_ID']: '';
403
404 if ($iconId <= 0)
405 return false;
406
407 $icons = self::getListCache();
408 if (!isset($icons[$iconId]))
409 return false;
410
411 if (strlen($moduleId) > 0 && $icons[$iconId]['MODULE_ID'] != $moduleId)
412 return false;
413
414 if (strlen($appId) > 0 && $icons[$iconId]['APP_ID'] != $appId)
415 return false;
416
417 $botId = intval($icons[$iconId]['BOT_ID']);
418
419 if (self::isChat($messageFields['DIALOG_ID']))
420 {
421 $relations = \CIMChat::GetRelationById(substr($messageFields['DIALOG_ID'], 4));
422 }
423 else
424 {
425 $userId = intval($messageFields['DIALOG_ID']);
426 if (!$userId || $botId == $userId)
427 {
428 return false;
429 }
430 $relations = \CIMChat::GetPrivateRelation($botId, $userId);
431 }
432
433 if ($botId && !Bot\Token::isActive($botId, $messageFields['DIALOG_ID']))
434 {
435 return false;
436 }
437
438 $messageFields['ATTACH'] = $messageFields['ATTACH']? $messageFields['ATTACH']: null;
439 $messageFields['KEYBOARD'] = $messageFields['KEYBOARD']? $messageFields['KEYBOARD']: null;
440
441 $fromUserId = isset($messageFields['FROM_USER_ID'])? $messageFields['FROM_USER_ID']: $botId;
442
443 if (self::isChat($messageFields['DIALOG_ID']))
444 {
445 $chatId = intval(substr($messageFields['DIALOG_ID'], 4));
446 if ($chatId <= 0)
447 return false;
448
449 if (isset($relations[$fromUserId]) && $messageFields['SYSTEM'] != 'Y')
450 {
451 $ar = Array(
452 "FROM_USER_ID" => $fromUserId,
453 "TO_CHAT_ID" => $chatId,
454 "ATTACH" => $messageFields['ATTACH'],
455 "KEYBOARD" => $messageFields['KEYBOARD'],
456 );
457 if (isset($messageFields['MESSAGE']))
458 {
459 $ar['MESSAGE'] = $messageFields['MESSAGE'];
460 }
461 }
462 else
463 {
464 $ar = Array(
465 "FROM_USER_ID" => isset($relations[$fromUserId])? $fromUserId: 0,
466 "TO_CHAT_ID" => $chatId,
467 "ATTACH" => $messageFields['ATTACH'],
468 "KEYBOARD" => $messageFields['KEYBOARD'],
469 "SYSTEM" => 'Y',
470 );
471 if (isset($messageFields['MESSAGE']))
472 {
473 $ar['MESSAGE'] = $messageFields['MESSAGE'];
474 }
475
476 $ar['MESSAGE'] = "[B]".$icons[$iconId]['TITLE']."[/B]\n".$ar['MESSAGE'];
477 }
478
479 if (isset($messageFields['URL_PREVIEW']) && $messageFields['URL_PREVIEW'] == 'N')
480 {
481 $ar['URL_PREVIEW'] = 'N';
482 }
483
484 $ar['SKIP_USER_CHECK'] = 'Y';
485 $ar['SKIP_COMMAND'] = 'Y';
486
487 $id = \CIMChat::AddMessage($ar);
488 }
489 else
490 {
491 $userId = intval($messageFields['DIALOG_ID']);
492 \CModule::IncludeModule('imbot');
493
494 if (isset($relations[$fromUserId]) && $messageFields['SYSTEM'] != 'Y')
495 {
496 $ar = Array(
497 "FROM_USER_ID" => $fromUserId,
498 "TO_USER_ID" => $userId,
499 "ATTACH" => $messageFields['ATTACH'],
500 "KEYBOARD" => $messageFields['KEYBOARD'],
501 );
502 if (isset($messageFields['MESSAGE']))
503 {
504 $ar['MESSAGE'] = $messageFields['MESSAGE'];
505 }
506 }
507 else
508 {
509 $ar = Array(
510 "FROM_USER_ID" => isset($relations[$fromUserId])? $fromUserId: 0,
511 "TO_USER_ID" => $userId,
512 "ATTACH" => $messageFields['ATTACH'],
513 "KEYBOARD" => $messageFields['KEYBOARD'],
514 "SYSTEM" => "Y",
515 );
516 if (isset($messageFields['MESSAGE']))
517 {
518 $ar['MESSAGE'] = $messageFields['MESSAGE'];
519 }
520
521 $ar['MESSAGE'] = "[B]".$icons[$iconId]['TITLE']."[/B]\n".$ar['MESSAGE'];
522 }
523
524 if (isset($messageFields['URL_PREVIEW']) && $messageFields['URL_PREVIEW'] == 'N')
525 {
526 $ar['URL_PREVIEW'] = 'N';
527 }
528
529 $ar['SKIP_COMMAND'] = 'Y';
530 $id = \CIMMessage::Add($ar);
531 }
532
533 return $id;
534 }
535
536 public static function isChat($dialogId)
537 {
538 $isChat = false;
539 if (is_string($dialogId) && substr($dialogId, 0, 4) == 'chat')
540 {
541 $isChat = true;
542 }
543
544 return $isChat;
545 }
546
547 public static function getListCache($lang = LANGUAGE_ID)
548 {
549 $cache = \Bitrix\Main\Data\Cache::createInstance();
550 if($cache->initCache(self::CACHE_TTL, 'list_v2_'.$lang, self::CACHE_PATH))
551 {
552 $result = $cache->getVars();
553 }
554 else
555 {
556 $loadRestLang = false;
557 $result = Array();
558 $orm = \Bitrix\Im\Model\TextareaIconTable::getList();
559 while ($row = $orm->fetch())
560 {
561 $row['ICON_ID'] = $row['ID'];
562
563 if ($row['ICON_FILE_ID'])
564 {
565 $image = \CFile::ResizeImageGet(
566 $row['ICON_FILE_ID'],
567 array('width' => 108, 'height' => 66),
568 BX_RESIZE_IMAGE_PROPORTIONAL,
569 false,
570 false,
571 true
572 );
573 $row['ICON_URL'] = empty($image['src'])? '': $image['src'];
574 }
575 else
576 {
577 $row['ICON_URL'] = '';
578 }
579
580 if (!empty($row['CLASS']) && !empty($row['METHOD_LANG_GET']))
581 {
582 if (\Bitrix\Main\Loader::includeModule($row['MODULE_ID']) && class_exists($row["CLASS"]) && method_exists($row["CLASS"], $row["METHOD_LANG_GET"]))
583 {
584 $localize = call_user_func_array(array($row["CLASS"], $row["METHOD_LANG_GET"]), Array($row['ICON_CODE'], $lang));
585 if ($localize)
586 {
587 $row['TITLE'] = $localize['TITLE'];
588 $row['DESCRIPTION'] = $localize['DESCRIPTION'];
589 $row['COPYRIGHT'] = $localize['COPYRIGHT'];
590 }
591 else
592 {
593 $row['METHOD_LANG_GET'] = '';
594 }
595 }
596 else
597 {
598 $row['METHOD_LANG_GET'] = '';
599 }
600 }
601 else
602 {
603 $row['TITLE'] = '';
604 $row['DESCRIPTION'] = '';
605 $row['COPYRIGHT'] = '';
606
607 if ($row['MODULE_ID'] == 'rest')
608 {
609 $loadRestLang = true;
610 }
611 }
612 $result[$row['ICON_ID']] = $row;
613 }
614
615 if ($loadRestLang)
616 {
617 $langSet = Array();
618 $orm = \Bitrix\Im\Model\TextareaIconLangTable::getList();
619 while ($row = $orm->fetch())
620 {
621 if (!isset($result[$row['ICON_ID']]))
622 continue;
623
624 $langSet[$row['ICON_ID']][$row['LANGUAGE_ID']]['TITLE'] = $row['TITLE'];
625 $langSet[$row['ICON_ID']][$row['LANGUAGE_ID']]['DESCRIPTION'] = $row['DESCRIPTION'];
626 $langSet[$row['ICON_ID']][$row['LANGUAGE_ID']]['COPYRIGHT'] = $row['COPYRIGHT'];
627 }
628
629 $langAlter = \Bitrix\Im\Bot::getDefaultLanguage();
630 foreach ($result as $iconId => $commandData)
631 {
632 if (isset($langSet[$iconId][$lang]))
633 {
634 $result[$iconId]['TITLE'] = $langSet[$iconId][$lang]['TITLE'];
635 $result[$iconId]['DESCRIPTION'] = $langSet[$iconId][$lang]['DESCRIPTION'];
636 $result[$iconId]['COPYRIGHT'] = $langSet[$iconId][$lang]['COPYRIGHT'];
637 }
638 else if (isset($langSet[$iconId][$langAlter]))
639 {
640 $result[$iconId]['TITLE'] = $langSet[$iconId][$langAlter]['TITLE'];
641 $result[$iconId]['DESCRIPTION'] = $langSet[$iconId][$langAlter]['DESCRIPTION'];
642 $result[$iconId]['COPYRIGHT'] = $langSet[$iconId][$langAlter]['COPYRIGHT'];
643 }
644 else if (isset($langSet[$iconId]))
645 {
646 $langSetCommand = array_values($langSet[$iconId]);
647 $result[$iconId]['TITLE'] = $langSetCommand[0]['TITLE'];
648 $result[$iconId]['DESCRIPTION'] = $langSetCommand[0]['DESCRIPTION'];
649 $result[$iconId]['COPYRIGHT'] = $langSetCommand[0]['COPYRIGHT'];
650 }
651 }
652
653 foreach ($result as $key => $value)
654 {
655 if (empty($value['TITLE']))
656 {
657 $row['METHOD_LANG_GET'] = '';
658 }
659 }
660 }
661
662 $cache->startDataCache();
663 $cache->endDataCache($result);
664 }
665
666
667 return $result;
668 }
669
670 public static function getListForJs($lang = LANGUAGE_ID)
671 {
672 $icons = self::getListCache($lang);
673
674 $userId = $GLOBALS['USER']? $GLOBALS['USER']->GetId(): 0;
675 if ($userId && \Bitrix\Im\User::getInstance($userId)->isExtranet())
676 {
677 return Array();
678 }
679
680 $result = Array();
681 foreach ($icons as $icon)
682 {
683 $botData = \Bitrix\Im\Bot::getCache($icon['BOT_ID']);
684 $result[] = Array(
685 'id' => $icon['ICON_ID'],
686 'botId' => $icon['BOT_ID'],
687 'botCode' => $botData['CODE'],
688 'hash' => $icon['HASH'],
689 'userHash' => self::getUserHash($userId),
690 'code' => $icon['ICON_CODE'],
691 'url' => $icon['ICON_URL'],
692 'iframe' => $icon['IFRAME'],
693 'iframeWidth' => $icon['IFRAME_WIDTH'],
694 'iframeHeight' => $icon['IFRAME_HEIGHT'],
695 'js' => $icon['JS'],
696 'context' => ToLower($icon['CONTEXT']),
697 'extranet' => $icon['EXTRANET_SUPPORT'] == 'Y',
698 'hidden' => $icon['HIDDEN'] == 'Y',
699 'title' => $icon['TITLE'],
700 'description' => $icon['DESCRIPTION'],
701 'copyright' => $icon['COPYRIGHT'],
702 );
703 }
704
705 return $result;
706 }
707
708 public static function getUserHash($userId)
709 {
710 return md5($userId.\CMain::GetServerUniqID());
711 }
712
713 public static function clearCache()
714 {
715 $cache = \Bitrix\Main\Data\Cache::createInstance();
716 $cache->cleanDir(self::CACHE_PATH);
717
718 return true;
719 }
720}
static addMessage(array $access, array $messageFields)
static update(array $icon, array $updateFields)
static isChat($dialogId)
static getListCache($lang=LANGUAGE_ID)
static getListForJs($lang=LANGUAGE_ID)
static getUserHash($userId)
static addToken(array $params)
static unRegister(array $icon)
static getInstance($userId=null)
Definition user.php:44
static loadMessages($file)
Definition loc.php:64
$GLOBALS['____1444769544']
Definition license.php:1