function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if (!$DB->Query("SELECT 'x' FROM b_pull_stack", true)) { $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/pull/install/db/" . strtolower($DB->type) . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("pull"); RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/pull/ajax_hit.php"); RegisterModuleDependences("main", "OnEpilog", "pull", "CPullWatch", "DeferredSql"); RegisterModuleDependences("main", "OnEpilog", "pull", "CPullOptions", "OnEpilog"); RegisterModuleDependences("perfmon", "OnGetTableSchema", "pull", "CPullTableSchema", "OnGetTableSchema"); RegisterModuleDependences("main", "OnAfterRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); RegisterModuleDependences("main", "OnAfterUnRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); if (IsModuleInstalled('intranet')) { RegisterModuleDependences("main", "OnAfterUserAuthorize", "pull", "CPullChannel", "OnAfterUserAuthorize"); RegisterModuleDependences("main", "OnAfterUserLogout", "pull", "CPullChannel", "OnAfterUserLogout"); } CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 30, "FULL")); return true; }
function storeResult($arResult, $arParams) { $iblock = CIBlock::GetList( array(), array( 'TYPE' => $arParams['IBLOCK_TYPE'], 'CODE' => $arParams['IBLOCK_CODE'], ) ); $iblock = $iblock->Fetch(); $el = new CIBlockElement; $props = array(); foreach ($arResult['FIELDS_LIST'] as $arField) { if ($arField['FIELD_TYPE'] == 'TEXT' || $arField['FIELD_TYPE'] == 'NUMBER') { $props[$arField['CODE']] = array( 'VALUE' => $arResult['POST_DATA']['~'.$arField['CODE']], ); } elseif ($arField['FIELD_TYPE'] == 'TEXTAREA') { $props[$arField['CODE']] = array( 'VALUE' => array( 'TYPE' => 'text', 'TEXT' => $arResult['POST_DATA']['~'.$arField['CODE']], ), ); } elseif ($arField['FIELD_TYPE'] == 'LIST') { $propEnum = CIBlockPropertyEnum::GetList( array(), array( 'XML_ID' => $arResult['POST_DATA']['~'.$arField['CODE']], 'CODE' => $arField['CODE'], 'IBLOCK_ID' => $iblock['ID'], ) ); $propEnum = $propEnum->Fetch(); if ( ! $propEnum) return false; $props[$arField['CODE']] = array( 'VALUE' => $propEnum['ID'], ); } } $res = $el->Add(array( 'IBLOCK_TYPE' => $arParams['IBLOCK_TYPE'], 'IBLOCK_ID' => $iblock['ID'], 'ACTIVE' => 'Y', 'PROPERTY_VALUES' => $props, 'ACTIVE_FROM' => ConvertTimeStamp(time()+CTimeZone::GetOffset(), 'FULL'), 'NAME' => 'Form result', # !!! NEED TO REPLACE TO DEFAULT VALUE )); if (!$res) { return array( 'MESSAGE' => $el->LAST_ERROR, ); } return true; }
function ConditionParse($c = '') { global $strCondition, $arGroupsNames, $arDisplay, $arConditionTypes, $strFolder, $strUrl_param, $strUrl_value, $arSelGroups, $strPer_start, $strPer_end, $CurType; $strCondition = $c; $arDisplay = array("empty" => "none", "folder" => "none", "ugroups" => "none", "period" => "none", "url" => "none", "php" => "none", "false" => "none"); $CurType = ""; $strFolder = ""; $strUrl_param = ""; $strUrl_value = ""; $arSelGroups = array(); $strPer_start = ""; $strPer_end = ""; if (preg_match('/^CSite::InDir\\(\'([^)]+)\'\\)$/', $c, $r)) { $CurType = 'folder'; $strFolder = stripslashes($r[1]); } elseif (preg_match('/^CSite::InGroup\\(array\\(([0-9, ]+)\\)\\)$/', $c, $r)) { $CurType = 'ugroups'; $arSelGroups = explode(",", str_replace(" ", "", $r[1])); } elseif (preg_match('/^CSite::InPeriod\\(([0-9]+) *, *([0-9]+)\\)$/', $c, $r)) { $strPer_start = $r[1] == 0 ? "" : ConvertTimeStamp($r[1]); $strPer_end = $r[2] == 0 ? "" : ConvertTimeStamp($r[2]); $CurType = 'period'; } elseif (preg_match('/^\\$_GET\\[\'(.+)\'\\] *== *\'(.+)\'$/', $c, $r)) { $CurType = 'url'; $strUrl_param = stripslashes($r[1]); $strUrl_value = stripslashes($r[2]); } elseif ($c == 'false') { $CurType = 'false'; } elseif (empty($c)) { $CurType = 'empty'; } else { $CurType = 'php'; } $arDisplay[$CurType] = 'block'; }
public static function CheckExpireAgent() { global $DB; if (!CPullOptions::ModuleEnable()) return false; CAgent::RemoveAgent("CPullWatch::CheckExpireAgent();", "pull"); $strSql = "SELECT count(ID) CNT FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE)"; $dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__); if ($arRes = $dbRes->Fetch()) { $strSql = "DELETE FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE) LIMIT 1000"; $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__); if ($arRes['CNT'] > 1000) { CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 180, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+180, "FULL")); return false; } } CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 600, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+600, "FULL")); return false; }
public function prepareUser($arFBUser, $short = false) { $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arFBUser["id"], 'LOGIN' => "FB_" . $arFBUser["id"], 'EMAIL' => $arFBUser["email"] != '' ? $arFBUser["email"] : '', 'NAME' => $arFBUser["first_name"], 'LAST_NAME' => $arFBUser["last_name"], 'OATOKEN' => $this->entityOAuth->getToken(), 'OATOKEN_EXPIRES' => $this->entityOAuth->getAccessTokenExpires()); if (!$short && isset($arFBUser['picture']['data']['url']) && !$arFBUser['picture']['data']['is_silhouette']) { $picture_url = CFacebookInterface::GRAPH_URL . '/' . $arFBUser['id'] . '/picture?type=large'; $temp_path = CFile::GetTempName('', 'picture.jpg'); $ob = new \Bitrix\Main\Web\HttpClient(array("redirect" => true)); $ob->download($picture_url, $temp_path); $arPic = CFile::MakeFileArray($temp_path); if ($arPic) { $arFields["PERSONAL_PHOTO"] = $arPic; } } if (isset($arFBUser['birthday'])) { if ($date = MakeTimeStamp($arFBUser['birthday'], "MM/DD/YYYY")) { $arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date); } } if (isset($arFBUser['gender']) && $arFBUser['gender'] != '') { if ($arFBUser['gender'] == 'male') { $arFields["PERSONAL_GENDER"] = 'M'; } elseif ($arFBUser['gender'] == 'female') { $arFields["PERSONAL_GENDER"] = 'F'; } } $arFields["PERSONAL_WWW"] = $this->getProfileUrl($arFBUser['id']); if (strlen(SITE_ID) > 0) { $arFields["SITE_ID"] = SITE_ID; } return $arFields; }
function Add($LOG_ID, $GROUP_CODE) { global $DB; if (is_array($GROUP_CODE)) { foreach($GROUP_CODE as $GROUP_CODE_TMP) CSocNetLogRights::Add($LOG_ID, $GROUP_CODE_TMP); return false; } else { $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogRightsAdd"); while ($arEvent = $db_events->Fetch()) if (ExecuteModuleEventEx($arEvent, array($LOG_ID, &$GROUP_CODE))===false) return false; $NEW_RIGHT_ID = $DB->Add("b_sonet_log_right", array( "LOG_ID" => $LOG_ID, "GROUP_CODE" => $GROUP_CODE, )); if (preg_match('/^U(\d+)$/', $GROUP_CODE, $matches)) CSocNetLogFollow::Set($matches[1], "L".$LOG_ID, "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL", SITE_ID)); if(defined("BX_COMP_MANAGED_CACHE")) $GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_".intval($LOG_ID)); return $NEW_RIGHT_ID; } }
function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if (!$DB->Query("SELECT 'x' FROM b_im_chat", true)) { $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/im/install/db/" . strtolower($DB->type) . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("im"); RegisterModuleDependences('main', 'OnAddRatingVote', 'im', 'CIMEvent', 'OnAddRatingVote'); RegisterModuleDependences('main', 'OnCancelRatingVote', 'im', 'CIMEvent', 'OnCancelRatingVote'); RegisterModuleDependences('main', 'OnAfterUserUpdate', 'im', 'CIMEvent', 'OnAfterUserUpdate'); RegisterModuleDependences('main', 'OnUserDelete', 'im', 'CIMEvent', 'OnUserDelete'); RegisterModuleDependences("pull", "OnGetDependentModule", "im", "CIMEvent", "OnGetDependentModule"); RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/im/ajax_hit.php"); RegisterModuleDependences("perfmon", "OnGetTableSchema", "im", "CIMTableSchema", "OnGetTableSchema"); RegisterModuleDependences("im", "OnGetNotifySchema", "im", "CIMNotifySchema", "OnGetNotifySchema"); RegisterModuleDependences("main", "OnFileDelete", "im", "CIMEvent", "OnFileDelete"); RegisterModuleDependences("main", "OnApplicationsBuildList", "im", "DesktopApplication", "OnApplicationsBuildList"); CAgent::AddAgent("CIMMail::MailNotifyAgent();", "im", "N", 600); CAgent::AddAgent("CIMMail::MailMessageAgent();", "im", "N", 600); CAgent::AddAgent("CIMDisk::RemoveTmpFileAgent();", "im", "N", 43200); CModule::IncludeModule("im"); if (CIMConvert::ConvertCount() > 0) { Cmodule::IncludeModule("im"); CAdminNotify::Add(array("MESSAGE" => GetMessage("IM_CONVERT_MESSAGE", array("#A_TAG_START#" => '<a href="/bitrix/admin/im_convert.php?lang=' . LANGUAGE_ID . '">', "#A_TAG_END#" => "</a>")), "TAG" => "IM_CONVERT", "MODULE_ID" => "IM", "ENABLE_CLOSE" => "Y")); CAgent::AddAgent("CIMConvert::UndeliveredMessageAgent();", "im", "N", 20, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 20, "FULL")); } return true; }
function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if(!$DB->Query("SELECT 'x' FROM b_pull_stack", true)) $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/pull/install/db/".strtolower($DB->type)."/install.sql"); if($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("pull"); RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/pull/ajax_hit.php"); RegisterModuleDependences("perfmon", "OnGetTableSchema", "pull", "CPullTableSchema", "OnGetTableSchema"); RegisterModuleDependences("main", "OnAfterRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); RegisterModuleDependences("main", "OnAfterUnRegisterModule", "pull", "CPullOptions", "ClearCheckCache"); COption::SetOptionString("pull", "path_to_listener", (CMain::IsHTTPS() ? "https" : "http")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/sub/'); COption::SetOptionString("pull", "path_to_websocket", (CMain::IsHTTPS() ? "wss" : "ws")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/subws/'); COption::SetOptionString("pull", "path_to_publish", 'http://127.0.0.1:8895/bitrix/pub/'); COption::SetOptionString("pull", "websocket", 'N'); COption::SetOptionString("pull", "nginx", 'N'); COption::SetOptionString("pull", "push", 'N'); CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+30, "FULL")); return true; }
public function Authorize() { $GLOBALS["APPLICATION"]->RestartBuffer(); $bSuccess = false; if(isset($_REQUEST["code"]) && $_REQUEST["code"] <> '') { if(CSocServAuthManager::CheckUniqueKey()) { $redirect_uri = CSocServUtil::GetCurUrl('auth_service_id='.self::ID, array("code")); $appID = self::GetOption("facebook_appid"); $appSecret = self::GetOption("facebook_appsecret"); $fb = new CFacebookInterface($appID, $appSecret, $_REQUEST["code"]); if($fb->GetAccessToken($redirect_uri) !== false) { $arFBUser = $fb->GetCurrentUser(); if(isset($arFBUser["id"])) { $arFields = array( 'EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arFBUser["id"], 'LOGIN' => "FB_".$arFBUser["email"], 'EMAIL' => $arFBUser["email"], 'NAME'=> $arFBUser["first_name"], 'LAST_NAME'=> $arFBUser["last_name"], ); if(isset($arFBUser['picture']['data']['url']) && self::CheckPhotoURI($arFBUser['picture']['data']['url'])) if ($arPic = CFile::MakeFileArray($arFBUser['picture']['data']['url'])) $arFields["PERSONAL_PHOTO"] = $arPic; if(isset($arFBUser['birthday'])) if ($date = MakeTimeStamp($arFBUser['birthday'], "MM/DD/YYYY")) $arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date); if(isset($arFBUser['gender']) && $arFBUser['gender'] != '') { if ($arFBUser['gender'] == 'male') $arFields["PERSONAL_GENDER"] = 'M'; elseif ($arFBUser['gender'] == 'female') $arFields["PERSONAL_GENDER"] = 'F'; } $arFields["PERSONAL_WWW"] = "http://www.facebook.com/".$arFBUser["id"]; $bSuccess = $this->AuthorizeUser($arFields); } } } } $aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key"); $url = $GLOBALS['APPLICATION']->GetCurPageParam(($bSuccess? '':'auth_service_id='.self::ID.'&auth_service_error=1'), $aRemove); echo ' <script type="text/javascript"> if(window.opener) window.opener.location = \''.CUtil::JSEscape($url).'\'; window.close(); </script> '; die(); }
function trackStartedTask($stopStartedTask = true) { CModule::IncludeModule('iblock'); $res = CIBlockElement::GetList(array(), array("IBLOCK_ID" => TASKS_IBLOCK_ID, 'ACTIVE' => 'Y', "PROPERTY_PROGRAMMER" => CUser::GetID(), "PROPERTY_STATUS" => STATUS_LIST_WORK), false, false, array('ID', 'NAME', 'PROPERTY_PROJECT', 'PROPERTY_STATUS_DATE')); if ($taskArr = $res->Fetch()) { if ($stopStartedTask) { CIBlockElement::SetPropertyValuesEx($taskArr['ID'], TASKS_IBLOCK_ID, array('STATUS' => STATUS_LIST_PAUSE)); } $link = TASKS_LIST_URL . $taskArr["PROPERTY_PROJECT_VALUE"] . '/' . $taskArr['ID'] . '/'; $date = new DateTime($taskArr["PROPERTY_STATUS_DATE_VALUE"]); $curdate = new DateTime(); $diff = $date->diff($curdate); $h = $diff->format('%h'); $i = $diff->format('%i'); if ($h || $i) { $timingText = ''; if ($h) { $timingText = "{$h} ч, "; } if ($i) { $timingText = $timingText . "{$i} мин. "; } $decTime = $h + $i / 60; $decTime = round($decTime, 2); $el = new CIBlockElement(); if ($el->Add(array("DATE_ACTIVE_FROM" => ConvertTimeStamp(time(), "SHORT"), "MODIFIED_BY" => CUser::GetID(), "IBLOCK_SECTION_ID" => false, "IBLOCK_ID" => TRACKING_IBLOCK_ID, "NAME" => 'Без названия' . ' (' . $decTime . 'ч.)', "ACTIVE" => "Y", "PROPERTY_VALUES" => array("HOURS" => $decTime, "TASK" => $taskArr['ID'])))) { crmEntitiesHelper::recalcTaskTracking($taskArr['ID']); ToolTip::Add("+ {$timingText} в трекер задачи \"<a target=\"_blank\" href=\"{$link}\">{$taskArr['ID']} {$taskArr['NAME']}</a>\""); } else { ToolTip::AddError($el->LAST_ERROR); } } } }
public static function CallBack_AddComment($arFields) { if (!CModule::IncludeModule('blog')) { return false; } $arResult = array(); $arLog = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID", "RATING_ENTITY_ID"))->Fetch(); if ($arLog) { $arIdeaPost = CBlogPost::GetById($arLog["SOURCE_ID"]); if ($arIdeaPost) { $UserIP = CBlogUser::GetUserIP(); $IdeaCommentId = CBlogComment::Add(array("BLOG_ID" => $arIdeaPost["BLOG_ID"], "POST_ID" => $arIdeaPost["ID"], "AUTHOR_ID" => $arFields["USER_ID"], "POST_TEXT" => $arFields["MESSAGE"], "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "PARENT_ID" => false, "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1])); $arResult = array("SOURCE_ID" => $IdeaCommentId); if ($arLog["RATING_ENTITY_ID"] > 0) { $arResult["RATING_TYPE_ID"] = "BLOG_COMMENT"; $arResult["RATING_ENTITY_ID"] = $IdeaCommentId; } if (intval($IdeaCommentId) == 0) { global $APPLICATION; if ($ex = $APPLICATION->GetException()) { $arResult["ERROR"] = $ex->GetString(); } } else { //clear cache on succcess BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/first_page/"); BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/pages/"); BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/comment/" . $arIdeaPost["ID"] . "/"); BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/post/" . $arIdeaPost["ID"] . "/"); } } } return $arResult; }
public function Authorize() { $GLOBALS["APPLICATION"]->RestartBuffer(); $bSuccess = 1; if (isset($_REQUEST["code"]) && $_REQUEST["code"] != '') { if (CSocServAuthManager::CheckUniqueKey()) { if (IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME')) { $redirect_uri = self::CONTROLLER_URL . "/redirect.php?redirect_to=" . urlencode(CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code"))); } else { $redirect_uri = CSocServUtil::GetCurUrl('auth_service_id=' . self::ID, array("code")); } $appID = trim(self::GetOption("facebook_appid")); $appSecret = trim(self::GetOption("facebook_appsecret")); $fb = new CFacebookInterface($appID, $appSecret, $_REQUEST["code"]); if ($fb->GetAccessToken($redirect_uri) !== false) { $arFBUser = $fb->GetCurrentUser(); if (is_array($arFBUser) && isset($arFBUser["id"])) { $email = $arFBUser["email"] != '' ? $arFBUser["email"] : ''; $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arFBUser["id"], 'LOGIN' => "FB_" . $arFBUser["id"], 'EMAIL' => $email, 'NAME' => $arFBUser["first_name"], 'LAST_NAME' => $arFBUser["last_name"]); if (isset($arFBUser['picture']['data']['url']) && self::CheckPhotoURI($arFBUser['picture']['data']['url'])) { if ($arPic = CFile::MakeFileArray($arFBUser['picture']['data']['url'])) { $arFields["PERSONAL_PHOTO"] = $arPic; } } if (isset($arFBUser['birthday'])) { if ($date = MakeTimeStamp($arFBUser['birthday'], "MM/DD/YYYY")) { $arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date); } } if (isset($arFBUser['gender']) && $arFBUser['gender'] != '') { if ($arFBUser['gender'] == 'male') { $arFields["PERSONAL_GENDER"] = 'M'; } elseif ($arFBUser['gender'] == 'female') { $arFields["PERSONAL_GENDER"] = 'F'; } } $arFields["PERSONAL_WWW"] = "http://www.facebook.com/" . $arFBUser["id"]; if (strlen(SITE_ID) > 0) { $arFields["SITE_ID"] = SITE_ID; } $bSuccess = $this->AuthorizeUser($arFields); } } } } $aRemove = array("logout", "auth_service_error", "auth_service_id", "code", "error_reason", "error", "error_description", "check_key", "current_fieldset"); $url = $GLOBALS['APPLICATION']->GetCurPageParam($bSuccess === true ? '' : 'auth_service_id=' . self::ID . '&auth_service_error=' . $bSuccess, $aRemove); if (CModule::IncludeModule("socialnetwork") && strpos($url, "current_fieldset=") === false) { $url = preg_match("/\\?/", $url) ? $url . "¤t_fieldset=SOCSERV" : $url . "?current_fieldset=SOCSERV"; } echo ' <script type="text/javascript"> if(window.opener) window.opener.location = \'' . CUtil::JSEscape($url) . '\'; window.close(); </script> '; die; }
public static function FromDB($strParams) { $arParams = unserialize($strParams); if (strlen($arParams["DATE_FROM"]) > 0) $arParams["DATE_FROM"] = ConvertTimeStamp($arParams["DATE_FROM"], "SHORT"); if (strlen($arParams["DATE_TO"]) > 0) $arParams["DATE_TO"] = ConvertTimeStamp($arParams["DATE_TO"], "SHORT"); return $arParams; }
function InstallDB() { RegisterModule("storeassist"); RegisterModuleDependences("main", "OnPrologAdminTitle", "storeassist", "CStoreAssist", "onPrologAdminTitle"); RegisterModuleDependences('main', 'OnBuildGlobalMenu', "storeassist", "CStoreAssist", "onBuildGlobalMenu"); $dateCheckTs = MakeTimeStamp(date("d", time() + 3600 * 24) . "." . date("m", time() + 3600 * 24) . "." . date("Y", time() + 3600 * 24) . " 00:00:00", "DD.MM.YYYY HH:MI:SS"); $dateCheck = ConvertTimeStamp($dateCheckTs, "FULL"); CAgent::AddAgent("CStoreAssist::AgentCountDayOrders();", "storeassist", "N", 86400, $dateCheck, "Y", $dateCheck); return true; }
public static function Add($LOG_ID, $GROUP_CODE, $bShare = false, $followSet = true) { global $DB; if (is_array($GROUP_CODE)) { foreach ($GROUP_CODE as $GROUP_CODE_TMP) { CSocNetLogRights::Add($LOG_ID, $GROUP_CODE_TMP, $bShare, $followSet); } return false; } else { $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogRightsAdd"); while ($arEvent = $db_events->Fetch()) { if (ExecuteModuleEventEx($arEvent, array($LOG_ID, $GROUP_CODE)) === false) { return false; } } $NEW_RIGHT_ID = $DB->Add("b_sonet_log_right", array("LOG_ID" => $LOG_ID, "GROUP_CODE" => $GROUP_CODE), array(), "", true); if ($NEW_RIGHT_ID) { if (preg_match('/^U(\\d+)$/', $GROUP_CODE, $matches)) { if ($followSet) { CSocNetLogFollow::Set($matches[1], "L" . $LOG_ID, "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL", SITE_ID)); } } elseif ($bShare && preg_match('/^SG(\\d+)$/', $GROUP_CODE, $matches)) { // get all members who unfollow and set'em unfollow from the date $arUserIDToCheck = array(); $rsGroupMembers = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $matches[1], "USER_ACTIVE" => "Y", "<=ROLE" => SONET_ROLES_USER), false, false, array("USER_ID")); while ($arGroupMembers = $rsGroupMembers->Fetch()) { $arUserIDToCheck[] = $arGroupMembers["USER_ID"]; } if (!empty($arUserIDToCheck)) { $arUserIDFollowDefault = array("Y" => array(), "N" => array()); $arUserIDAlreadySaved = array(); $default_follow_type = COption::GetOptionString("socialnetwork", "follow_default_type", "Y"); $rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $arUserIDToCheck, "CODE" => "**"), array("USER_ID", "TYPE")); while ($arFollow = $rsFollow->Fetch()) { $arUserIDFollowDefault[$arFollow["TYPE"]][] = $arFollow["USER_ID"]; } $rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $arUserIDToCheck, "CODE" => "L" . $LOG_ID), array("USER_ID")); while ($arFollow = $rsFollow->Fetch()) { $arUserIDAlreadySaved[] = $arFollow["USER_ID"]; } foreach ($arUserIDToCheck as $iUserID) { // for them who not followed by default and not already saved follow/unfollow for the log entry if (!in_array($iUserID, $arUserIDAlreadySaved) && ($default_follow_type == "N" && !in_array($iUserID, $arUserIDFollowDefault["Y"]) || $default_follow_type == "Y" && in_array($iUserID, $arUserIDFollowDefault["N"]))) { CSocNetLogFollow::Add($iUserID, "L" . $LOG_ID, "N", ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL", SITE_ID)); } } } } } if (defined("BX_COMP_MANAGED_CACHE")) { $GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_" . intval($LOG_ID)); } return $NEW_RIGHT_ID; } }
function CleanUpAgent() { global $DB; $cleanup_days = COption::GetOptionInt("main", "event_log_cleanup_days", 7); if ($cleanup_days > 0) { $arDate = localtime(time()); $date = mktime(0, 0, 0, $arDate[4] + 1, $arDate[3] - $cleanup_days, 1900 + $arDate[5]); $DB->Query("DELETE FROM b_event_log WHERE TIMESTAMP_X <= " . $DB->CharToDateFunction(ConvertTimeStamp($date, "FULL"))); } return "CEventLog::CleanUpAgent();"; }
public static function getData($SITE_ID = SITE_ID, $bFull = false) { global $USER, $CACHE_MANAGER; $obCache = new CPHPCache(); $today = ConvertTimeStamp(); $cache_dir = '/intranet/planner/' . $USER->GetID(); $cache_id = 'intranet|planner|' . $USER->GetID() . '|' . $SITE_ID . '|' . intval($bFull) . '|' . $today . '|' . FORMAT_DATETIME . '|' . FORMAT_DATE . '|' . LANGUAGE_ID; $arData = null; if ($obCache->InitCache(self::CACHE_TTL, $cache_id, $cache_dir)) { $arData = $obCache->GetVars(); if (is_array($arData['SCRIPTS'])) { foreach ($arData['SCRIPTS'] as $key => $script) { if (is_array($script)) { $arData['SCRIPTS'][$key] = self::JS_CORE_EXT_RANDOM_NAME . RandString(5); CJSCore::RegisterExt($arData['SCRIPTS'][$key], $script); } } } } else { // cache expired or there's no cache $obCache->StartDataCache(); $arData = array('SCRIPTS' => array(), 'STYLES' => array(), 'DATA' => array()); $CACHE_MANAGER->StartTagCache($cache_dir); $CACHE_MANAGER->RegisterTag(self::CACHE_TAG . $USER->GetID()); $events = GetModuleEvents("intranet", "OnPlannerInit"); while ($arEvent = $events->Fetch()) { $arEventData = ExecuteModuleEventEx($arEvent, array(array('SITE_ID' => SITE_ID, 'FULL' => $bFull))); if (is_array($arEventData)) { if (is_array($arEventData['SCRIPTS'])) { $arData['SCRIPTS'] = array_merge($arData['SCRIPTS'], $arEventData['SCRIPTS']); } if (is_array($arEventData['STYLES'])) { $arData['STYLES'] = array_merge($arData['STYLES'], $arEventData['STYLES']); } if (is_array($arEventData['DATA'])) { $arData['DATA'] = array_merge($arData['DATA'], $arEventData['DATA']); } } } $arCacheData = $arData; if (is_array($arCacheData['SCRIPTS'])) { foreach ($arCacheData['SCRIPTS'] as $key => $script) { if (CJSCore::IsExtRegistered($script)) { $arCacheData['SCRIPTS'][$key] = CJSCore::getExtInfo($script); } } } $CACHE_MANAGER->EndTagCache(); $obCache->EndDataCache($arCacheData); } return $arData; }
function endSession() { global $DB; //Delete "expired" sessions $expired = ConvertDateTime(ConvertTimeStamp(time() - 3600, 'FULL'), 'YYYY-MM-DD HH:MI:SS'); $rs = $DB->Query('select ID, SESS_ID, VALUE from ' . $this->_tempTableName . ' where PARENT_ID = -1 AND NAME = "SESS_ID" ORDER BY ID'); while ($ar = $rs->Fetch()) { if ($ar['SESS_ID'] == $this->_sessionID || $ar['VALUE'] < $expired) { $DB->Query('DELETE from ' . $this->_tempTableName . ' WHERE SESS_ID = "' . $DB->ForSQL($ar['SESS_ID']) . '"'); } } return true; }
public function EndSession() { global $DB; //Delete "expired" sessions $expired = ConvertDateTime(ConvertTimeStamp(time() - 3600, "FULL"), "YYYY-MM-DD HH:MI:SS"); $rs = $DB->Query("select ID, SESS_ID, VALUE from " . $this->_table_name . " where PARENT_ID = -1 AND NAME = 'SESS_ID' ORDER BY ID"); while ($ar = $rs->Fetch()) { if ($ar["SESS_ID"] == $this->_sessid || $ar["VALUE"] < $expired) { $DB->Query("DELETE from " . $this->_table_name . " WHERE SESS_ID = '" . $DB->ForSQL($ar["SESS_ID"]) . "'"); } } return true; }
public static function SaveFile($arFile, $arFileStorage) { $arResult = array(); if (empty($arFile)) { $arResult = array("ERROR_CODE" => "EMPTY_FILE", "ERROR_MESSAGE" => "File is empty"); } if (!empty($arFileStorage["DISC_FOLDER"])) { $file = $arFileStorage["DISC_FOLDER"]->uploadFile($arFile, array('NAME' => $arFile["name"], 'CREATED_BY' => $GLOBALS["USER"]->GetID()), array(), true); $arResult["ID"] = $file->getId(); } elseif (!empty($arFileStorage["WEBDAV_DATA"]) && !empty($arFileStorage["WEBDAV_IBLOCK_OBJECT"])) { $dropTargetID = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->GetMetaID("DROPPED"); $arParent = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->GetObject(array("section_id" => $dropTargetID)); if (!$arParent["not_found"]) { $path = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->_get_path($arParent["item_id"], false); $tmpName = str_replace(array(":", ".", "/", "\\"), "_", ConvertTimeStamp(time(), "FULL")); $tmpOptions = array("path" => str_replace("//", "/", $path . "/" . $tmpName)); $arParent = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->GetObject($tmpOptions); if ($arParent["not_found"]) { $rMKCOL = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->MKCOL($tmpOptions); if (intval($rMKCOL) == 201) { $arFileStorage["WEBDAV_DATA"]["SECTION_ID"] = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->arParams["changed_element_id"]; } } else { $arFileStorage["WEBDAV_DATA"]["SECTION_ID"] = $arParent['item_id']; if (!$arFileStorage["WEBDAV_IBLOCK_OBJECT"]->CheckUniqueName($tmpName, $arFileStorage["WEBDAV_DATA"]["SECTION_ID"], $tmpRes)) { $path = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->_get_path($arFileStorage["WEBDAV_DATA"]["SECTION_ID"], false); $tmpName = randString(6); $tmpOptions = array("path" => str_replace("//", "/", $path . "/" . $tmpName)); $rMKCOL = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->MKCOL($tmpOptions); if (intval($rMKCOL) == 201) { $arFileStorage["WEBDAV_DATA"]["SECTION_ID"] = $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->arParams["changed_element_id"]; } } } } $options = array("new" => true, 'dropped' => true, "arFile" => $arFile, "arDocumentStates" => false, "arUserGroups" => array_merge($arFileStorage["WEBDAV_IBLOCK_OBJECT"]->USER["GROUPS"], array("Author")), "FILE_NAME" => $arFile["name"], "IBLOCK_ID" => $arFileStorage["WEBDAV_DATA"]["IBLOCK_ID"], "IBLOCK_SECTION_ID" => $arFileStorage["WEBDAV_DATA"]["SECTION_ID"], "USER_FIELDS" => array()); $GLOBALS['USER_FIELD_MANAGER']->EditFormAddFields($arFileStorage["WEBDAV_IBLOCK_OBJECT"]->GetUfEntity(), $options['USER_FIELDS']); $GLOBALS["DB"]->StartTransaction(); if (!$arFileStorage["WEBDAV_IBLOCK_OBJECT"]->put_commit($options)) { $arResult = array("ERROR_CODE" => "error_put", "ERROR_MESSAGE" => $arFileStorage["WEBDAV_IBLOCK_OBJECT"]->LAST_ERROR); $GLOBALS["DB"]->Rollback(); } else { $GLOBALS["DB"]->Commit(); $arResult["ID"] = $options['ELEMENT_ID']; } } else { $arResult["ID"] = CFile::SaveFile($arFile, $arFile["MODULE_ID"]); } return $arResult; }
/** * @return bool */ protected function tryMapBirthdayAttribute(VCard\VCardElement $element, array &$fields) { $attr = $element->getFirstAttributeByName('BDAY'); if ($attr === null) { return false; } $time = strtotime($attr->getValue()); if ($time === false) { return false; } $fields['BIRTHDATE'] = ConvertTimeStamp($time, 'SHORT'); $this->mappedFields[] = 'BIRTHDATE'; return true; }
/** * Creates new section in iblock * @param $arParams * @param $arResult * @param $name * @return bool|int */ public static function createAlbum($arParams, $arResult, &$name) { if (!CModule::IncludeModule("iblock")) { return false; } $name = trim($name); $name = strlen($name) > 0 ? $name : GetMessage("P_NEW_ALBUM"); $name = strlen($name) > 0 ? $name : "New album"; $arFields = array("ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"], "IBLOCK_SECTION_ID" => $arParams["BEHAVIOUR"] == "USER" ? $arResult["GALLERY"]["ID"] : 0, "DATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset()), "UF_DATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset()), "NAME" => $name); $GLOBALS["UF_DATE"] = $arFields["UF_DATE"]; $bs = new CIBlockSection(); $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields); $ID = $bs->Add($arFields); if ($ID > 0) { CIBlockSection::ReSort($arParams["IBLOCK_ID"]); $arPropertiesNeed = array(); // Array of properties to create foreach ($arParams['converters'] as $val) { if ($val['code'] == "real_picture" || $val['code'] == "thumbnail") { continue; } $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $val['code'])); if (!($db_res && ($res = $db_res->Fetch()))) { $arPropertiesNeed[] = $val['code']; } } if (count($arPropertiesNeed) > 0) { $obProperty = new CIBlockProperty(); foreach ($arPropertiesNeed as $key) { $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "F", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . strToUpper($key))) > 0 ? GetMessage("P_" . strToUpper($key)) : strToUpper($key), "CODE" => strToUpper($key), "FILE_TYPE" => "jpg, gif, bmp, png, jpeg")); } } // Check Public property $arPropertiesNeed = array(); foreach (array("PUBLIC_ELEMENT", "APPROVE_ELEMENT") as $key) { $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key)); if (!$db_res || !($res = $db_res->Fetch())) { $arPropertiesNeed[] = $key; } } if (count($arPropertiesNeed) > 0) { $obProperty = new CIBlockProperty(); foreach ($arPropertiesNeed as $key) { $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "S", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . $key)) > 0 ? GetMessage("P_" . $key) : $key, "DEFAULT_VALUE" => "N", "CODE" => $key)); } } } return $ID > 0 ? $ID : false; }
function checkAction($event) { $arActionID = array(); $rsTriggers = CFTrigger::GetList($by = "s_today_hits", $order = "desc", array("EVENT_ID" => $event["ID"])); while ($arTrigger = $rsTriggers->GetNext()) { $TriggerList[] = $arTrigger; $returnValue = unserialize(base64_decode($arTrigger["ACTION_ID"])); if (is_array($returnValue)) { $arActionID = array_merge($returnValue, $arActionID); } else { $arActionID[] = $arTrigger["ACTION_ID"]; } $TriggerActionList[$arTrigger["ID"]][] = $returnValue; } if (!empty($arActionID)) { $ActionTypesID = array(); $rsActions = CFTriggerActions::GetList($order, $by, array("ID" => $arActionID)); while ($arAction = $rsActions->GetNext()) { $ActionList[$arAction["ID"]] = $arAction; } $rsActionTypes = CFTriggerActionTypes::GetList(); while ($arActionType = $rsActionTypes->GetNext()) { $arActionTypeList[$arActionType["ID"]] = $arActionType["CODE"]; } if (!empty($ActionList)) { foreach ($TriggerActionList as $key => $triggerAction) { foreach ($triggerAction as $actionID) { if (is_array($actionID)) { foreach ($actionID as $k => $value) { if (intval($ActionList[$value]["ACTION_TYPE"]) > 0 && isset($arActionTypeList[$ActionList[$value]["ACTION_TYPE"]])) { //Проверяем и выполняем действие CFoodclubEventDoAction::doAction(array("ID" => $ActionList[$value]["ID"], "NAME" => $ActionList[$value]["NAME"], "ACTION_TYPE" => $ActionList[$value]["ACTION_TYPE"], "ACTION_CODE" => $arActionTypeList[$ActionList[$value]["ACTION_TYPE"]], "ADDITIONAL_PROPS" => $ActionList[$value]["ADDITIONAL_PROPS"], "BODY_PARAMS" => $ActionList[$value]["BODY_PARAMS"])); //Заносим в журнал CFTriggerLog::Add(array("NAME" => $ActionList[$value]["NAME"], "TRIGGER_ID" => $key, "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "CREATED_BY" => CUser::GetID())); } } } else { if (intval($ActionList[$actionID]["ACTION_TYPE"]) > 0 && isset($arActionTypeList[$ActionList[$actionID]["ACTION_TYPE"]])) { //Проверяем и выполняем действие CFoodclubEventDoAction::doAction(array("ID" => $ActionList[$actionID]["ID"], "NAME" => $ActionList[$actionID]["NAME"], "ACTION_TYPE" => $ActionList[$actionID]["ACTION_TYPE"], "ACTION_CODE" => $arActionTypeList[$ActionList[$actionID]["ACTION_TYPE"]], "ADDITIONAL_PROPS" => $ActionList[$actionID]["ADDITIONAL_PROPS"], "BODY_PARAMS" => $ActionList[$actionID]["BODY_PARAMS"])); //Заносим в журнал CFTriggerLog::Add(array("NAME" => $ActionList[$actionID]["NAME"], "TRIGGER_ID" => $key, "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "CREATED_BY" => CUser::GetID())); } } } } } } }
public function addElement($elementsProperties) { if (empty($this->elementName)) { $this->elementName = date('Y.m.d H:i'); } $el = new \CIBlockElement(); $id = $el->Add(array('IBLOCK_ID' => $this->iBlockId, 'PROPERTY_VALUES' => $elementsProperties, 'NAME' => $this->elementName, "DATE_ACTIVE_FROM" => ConvertTimeStamp(time(), "FULL"))); if (!$id) { if ($this->isCritical) { throw new \Exception($el->LAST_ERROR); } else { $this->form->setErrors($this->getErrorMessage($el->LAST_ERROR)); } } return $id; }
function GetEditFormHTML($arUserField, $arHtmlControl) { $arHtmlControl["VALIGN"] = "middle"; if ($arUserField["EDIT_IN_LIST"] == "Y") { if ($arUserField["ENTITY_VALUE_ID"] < 1 && $arUserField["SETTINGS"]["DEFAULT_VALUE"]["TYPE"] != "NONE") { if ($arUserField["SETTINGS"]["DEFAULT_VALUE"]["TYPE"] == "NOW") { $arHtmlControl["VALUE"] = ConvertTimeStamp(time(), "SHORT"); } else { $arHtmlControl["VALUE"] = CDatabase::FormatDate($arUserField["SETTINGS"]["DEFAULT_VALUE"]["VALUE"], "YYYY-MM-DD", CLang::GetDateFormat("SHORT")); } } return CAdminCalendar::CalendarDate($arHtmlControl["NAME"], $arHtmlControl["VALUE"]); } elseif (strlen($arHtmlControl["VALUE"]) > 0) { return $arHtmlControl["VALUE"]; } else { return ' '; } }
function GetEditFormHTML($arUserField, $arHtmlControl) { $arHtmlControl["VALIGN"] = "middle"; if ($arUserField["EDIT_IN_LIST"] == "Y") { if ($arUserField["ENTITY_VALUE_ID"] < 1 && $arUserField["SETTINGS"]["DEFAULT_VALUE"]["TYPE"] != "NONE") { if ($arUserField["SETTINGS"]["DEFAULT_VALUE"]["TYPE"] == "NOW") { $arHtmlControl["VALUE"] = ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"); } else { $arHtmlControl["VALUE"] = str_replace(" 00:00:00", "", CDatabase::FormatDate($arUserField["SETTINGS"]["DEFAULT_VALUE"]["VALUE"], "YYYY-MM-DD HH:MI:SS", CLang::GetDateFormat("FULL"))); } } return CAdminCalendar::CalendarDate($arHtmlControl["NAME"], $arHtmlControl["VALUE"], 20, true); } elseif (strlen($arHtmlControl["VALUE"]) > 0) { return $arHtmlControl["VALUE"]; } else { return ' '; } }
public static function Update($params) { if (isset($params['DATE_CREATE'])) { $params['DATE_CREATE'] = $params['DATE_CREATE'] ? ConvertTimeStamp($params['DATE_CREATE'] + CTimeZone::GetOffset() + date("Z"), 'SHORT') : ''; COption::SetOptionString("voximplant", "phone_order_date_create", $params['DATE_CREATE']); } if (isset($params['DATE_MODIFY'])) { $params['DATE_MODIFY'] = $params['DATE_MODIFY'] ? ConvertTimeStamp($params['DATE_MODIFY'] + CTimeZone::GetOffset() + date("Z"), 'SHORT') : ''; COption::SetOptionString("voximplant", "phone_order_date_modify", $params['DATE_MODIFY']); } if (isset($params['OPERATOR_STATUS'])) { COption::SetOptionString("voximplant", "phone_order_operator_status", $params['OPERATOR_STATUS']); } if (isset($params['OPERATOR_CONTRACT'])) { COption::SetOptionString("voximplant", "phone_order_operator_contract", $params['OPERATOR_CONTRACT']); } return false; }
public static function ClearAgent() { global $CACHE_MANAGER; $CACHE_MANAGER->Clean("pull_cnr"); if (self::ModuleEnable()) { CAgent::AddAgent("CPullChannel::CheckExpireAgent();", "pull", "N", 43200, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset() + 43200, "FULL")); CAgent::AddAgent("CPullStack::CheckExpireAgent();", "pull", "N", 86400, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset() + 86400, "FULL")); CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 600, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset() + 600, "FULL")); } else { CAgent::RemoveAgent("CPullChannel::CheckExpireAgent();", "pull"); CAgent::RemoveAgent("CPullStack::CheckExpireAgent();", "pull"); CAgent::RemoveAgent("CPullWatch::CheckExpireAgent();", "pull"); CAgent::RemoveAgent("CPushManager::SendAgent();", "pull"); } }
public function prepareUser($arVkUser, $short = false) { $first_name = $last_name = $gender = ""; if ($arVkUser['response']['0']['first_name'] != '') { $first_name = $arVkUser['response']['0']['first_name']; } if ($arVkUser['response']['0']['last_name'] != '') { $last_name = $arVkUser['response']['0']['last_name']; } if (isset($arVkUser['response']['0']['sex']) && $arVkUser['response']['0']['sex'] != '') { if ($arVkUser['response']['0']['sex'] == '2') { $gender = 'M'; } elseif ($arVkUser['response']['0']['sex'] == '1') { $gender = 'F'; } } $arFields = array('EXTERNAL_AUTH_ID' => self::ID, 'XML_ID' => $arVkUser['response']['0']['uid'], 'LOGIN' => "VKuser" . $arVkUser['response']['0']['uid'], 'EMAIL' => $this->entityOAuth->GetCurrentUserEmail(), 'NAME' => $first_name, 'LAST_NAME' => $last_name, 'PERSONAL_GENDER' => $gender, 'OATOKEN' => $this->entityOAuth->getToken(), 'OATOKEN_EXPIRES' => $this->entityOAuth->getAccessTokenExpires()); if (isset($arVkUser['response']['0']['photo_max_orig']) && self::CheckPhotoURI($arVkUser['response']['0']['photo_max_orig'])) { if (!$short) { $arPic = CFile::MakeFileArray($arVkUser['response']['0']['photo_max_orig']); if ($arPic) { $arFields["PERSONAL_PHOTO"] = $arPic; } } if (isset($arVkUser['response']['0']['bdate'])) { if ($date = MakeTimeStamp($arVkUser['response']['0']['bdate'], "DD.MM.YYYY")) { $arFields["PERSONAL_BIRTHDAY"] = ConvertTimeStamp($date); } } $arFields["PERSONAL_WWW"] = self::getProfileUrl($arVkUser['response']['0']['uid']); if (strlen(SITE_ID) > 0) { $arFields["SITE_ID"] = SITE_ID; } } return $arFields; }
protected function getListData() { $list = new CList($this->iblockId); $this->lists['FIELDS'] = $list->getFields(); $this->lists['SELECT'] = array('ID', 'IBLOCK_ID', 'NAME', 'IBLOCK_SECTION_ID', 'CREATED_BY', 'BP_PUBLISHED'); $this->lists['DATA'] = array(); $this->lists['DATA']['NAME'] = Loc::getMessage('LISTS_SEAC_FIELD_NAME_DEFAULT'); $this->lists['DATA']['IBLOCK_SECTION_ID'] = ''; foreach ($this->lists['FIELDS'] as $fieldId => $field) { $this->lists['FIELDS'][$fieldId]['NAME'] = htmlspecialcharsbx($this->lists['FIELDS'][$fieldId]['NAME']); if ($list->is_field($fieldId)) { if ($fieldId == 'ACTIVE_FROM' || $fieldId == 'PREVIEW_PICTURE' || $fieldId == 'DETAIL_PICTURE') { if ($field['DEFAULT_VALUE'] === '=now') { $this->lists['DATA'][$fieldId] = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'FULL'); } elseif ($field['DEFAULT_VALUE'] === '=today') { $this->lists['DATA'][$fieldId] = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'SHORT'); } else { $this->lists['DATA'][$fieldId] = ''; } } else { $this->lists['DATA'][$fieldId] = $field['DEFAULT_VALUE']; } $this->lists['SELECT'][] = $fieldId; } elseif (is_array($field['PROPERTY_USER_TYPE']) && array_key_exists('GetPublicEditHTML', $field['PROPERTY_USER_TYPE'])) { $this->lists['DATA'][$fieldId] = array('n0' => array('VALUE' => $field['DEFAULT_VALUE'], 'DESCRIPTION' => '')); } elseif ($field['PROPERTY_TYPE'] == 'L') { $this->lists['DATA'][$fieldId] = array(); $propEnums = CIBlockProperty::getPropertyEnum($field['ID']); while ($enum = $propEnums->fetch()) { if ($enum['DEF'] == 'Y') { $this->lists['DATA'][$fieldId][] = $enum['ID']; } } } elseif ($field['PROPERTY_TYPE'] == 'F') { $this->lists['DATA'][$fieldId] = array('n0' => array('VALUE' => $field['DEFAULT_VALUE'], 'DESCRIPTION' => '')); } elseif ($field['PROPERTY_TYPE'] == 'G' || $field['PROPERTY_TYPE'] == 'E') { $this->lists['DATA'][$fieldId] = array($field['DEFAULT_VALUE']); } else { $this->lists['DATA'][$fieldId] = array('n0' => array('VALUE' => $field['DEFAULT_VALUE'], 'DESCRIPTION' => '')); if ($field['MULTIPLE'] == 'Y') { if (is_array($field['DEFAULT_VALUE']) || strlen($field['DEFAULT_VALUE'])) { $this->lists['DATA'][$fieldId]['n1'] = array('VALUE' => '', 'DESCRIPTION' => ''); } } } if ($fieldId == 'CREATED_BY') { $this->lists['SELECT'][] = 'CREATED_USER_NAME'; } if ($fieldId == 'MODIFIED_BY') { $this->lists['SELECT'][] = 'USER_NAME'; } } }