11require_once(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/classes/general/update_client_partner.php");
12require_once(
$_SERVER[
"DOCUMENT_ROOT"].
"/bitrix/modules/main/classes/general/admin_informer.php");
19 if(\
Bitrix\Main\Application::getInstance()->getLicense()->isDemoKey())
23 if(!
$USER->CanDoOperation(
'install_updates'))
27 $daysCheck = intval(COption::GetOptionString(
'main',
'update_autocheck',
'1'));
30 $arModulesResult = unserialize(COption::GetOptionString(
"main",
"last_mp_modules_result"), [
'allowed_classes' =>
false]);
31 if(!is_array($arModulesResult))
33 $arModulesResult =
array(
"check_date" => 0);
36 if ($arModulesResult[
"check_date"] + 86400*$daysCheck < time())
41 $arNewPartnersModules = ($arInstalledModules ?
self::checkUpdates($arInstalledModules, 1, $daysCheck) :
array());
42 $arModulesResult =
array(
43 "check_date" => time(),
44 'update_module' => $arModulesUpdates,
45 'end_update' => $arDateEndModules,
46 'new_module' => $arNewPartnersModules,
48 COption::SetOptionString(
50 'last_mp_modules_result',
51 serialize($arModulesResult)
66 $stableVersionsOnly = COption::GetOptionString(
"main",
"stable_versions_only",
"Y");
72 Array(
"fullmoduleinfo" =>
"Y")
74 $arEndUpdateModules =
array();
77 if (isset($arUpdateList[
"MODULE"]) && is_array($arUpdateList[
"MODULE"]))
80 $curDateFrom =
new Date;
81 $curDateTo =
new Date;
82 $curDateFrom = $curDateFrom->
add(
"30 days");
83 $curDateTo = $curDateTo->add(strval($daysCheck).
" days");
85 for (
$i = 0, $cnt =
count($arUpdateList[
"MODULE"]);
$i < $cnt;
$i++)
87 if ($arUpdateList[
"MODULE"][
$i][
'@'][
'DATE_TO'] <>
'' && Date::isCorrect($arUpdateList[
"MODULE"][
$i][
'@'][
'DATE_TO']))
89 $dateTo =
new Date($arUpdateList[
"MODULE"][
$i][
'@'][
'DATE_TO']);
90 $ID = $arUpdateList[
"MODULE"][
$i][
"@"][
"ID"];
91 if ($dateTo >= $curDateFrom && $dateTo < $curDateTo)
94 'ID' => $arUpdateList[
"MODULE"][
$i][
"@"][
"ID"],
95 'NAME' => $arUpdateList[
"MODULE"][
$i][
"@"][
"NAME"],
96 'VERSION' => $arUpdateList[
"MODULE"][
$i][
"@"][
"DATE_TO"],
97 'DATE_TO' => $arUpdateList[
"MODULE"][
$i][
"@"][
"DATE_TO"],
104 return $arEndUpdateModules;
108 public static function checkUpdates($arModules, $searchType, $daysCheck){
109 $stableVersionsOnly = COption::GetOptionString(
"main",
"stable_versions_only",
"Y");
117 "search_module_id" => (is_array($arModules) ? implode(
",", $arModules) : $arModules),
118 "search_page" =>
"SEARCH_NEW",
119 "search_category" => $daysCheck,
120 "search_type" => $searchType,
125 $arResultModules =
array();
127 if ($strError_tmp ==
'')
130 if (!empty(
$arResult[
'DATA'][
'#'][
'MODULE']) && is_array(
$arResult[
'DATA'][
'#'][
'MODULE']))
132 foreach (
$arResult[
'DATA'][
'#'][
'MODULE'] as $arModule)
134 if ($searchType == 1)
136 $arResultModules[$arModule[
'@'][
'PARTNER_ID']][] = $arModule[
'@'];
140 $arResultModules[$arModule[
'@'][
'ID']] = $arModule[
'@'];
145 return $arResultModules;
150 foreach ($arModules as $arModule)
152 $moduleLink = (($arrayId ==
'end_update') ?
'/bitrix/admin/partner_modules.php' :
'/bitrix/admin/update_system_market.php?module='.$arModule[
'ID']);
154 'TITLE' =>
GetMessage($arNotifierText[
'TITLE']),
156 'FOOTER' =>
"<a href=\"javascript:void(0)\" onclick=\"hideMpNotification(this, '".
157 CUtil::JSEscape($arModule[
'ID']).
159 CUtil::JSEscape($arrayId).
161 "style=\"float: right !important; font-size: 0.8em !important;\">".
162 GetMessage(
'TOP_PANEL_AI_MODULE_UPDATE_BUTTON_HIDE').
167 "\" target=\"_blank\" ".
168 "onclick=\"hideMpNotification(this, '".
169 CUtil::JSEscape($arModule[
'ID']).
171 CUtil::JSEscape($arrayId).
173 GetMessage(
'TOP_PANEL_AI_MODULE_UPDATE_BUTTON_VIEW').
176 'HTML' =>
GetMessage($arNotifierText[
'HTML'],
array(
"#NAME#" => $arModule[
"NAME"],
"#PARTNER#" => $arModule[
"PARTNER"])).self::addJsToInformer(),
186 $arRequestedModules =
array();
188 if ($strError_tmp ==
'')
190 if (!empty($arClientModules))
192 foreach ($arClientModules as
$key => $value)
194 if (str_contains(
$key,
"."))
196 $arRequestedModules[] =
$key;
199 return $arRequestedModules;
208 $serverName = (CMain::IsHTTPS() ?
"https" :
"http").
"://".((defined(
"SITE_SERVER_NAME") && SITE_SERVER_NAME <>
'') ? SITE_SERVER_NAME : COption::GetOptionString(
"main",
"server_name",
""));
209 if (empty($arModulesResult[
'update_module']) && empty($arModulesResult[
'end_update']) && ($arModulesResult[
'new_module']) <= 0)
213 if (!empty($arModulesResult[
'update_module']))
215 self::addNotificationsToInformer($arModulesResult[
'update_module'],
array(
'TITLE' =>
'TOP_PANEL_AI_MODULE_UPDATE',
'HTML' =>
'TOP_PANEL_AI_MODULE_UPDATE_DESC'),
'update_module', $serverName);
217 if (!empty($arModulesResult[
'end_update']))
219 self::addNotificationsToInformer($arModulesResult[
'end_update'],
array(
'TITLE' =>
'TOP_PANEL_AI_MODULE_END_UPDATE',
'HTML' =>
'TOP_PANEL_AI_MODULE_END_UPDATE_DESC'),
'end_update', $serverName);
221 if (!empty($arModulesResult[
'new_module']))
229 foreach ($arModules as $partnerID => $arPartnerModules)
232 'TITLE' =>
GetMessage(
"TOP_PANEL_AI_NEW_MODULE_TITLE"),
234 'FOOTER' =>
"<a href=\"javascript:void(0)\" onclick=\"hideMpNotification(this, '".
235 CUtil::JSEscape($partnerID).
237 CUtil::JSEscape(
'new_module').
239 "style=\"float: right !important; font-size: 0.8em !important;\">".
240 GetMessage(
'TOP_PANEL_AI_MODULE_UPDATE_BUTTON_HIDE').
243 'HTML' =>
GetMessage(
'TOP_PANEL_AI_NEW_MODULE_DESC',
array(
"#PARTNER#" => $arPartnerModules[0][
'PARTNER'])),
245 foreach ($arPartnerModules as $arModule)
247 $arParams[
'HTML'] .=
'<a href="'.$serverName.
'/bitrix/admin/update_system_market.php?module='.$arModule[
'ID'].
'" target="_blank">'.$arModule[
'NAME'].
'</a><br>';
258 function hideMpNotification(el, module, array_id)
260 if(el.parentNode.parentNode.parentNode)
261 BX.hide(el.parentNode.parentNode.parentNode);
265 "url": "/bitrix/admin/partner_modules.php",
266 "data": "module="+module+"&'.bitrix_sessid_get().
'&act=unnotify_mp&array_id="+array_id,
268 "processData": false,
static checkModulesEndDate($arRequestedModules, $daysCheck)
static getClientInstalledModules()
static addNotificationsPartnersNewModulesToInformer($arModules, $serverName)
static addNotificationsToInformer($arModules, $arNotifierText, $arrayId, $serverName)
static checkUpdates($arModules, $searchType, $daysCheck)
static OnAdminInformerInsertItemsHandlerMP()
static addMpNotifications($arModulesResult)
static GetCurrentModules(&$strError)
static __ParseServerData(&$strServerOutput, &$arRes, &$strError)
static GetUpdatesList(&$strError, $lang=false, $stableVersionsOnly="Y", $arRequestedModules=array(), $aditData=Array())
static __CollectRequestData(&$strError, $lang=false, $stableVersionsOnly="Y", $arRequestedModules=array(), $arAdditionalData=array(), $bStrongList=false)
static __GetHTTPPage($page, $strVars, &$strError)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage
$_SERVER["DOCUMENT_ROOT"]
GetMessage($name, $aReplace=null)
if(empty($signedUserToken)) $key
</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."%"