public static function GetAccountById($account) { if (!is_array($account) || count($account) != 2) { throw new Exception("account"); } $arResult = null; if ($account[0] == "group") { if (CModule::IncludeModule("socialnetwork")) { if (array_key_exists($account[1], self::$accountsCache["groups"])) { return self::$accountsCache["groups"][$account[1]]; } $dbGroup = CSocNetGroup::GetList(array(), array("ID" => $account[1], "ACTIVE" => "Y")); if ($arGroup = $dbGroup->Fetch()) { $arResult = self::ExtractAccountFromGroup($arGroup); self::$accountsCache["groups"][$arGroup["ID"]] = $arResult; } return $arResult; } } if (array_key_exists($account[1], self::$accountsCache["users"])) { return self::$accountsCache["users"][$account[1]]; } //$dbUsers = CUser::GetList(($by = "ID"), ($order = "desc"), array("ID_EQUAL_EXACT" => $account[1], "ACTIVE" => "Y")); $dbUsers = CUser::GetById($account[1]); if ($arUser = $dbUsers->Fetch()) { $arResult = self::ExtractAccountFromUser($arUser); self::$accountsCache["users"][$arUser["ID"]] = $arResult; self::$accountsCacheMap[$arUser["LOGIN"]] = $arUser["ID"]; } return $arResult; }
/** * Save link user filter with filter * Requirement fields: USER_ID, FILTER_ID * * @param array $fields * @return \Bitrix\Main\Entity\AddResult * @throws \InvalidArgumentException */ public function addFilterUser(array $fields) { $userId = $fields['USER_ID']; $userData = \CUser::GetById($userId)->GetNext(); if ($this->isEmptyResult($userData)) { throw new \InvalidArgumentException('Invalid USER_ID'); } $queryBuilder = new Entity\Query(Model\SubscribeTable::getEntity()); $subscribe = $queryBuilder->setSelect(array('ID'))->setFilter(array('ID' => $fields['FILTER_ID']))->exec()->fetch(); if ($this->isEmptyResult($subscribe)) { throw new \InvalidArgumentException('Invalid FILTER_ID'); } $filterUserData = Model\SubscribeUserTable::getList(array('select' => array('ID'), 'filter' => array('USER_ID' => $userId, 'FILTER_ID' => $subscribe['ID'])))->fetch(); if (!$this->isEmptyResult($filterUserData)) { $addResult = new \Bitrix\Main\Entity\AddResult(); $addResult->setId($filterUserData['ID']); return $addResult; } $filterUserResult = Model\SubscribeUserTable::add(array('USER_ID' => $userData['ID'], 'FILTER_ID' => $subscribe['ID'])); if ($filterUserResult->isSuccess()) { Model\SubscribeStackTable::add(array('FILTER_USER_ID' => $filterUserResult->getId(), 'ACTION' => 'INSERT')); } return $filterUserResult; }
unset($arResult["POST_PROPERTIES"]["DATA"]["UF_BLOG_POST_IMPRTNT"]); $arResult["Post"]["IMPORTANT"] = array(); if ($GLOBALS["USER"]->IsAuthorized()) { $arResult["Post"]["IMPORTANT"] = array("COUNT" => 0, "IS_READ" => false, "USER" => array()); $cache = new CPHPCache(); $cache_path = "/blog/socnet_post/" . intval($arPost["ID"] / 100) . "/" . $arPost["ID"] . "/"; $cache_id = "blog_socnet_post_read_" . $GLOBALS["USER"]->GetID(); if ($cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) { $arResult["Post"]["IMPORTANT"] = $cache->GetVars(); } else { $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path); if (defined("BX_COMP_MANAGED_CACHE")) { $GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path); $GLOBALS["CACHE_MANAGER"]->RegisterTag("BLOG_POST_IMPRTNT" . $arPost["ID"]); } $db_user = CUser::GetById($GLOBALS["USER"]->GetId()); $arResult["Post"]["IMPORTANT"]["USER"] = $db_user->Fetch(); $db_res = CBlogUserOptions::GetList(array("ID" => "ASC"), array("POST_ID" => $arResult["Post"]["ID"], "NAME" => "BLOG_POST_IMPRTNT", "VALUE" => "Y", "USER_ACTIVE" => "Y"), array("bCount" => true)); if ($db_res && ($res = $db_res->Fetch()) && $res["CNT"] > 0) { $arResult["Post"]["IMPORTANT"]["COUNT"] = $res["CNT"]; $arResult["Post"]["IMPORTANT"]["IS_READ"] = CBlogUserOptions::GetOption($arPost["ID"], "BLOG_POST_IMPRTNT", "N", $GLOBALS["USER"]->GetId()); } if (defined("BX_COMP_MANAGED_CACHE")) { $GLOBALS["CACHE_MANAGER"]->EndTagCache(); } $cache->EndDataCache($arResult["Post"]["IMPORTANT"]); } } } if (isset($arResult["GRATITUDE"]) && isset($arResult["GRATITUDE"]["USERS"]) && is_array($arResult["GRATITUDE"]["USERS"]) && !empty($arResult["GRATITUDE"]["USERS"]) && isset($arUserIdVisible) && is_array($arUserIdVisible)) { foreach ($arResult["GRATITUDE"]["USERS"] as $key => $userIdTmp) {
$arParams["ADDITIONAL_URL"] = htmlspecialcharsEx(trim($arParams["ADDITIONAL_URL"])); $arParams["SERVER_NAME"] = defined("SITE_SERVER_NAME") && strLen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name"); $arParams["NAME_TEMPLATE"] = str_replace(array("#NOBR#", "#/NOBR#"), "", !!$arParams["NAME_TEMPLATE"] ? $arParams["NAME_TEMPLATE"] : CSite::GetDefaultNameFormat()); // *************************/Input params*************************************************************** // ************************* Default params************************************************************* $arResult["FILE"] = $arParams["FILE"]; if (!is_array($arParams["FILE"]) && intVal($arParams["FILE"]) > 0) { $arResult["FILE"] = CFile::GetFileArray($arParams["FILE"]); } $arResult["FILE"]["~SRC"] = $arResult["FILE"]["SRC"]; if (intVal($arResult["FILE"]["ID"]) > 0) { $arResult["FILE"]["SRC"] = "/bitrix/components/bitrix/forum.interface/show_file.php?fid=" . htmlspecialcharsbx($arResult["FILE"]["ID"]) . (!empty($arParams["ADDITIONAL_URL"]) ? "&" . $arParams["ADDITIONAL_URL"] : ""); } if ($arResult["FILE"]["USER_ID"] > 0) { $forumUser = CForumUser::GetByUSER_ID($arResult["FILE"]["USER_ID"]); $db_res = CUser::GetById($arResult["FILE"]["USER_ID"]); if ($db_res && ($arUser = $db_res->Fetch())) { $arResult["FILE"]["OWNER"] = $forumUser && $forumUser["SHOW_NAME"] != "Y" ? $arUser["LOGIN"] : CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, true, false); } } $arResult["RETURN_DATA"] = ""; $arResult["RETURN_DATA_ARRAY"] = array(); // *************************/Default params************************************************************* if (is_array($arResult["FILE"]) && !empty($arResult["FILE"]["SRC"])) { $arResult["FILE"]["FULL_SRC"] = CHTTP::URN2URI($arResult["FILE"]["SRC"], $arParams["SERVER_NAME"]); $ct = strToLower($arResult["FILE"]["CONTENT_TYPE"]); if ($arParams["SHOW_MODE"] == "LINK") { // do nothing } elseif ($arParams["MAX_FILE_SIZE"] >= $arResult["FILE"]["FILE_SIZE"] && substr($ct, 0, 6) == "image/") { $arResult["RETURN_DATA"] = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:forum.interface", "popup_image", array("URL" => $arParams["SHOW_MODE"] == "RSS" ? $arResult["FILE"]["FULL_SRC"] : $arResult["FILE"]["SRC"], "SIZE" => $arParams["SIZE"], "MAX_SIZE" => $arParams["MAX_SIZE"], "HTML_SIZE" => $arParams["HTML_SIZE"], "MODE" => $arParams["SHOW_MODE"] == "RSS" ? "RSS" : "SHOW2IMAGES", "IMG_WIDTH" => $arResult["FILE"]["WIDTH"], "IMG_HEIGHT" => $arResult["FILE"]["HEIGHT"], "IMG_NAME" => $arResult["FILE"]["ORIGINAL_NAME"], "IMG_SIZE" => $arResult["FILE"]["FILE_SIZE"], "CONVERT" => $arParams["CONVERT"], "FAMILY" => $arParams["FAMILY"], "RETURN" => "Y"), $this->__component->__parent !== null ? $this->__component->__parent : $this->__component, array("HIDE_ICONS" => "Y")); }
if (!CModule::IncludeModule("socialnetwork")) { ShowError(GetMessage("SONET_MODULE_NOT_INSTALL")); return; } $arDefaultUrlTemplates404 = array("index" => "index.php", "user_reindex" => "user_reindex.php", "user_content_search" => "user/#user_id#/search/", "user" => "user/#user_id#/", "user_current" => "user/index.php", "user_friends" => "user/#user_id#/friends/", "user_friends_add" => "user/#user_id#/friends/add/", "user_friends_delete" => "user/#user_id#/friends/delete/", "user_groups" => "user/#user_id#/groups/", "user_groups_add" => "user/#user_id#/groups/add/", "group_create" => "user/#user_id#/groups/create/", "user_profile_edit" => "user/#user_id#/edit/", "user_settings_edit" => "user/#user_id#/settings/", "user_features" => "user/#user_id#/features/", "user_subscribe" => "user/#user_id#/subscribe/", "user_requests" => "user/#user_id#/requests/", "group_request_group_search" => "group/#user_id#/group_search/", "group_request_user" => "group/#group_id#/user/#user_id#/request/", "search" => "search.php", "mail" => "mail/", "message_form" => "messages/form/#user_id#/", "message_form_mess" => "messages/chat/#user_id#/#message_id#/", "messages_chat" => "messages/chat/#user_id#/", "messages_users" => "messages/", "messages_users_messages" => "messages/#user_id#/", "messages_input" => "messages/input/", "messages_output" => "messages/output/", "messages_input_user" => "messages/input/#user_id#/", "messages_output_user" => "messages/output/#user_id#/", "user_ban" => "messages/ban/", "log" => "log/", "crm" => "crm/", "log_entry" => "log/#log_id#/", "activity" => "user/#user_id#/activity/", "subscribe" => "subscribe/", "bizproc" => "bizproc/", "bizproc_edit" => "bizproc/#task_id#/", "bizproc_task_list" => "user/#user_id#/bizproc/", "bizproc_task" => "user/#user_id#/bizproc/#task_id#/", "video_call" => "video/#user_id#/", "processes" => "processes/", "user_photo" => "user/#user_id#/photo/", "user_photo_gallery" => "user/#user_id#/photo/gallery/", "user_photo_gallery_edit" => "user/#user_id#/photo/gallery/action/#action#/", "user_photo_galleries" => "user/#user_id#/photo/galleries/", "user_photo_section" => "user/#user_id#/photo/album/#section_id#/", "user_photo_section_edit" => "user/#user_id#/photo/album/#section_id#/action/#action#/", "user_photo_section_edit_icon" => "user/#user_id#/photo/album/#section_id#/icon/action/#action#/", "user_photo_element_upload" => "user/#user_id#/photo/photo/#section_id#/action/upload/", "user_photo_element" => "user/#user_id#/photo/photo/#section_id#/#element_id#/", "user_photo_element_edit" => "user/#user_id#/photo/photo/#section_id#/#element_id#/action/#action#/", "user_photo_element_slide_show" => "user/#user_id#/photo/photo/#section_id#/#element_id#/slide_show/", "user_photofull_gallery" => "user/#user_id#/photo/gallery/#user_alias#/", "user_photofull_gallery_edit" => "user/#user_id#/photo/gallery/#user_alias#/action/#action#/", "user_photofull_section" => "user/#user_id#/photo/album/#user_alias#/#section_id#/", "user_photofull_section_edit" => "user/#user_id#/photo/album/#user_alias#/#section_id#/action/#action#/", "user_photofull_section_edit_icon" => "user/#user_id#/photo/album/#user_alias#/#section_id#/icon/action/#action#/", "user_photofull_element_upload" => "user/#user_id#/photo/photo/#user_alias#/#section_id#/action/upload/", "user_photofull_element" => "user/#user_id#/photo/photo/#user_alias#/#section_id#/#element_id#/", "user_photofull_element_edit" => "user/#user_id#/photo/photo/#user_alias#/#section_id#/#element_id#/action/#action#/", "user_photofull_element_slide_show" => "user/#user_id#/photo/photo/#user_alias#/#section_id#/#element_id#/slide_show/", "user_calendar" => "user/#user_id#/calendar/", "user_files" => "user/#user_id#/files/lib/#path#", "user_files_short" => "folder/view/#section_id#/#element_id#/#element_name#", "user_files_section_edit" => "user/#user_id#/files/folder/edit/#section_id#/#action#/", "user_files_element" => "user/#user_id#/files/element/view/#element_id#/", "user_files_element_comment" => "user/#user_id#/files/element/comment/#topic_id#/#message_id#/", "user_files_element_edit" => "user/#user_id#/files/element/edit/#element_id#/#action#/", "user_files_element_file" => "", "user_files_element_history" => "user/#user_id#/files/element/history/#element_id#/", "user_files_element_history_get" => "user/#user_id#/files/element/historyget/#element_id#/#element_name#", "user_files_element_version" => "user/#user_id#/files/element/version/#action#/#element_id#/", "user_files_element_versions" => "user/#user_id#/files/element/versions/#element_id#/", "user_files_element_upload" => "user/#user_id#/files/element/upload/#section_id#/", "user_files_help" => "user/#user_id#/files/help/", "user_files_connector" => "user/#user_id#/files/connector/", "user_files_webdav_bizproc_history" => "user/#user_id#/files/bizproc/history/#element_id#/", "user_files_webdav_bizproc_history_get" => "user/#user_id#/files/bizproc/historyget/#element_id#/#id#/#element_name#", "user_files_webdav_bizproc_log" => "user/#user_id#/files/bizproc/log/#element_id#/#id#/", "user_files_webdav_bizproc_view" => "user/#user_id#/files/bizproc/bizproc/#element_id#/", "user_files_webdav_bizproc_workflow_admin" => "user/#user_id#/files/bizproc/admin/", "user_files_webdav_bizproc_workflow_edit" => "user/#user_id#/files/bizproc/edit/#id#/", "user_files_webdav_start_bizproc" => "user/#user_id#/files/bizproc/start/#element_id#/", "user_blog" => "user/#user_id#/blog/", "user_blog_post_important" => "user/#user_id#/blog/important/", "user_blog_post_edit" => "user/#user_id#/blog/edit/#post_id#/", "user_blog_rss" => "user/#user_id#/blog/rss/#type#/", "user_blog_post_rss" => "user/#user_id#/blog/rss/#type#/#post_id#/", "user_blog_draft" => "user/#user_id#/blog/draft/", "user_blog_moderation" => "user/#user_id#/blog/moderation/", "user_blog_post" => "user/#user_id#/blog/#post_id#/", "user_tasks" => "user/#user_id#/tasks/", "user_tasks_task" => "user/#user_id#/tasks/task/#action#/#task_id#/", "user_tasks_view" => "user/#user_id#/tasks/view/#action#/#view_id#/", "user_tasks_departments_overview" => "user/#user_id#/tasks/departments/", "user_tasks_projects_overview" => "user/#user_id#/tasks/projects/", "user_tasks_report" => "user/#user_id#/tasks/report/", "user_tasks_report_construct" => "user/#user_id#/tasks/report/construct/#report_id#/#action#/", "user_tasks_report_view" => "user/#user_id#/tasks/report/view/#report_id#/", "user_tasks_templates" => "user/#user_id#/tasks/templates/", "user_templates_template" => "user/#user_id#/tasks/templates/template/#action#/#template_id#/", "user_forum" => "user/#user_id#/forum/", "user_forum_topic" => "user/#user_id#/forum/#topic_id#/", "user_forum_topic_edit" => "user/#user_id#/forum/edit/#action#/#topic_id#/#message_id#/", "user_forum_message" => "user/#user_id#/forum/message/#topic_id#/#message_id#/", "user_forum_message_edit" => "user/#user_id#/forum/message/#action#/#topic_id#/#message_id#/", "user_security" => "user/#user_id#/security/", "user_codes" => "user/#user_id#/codes/", "user_passwords" => "user/#user_id#/passwords/"); $diskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk'); $bExtranetEnabled = IsModuleInstalled('extranet'); if ($bExtranetEnabled) { $extranetSiteId = COption::GetOptionString("extranet", "extranet_site"); if (strlen($extranetSiteId) <= 0) { $bExtranetEnabled = false; } } if ($bExtranetEnabled && $arParams["SEF_MODE"] == "Y" && SITE_ID == $extranetSiteId && !CSocNetUser::IsCurrentUserModuleAdmin() && CModule::IncludeModule('intranet')) { if ($USER->IsAuthorized()) { $rsCurrentUser = CUser::GetById($USER->GetId()); if (($arCurrentUser = $rsCurrentUser->Fetch()) && !empty($arCurrentUser["UF_DEPARTMENT"]) && is_array($arCurrentUser["UF_DEPARTMENT"]) && intval($arCurrentUser["UF_DEPARTMENT"][0]) > 0) { $arRedirectSite = CSocNetLogComponent::GetSiteByDepartmentId($arCurrentUser["UF_DEPARTMENT"]); if (!$arRedirectSite) { $arRedirectSite = array("LID" => SITE_ID, "SERVER_NAME" => SITE_SERVER_NAME); } } } } if ($diskEnabled) { $arDefaultUrlTemplates404["user_disk"] = "user/#user_id#/disk/path/#PATH#"; $arDefaultUrlTemplates404["user_disk_file"] = "user/#user_id#/disk/file/#FILE_PATH#"; $arDefaultUrlTemplates404["user_trashcan_list"] = "user/#user_id#/disk/trashcan/#TRASH_PATH#"; $arDefaultUrlTemplates404["user_trashcan_file_view"] = "user/#user_id#/disk/trash/file/#TRASH_FILE_PATH#"; $arDefaultUrlTemplates404["user_external_link_list"] = "user/#user_id#/disk/external"; $arDefaultUrlTemplates404["user_disk_help"] = "user/#user_id#/disk/help";
public static function KeepVoting() { global $DB, $VOTING_LAMP, $USER_ALREADY_VOTE, $USER_GROUP_PERMISSION, $USER; $err_mess = CAllVote::err_mess() . "<br>Function: KeepVoting<br>Line: "; $VOTING_LAMP = "green"; $USER_ALREADY_VOTE = "N"; $PUBLIC_VOTE_ID = intval($_REQUEST["PUBLIC_VOTE_ID"]); $aMsg = array(); $VOTE_ID = 0; $arVote = array(); $arQuestions = array(); if (!(!empty($_REQUEST["vote"]) && $PUBLIC_VOTE_ID > 0 && check_bitrix_sessid())) { $aMsg[] = array("id" => "bad_params", "text" => GetMessage("VOTE_NOT_FOUND")); } elseif (($VOTE_ID = intVal(GetVoteDataByID($PUBLIC_VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "N"))) && ($VOTE_ID <= 0 || $arVote["LAMP"] != "green")) { $VOTING_LAMP = "red"; if ($VOTE_ID <= 0) { $aMsg[] = array("id" => "VOTE_ID", "text" => GetMessage("VOTE_NOT_FOUND")); } else { $aMsg[] = array("id" => "LAMP", "text" => GetMessage("VOTE_RED_LAMP")); } } elseif ($arChannel["USE_CAPTCHA"] == "Y" && !$USER->IsAuthorized()) { include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php"; $cpt = new CCaptcha(); if (!empty($_REQUEST["captcha_word"])) { $captchaPass = COption::GetOptionString("main", "captcha_password", ""); if (!$cpt->CheckCodeCrypt($_REQUEST["captcha_word"], $_REQUEST["captcha_code"], $captchaPass)) { $GLOBALS["BAD_CAPTCHA"] = "Y"; $aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("VOTE_BAD_CAPTCHA")); } } else { if (!$cpt->CheckCode($_REQUEST["captcha_word"], 0)) { $GLOBALS["NO_CAPTCHA"] = "Y"; $aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("VOTE_BAD_CAPTCHA")); } } } if (empty($aMsg)) { // get user id $_SESSION["VOTE_USER_ID"] = CVote::SetVoteUserID(); $GLOBALS["VOTING_ID"] = $VOTE_ID; // check: can user vote $UNIQUE_TYPE = $arVote["UNIQUE_TYPE"]; $KEEP_IP_SEC = $arVote["KEEP_IP_SEC"]; $CHANNEL_ID = $arVote["CHANNEL_ID"]; $StatusVote = CVote::UserAlreadyVote($VOTE_ID, $_SESSION["VOTE_USER_ID"], $UNIQUE_TYPE, $KEEP_IP_SEC, $USER->GetID()); $USER_ALREADY_VOTE = $StatusVote != false ? "Y" : "N"; $USER_GROUP_PERMISSION = CVote::UserGroupPermission($CHANNEL_ID); // if user can vote that if (($USER_ALREADY_VOTE == "N" || $StatusVote == 8 && $_REQUEST["REVOTE_ID"] == $VOTE_ID) && $USER_GROUP_PERMISSION >= 2) { $arSqlAnswers = array(); // check answers foreach ($arQuestions as $qID => $arQuestion) { $arSqlAnswers[$arQuestion["ID"]] = array(); $bIndicators = array(); foreach ($arQuestion["ANSWERS"] as $arAnswer) { switch ($arAnswer["FIELD_TYPE"]) { case 0: // radio // radio case 2: // dropdown list $fieldName = ($arAnswer["FIELD_TYPE"] == 0 ? "vote_radio_" : "vote_dropdown_") . $qID; $aID = intval($GLOBALS[$fieldName]); if (!isset($bIndicators[$fieldName]) && array_key_exists($aID, $arQuestion["ANSWERS"])) { if (!empty($arAnswer['MESSAGE'])) { $arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID); } $bIndicators[$fieldName] = "Y"; } break; case 1: // checkbox // checkbox case 3: // multiselect list $fieldName = ($arAnswer["FIELD_TYPE"] == 1 ? "vote_checkbox_" : "vote_multiselect_") . $qID; $res = $GLOBALS[$fieldName]; if (!isset($bIndicators[$fieldName]) && is_array($res) && !empty($res)) { reset($res); foreach ($res as $aID) { if (array_key_exists($aID, $arQuestion["ANSWERS"])) { $arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID); } } $bIndicators[$fieldName] = "Y"; } break; case 4: // field // field case 5: // text $aID = $arAnswer["ID"]; $fieldName = ($arAnswer["FIELD_TYPE"] == 4 ? "vote_field_" : "vote_memo_") . $aID; $MESSAGE = trim($GLOBALS[$fieldName]); if ($MESSAGE != "") { $arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID, "MESSAGE" => "'" . $DB->ForSql(trim($MESSAGE), 2000) . "'"); } break; } } if (empty($arSqlAnswers[$qID])) { unset($arSqlAnswers[$qID]); if ($arQuestion['REQUIRED'] == 'Y') { $aMsg[] = array("id" => "QUESTION_" . $qID, "text" => GetMessage("VOTE_REQUIRED_MISSING")); $GLOBALS["VOTE_REQUIRED_MISSING"] = "Y"; break; } } } if (!empty($aMsg)) { /* do nothing; */ } elseif (!empty($arSqlAnswers)) { // vote event $arFields = array("VOTE_ID" => $VOTE_ID, "VOTE_USER_ID" => intval($_SESSION["VOTE_USER_ID"]), "DATE_VOTE" => $DB->GetNowFunction(), "STAT_SESSION_ID" => intval($_SESSION["SESS_SESSION_ID"]), "IP" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "VALID" => "'Y'"); /***************** Event onBeforeVoting ****************************/ foreach (GetModuleEvents("vote", "onBeforeVoting", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array(&$arFields, &$arSqlAnswers)) === false) { return false; } } /***************** /Event ******************************************/ if ($StatusVote == 8 && $_REQUEST["REVOTE_ID"] == $VOTE_ID) { $strSql = "SELECT VE.ID, VEQ.QUESTION_ID, VEA.ANSWER_ID" . " FROM b_vote_event VE " . "\tLEFT JOIN b_vote_event_question VEQ ON (VEQ.EVENT_ID=VE.ID)" . "\tLEFT JOIN b_vote_event_answer VEA ON (VEA.EVENT_QUESTION_ID=VEQ.ID)" . "\tLEFT JOIN b_vote_user VU ON (VE.VOTE_USER_ID = VU.ID)" . " WHERE VE.VOTE_ID=" . $VOTE_ID . " AND VU.AUTH_USER_ID=" . intval($USER->GetID()) . " ORDER BY VE.ID ASC, VEQ.QUESTION_ID ASC"; $db_res = $DB->Query($strSql, false, $err_mess . __LINE__); if ($db_res && ($res = $db_res->Fetch())) { if ($USER->GetID() > 0 && CModule::IncludeModule("im")) { CIMNotify::DeleteByTag("VOTING|" . $VOTE_ID, $USER->GetID()); } $del = false; $delQ = false; do { if ($delQ !== $res["QUESTION_ID"]) { if ($del !== $res["ID"]) { CVoteEvent::Delete($res["ID"]); $del = $res["ID"]; $arVote["COUNTER"] = intval($arVote["COUNTER"]) - 1; } $delQ = $res["QUESTION_ID"]; $arQuestions[$res["QUESTION_ID"]]["COUNTER"] = intval($arQuestions[$res["QUESTION_ID"]]["COUNTER"]) - 1; } $arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["COUNTER"] = intval($arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["COUNTER"]) - 1; } while ($res = $db_res->Fetch()); } $USER_ALREADY_VOTE = "N"; } unset($GLOBALS["VOTE_CACHE_VOTING"][$VOTE_ID]); unset($GLOBALS["VOTE_CACHE"]["VOTE"][$VOTE_ID]); $EVENT_ID = intval($DB->Insert("b_vote_event", $arFields, $err_mess . __LINE__)); if ($EVENT_ID > 0) { $arSqlQuestionsID = array(); $arSqlAnswersID = array(); foreach ($arSqlAnswers as $qID => $arSqlAnswer) { $arFields = array("EVENT_ID" => $EVENT_ID, "QUESTION_ID" => $qID); $EVENT_QUESTION_ID = intval($DB->Insert("b_vote_event_question", $arFields, $err_mess . __LINE__)); if ($EVENT_QUESTION_ID > 0) { $arSqlQuestionsID[] = $qID; $arQuestions[$qID]["COUNTER"] = intval($arQuestions[$qID]["COUNTER"]) + 1; foreach ($arSqlAnswer as $aID => $res) { $res["EVENT_QUESTION_ID"] = $EVENT_QUESTION_ID; if ($DB->Insert("b_vote_event_answer", $res, $err_mess . __LINE__)) { $arSqlAnswersID[$aID] = $qID; $arQuestions[$qID]["ANSWERS"][$aID]["COUNTER"] = intval($arQuestions[$qID]["ANSWERS"][$aID]["COUNTER"]) + 1; } } } } if (empty($arSqlQuestionsID) || empty($arSqlAnswersID)) { $DB->Query("DELETE FROM b_vote_event WHERE ID=" . $EVENT_ID, $arFields, $err_mess . __LINE__); } else { $arFields = array("COUNTER" => "COUNTER+1"); $DB->Update("b_vote", $arFields, "WHERE ID='" . $VOTE_ID . "'", $err_mess . __LINE__); $arVote["COUNTER"] = intval($arVote["COUNTER"]) + 1; $DB->Update("b_vote_question", $arFields, "WHERE ID in (" . implode(", ", $arSqlQuestionsID) . ")", $err_mess . __LINE__); $DB->Update("b_vote_answer", $arFields, "WHERE ID in (" . implode(", ", array_keys($arSqlAnswersID)) . ")", $err_mess . __LINE__); // increment user counter CVote::UpdateVoteUserID($_SESSION["VOTE_USER_ID"]); $GLOBALS["VOTING_OK"] = "Y"; $_SESSION["VOTE_ARRAY"][] = $VOTE_ID; if ($UNIQUE_TYPE & 8) { $_SESSION["VOTE"]["VOTES"][$VOTE_ID] = $EVENT_ID; } // statistic module if (CModule::IncludeModule("statistic")) { $event3 = $arVote["EVENT3"]; if (!empty($event3)) { $event3 = "http://" . $_SERVER["HTTP_HOST"] . "/bitrix/admin/vote_user_results.php?EVENT_ID=" . $EVENT_ID . "&lang=" . LANGUAGE_ID; } CStatEvent::AddCurrent($arVote["EVENT1"], $arVote["EVENT2"], $event3); } // notification if (!!$arVote["AUTHOR_ID"] && $arVote["AUTHOR_ID"] != $USER->GetID()) { if (empty($arVote["TITLE"])) { $arQuestion = reset($arQuestions); $arVote["TITLE"] = $arQuestion["QUESTION"]; } if ($arVote["NOTIFY"] == "I" && CModule::IncludeModule("im")) { $arVote["TOTAL_URL"] = ""; if (!empty($arVote["URL"])) { if (defined('SITE_SERVER_NAME')) { $arVote["TOTAL_URL"] = SITE_SERVER_NAME; } $arVote["TOTAL_URL"] = !empty($arVote["TOTAL_URL"]) ? $arVote["TOTAL_URL"] : COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]); if (!empty($arVote["TOTAL_URL"])) { $arVote["TOTAL_URL"] = (CMain::IsHTTPS() ? "https" : "http") . "://" . $arVote["TOTAL_URL"] . $arVote["URL"]; } } // send notification $gender = $USER->getParam("PERSONAL_GENDER") == "F" ? "_F" : ""; $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arVote["AUTHOR_ID"], "FROM_USER_ID" => $USER->GetID(), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "vote", "NOTIFY_EVENT" => "voting", "NOTIFY_TAG" => "VOTING|" . $VOTE_ID, "NOTIFY_MESSAGE" => !empty($arVote["URL"]) ? GetMessage("V_NOTIFY_MESSAGE_HREF" . $gender, array("#VOTE_TITLE#" => $arVote["TITLE"], "#VOTE_URL#" => $arVote["URL"])) : GetMessage("V_NOTIFY_MESSAGE" . $gender, array("#VOTE_TITLE#" => $arVote["TITLE"])), "NOTIFY_MESSAGE_OUT" => !empty($arVote["TOTAL_URL"]) ? GetMessage("V_NOTIFY_MESSAGE_OUT_HREF" . $gender, array("#VOTE_TITLE#" => $arVote["TITLE"], "#VOTE_URL#" => $arVote["TOTAL_URL"])) : GetMessage("V_NOTIFY_MESSAGE" . $gender, array("#VOTE_TITLE#" => $arVote["TITLE"]))); CIMNotify::Add($arMessageFields); } else { if ($arVote["NOTIFY"] == "Y") { // send e-mail $db_user = CUser::GetById($arVote["AUTHOR_ID"]); if ($db_user && ($arUser = $db_user->Fetch()) && !empty($arUser["EMAIL"])) { $arEventFields = array("EMAIL_TO" => $arUser["EMAIL"], "VOTE_STATISTIC" => "", "ID" => $EVENT_ID, "TIME" => GetTime(time(), "FULL"), "VOTE_TITLE" => $arVote["TITLE"], "VOTE_DESCRIPTION" => $arVote["DESCRIPTION"], "VOTE_ID" => $arVote["ID"], "VOTE_COUNTER" => $arVote["COUNTER"], "URL" => $arVote["URL"], "CHANNEL" => $arChannel["TITLE"], "CHANNEL_ID" => $arChannel["ID"], "VOTER_ID" => $_SESSION["VOTE_USER_ID"], "USER_NAME" => $USER->GetFullName(), "LOGIN" => $USER->GetLogin(), "USER_ID" => $USER->GetID(), "STAT_GUEST_ID" => intval($_SESSION["SESS_GUEST_ID"]), "SESSION_ID" => intval($_SESSION["SESS_SESSION_ID"]), "IP" => $_SERVER["REMOTE_ADDR"]); $arEventFields["USER_NAME"] = !!$arEventFields["USER_NAME"] ? $arEventFields["USER_NAME"] : $arEventFields["LOGIN"]; // VOTE_STATISTIC $text = array(); foreach ($arSqlAnswersID as $aID => $qID) { $text[$qID] = is_array($text[$qID]) ? $text[$qID] : array(); if ($arQuestions[$qID]["ANSWERS"][$aID]["FIELD_TYPE"] == 4 || $arQuestions[$qID]["ANSWERS"][$aID]["FIELD_TYPE"] == 5) { if (!empty($arSqlAnswers[$qID][$aID]["MESSAGE"])) { $text[$qID][] = $arSqlAnswers[$qID][$aID]["MESSAGE"]; } } else { $text[$qID][] = $arQuestions[$qID]["ANSWERS"][$aID]["MESSAGE"]; } } foreach ($text as $qID => $txt) { $text[$qID] = " - " . $arQuestions[$qID]["QUESTION"] . "\n - " . implode(", ", $text[$qID]); } $arEventFields["VOTE_STATISTIC"] = "\n" . implode("\n\n", $text); $arrSites = CVoteChannel::GetSiteArray($arChannel["ID"]); CEvent::Send("VOTE_FOR", $arrSites, $arEventFields, "N"); } } } } } /***************** Event onAfterVoting *****************************/ foreach (GetModuleEvents("vote", "onAfterVoting", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($VOTE_ID, $EVENT_ID)); } /***************** /Event ******************************************/ } } else { $GLOBALS["USER_VOTE_EMPTY"] = "Y"; $aMsg[] = array("id" => "VOTE_ID", "text" => GetMessage("USER_VOTE_EMPTY")); } } else { $aMsg[] = array("id" => "VOTE_ID", "text" => $USER_GROUP_PERMISSION >= 2 ? GetMessage("VOTE_ALREADY_VOTE") : GetMessage("VOTE_ACCESS_DENIED")); } } if (!empty($aMsg)) { $e = new CAdminException($aMsg, "CVote::KeepVoting"); $GLOBALS["APPLICATION"]->ThrowException($e); $GLOBALS["VOTING_OK"] = "N"; return false; } return true; }
public function OnExternalEvent($arEventParameters = array()) { if ($this->executionStatus == CBPActivityExecutionStatus::Closed) { return; } $timeoutDuration = $this->CalculateTimeoutDuration(); if ($timeoutDuration > 0) { if (array_key_exists("SchedulerService", $arEventParameters) && $arEventParameters["SchedulerService"] == "OnAgent") { $this->IsTimeout = 1; $this->taskStatus = CBPTaskStatus::Timeout; $this->Unsubscribe($this); $this->workflow->CloseActivity($this); return; } } if (!array_key_exists("USER_ID", $arEventParameters) || intval($arEventParameters["USER_ID"]) <= 0) { return; } if (empty($arEventParameters["REAL_USER_ID"])) { $arEventParameters["REAL_USER_ID"] = $arEventParameters["USER_ID"]; } $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $arUsers = CBPHelper::ExtractUsers($this->Users, $documentId, false); $arEventParameters["USER_ID"] = intval($arEventParameters["USER_ID"]); $arEventParameters["REAL_USER_ID"] = intval($arEventParameters["REAL_USER_ID"]); if (!in_array($arEventParameters["USER_ID"], $arUsers)) { return; } if ($this->IsPropertyExists("LastReviewer")) { $this->LastReviewer = "user_" . $arEventParameters["REAL_USER_ID"]; } $taskService = $this->workflow->GetService("TaskService"); $taskService->MarkCompleted($this->taskId, $arEventParameters["REAL_USER_ID"], CBPTaskUserStatus::Ok); $dbUser = CUser::GetById($arEventParameters["REAL_USER_ID"]); if ($arUser = $dbUser->Fetch()) { $this->Comments = $this->Comments . CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUser) . " (" . $arUser["LOGIN"] . ")" . (strlen($arEventParameters["COMMENT"]) > 0 ? ": " : "") . $arEventParameters["COMMENT"] . "\n"; } $this->WriteToTrackingService(str_replace(array("#PERSON#", "#COMMENT#"), array("{=user:user_" . $arEventParameters["REAL_USER_ID"] . "}", strlen($arEventParameters["COMMENT"]) > 0 ? ": " . $arEventParameters["COMMENT"] : ""), GetMessage("BPAR_ACT_REVIEW_TRACK")), $arEventParameters["REAL_USER_ID"]); $result = "Continue"; $this->arReviewOriginalResults[] = $arEventParameters["USER_ID"]; $this->arReviewResults[] = $arEventParameters["REAL_USER_ID"]; $this->ReviewedCount = count($this->arReviewResults); if ($this->IsPropertyExists("ApproveType") && $this->ApproveType == "any") { $result = "Finish"; } else { $allAproved = true; foreach ($arUsers as $userId) { if (!in_array($userId, $this->arReviewOriginalResults)) { $allAproved = false; } } if ($allAproved) { $result = "Finish"; } } if (!$this->IsPropertyExists("SetStatusMessage") || $this->SetStatusMessage == "Y") { $messageTemplate = $this->IsPropertyExists("StatusMessage") && strlen($this->StatusMessage) > 0 ? $this->StatusMessage : GetMessage("BPAR_ACT_INFO"); $votedPercent = intval($this->ReviewedCount / $this->TotalCount * 100); $votedCount = $this->ReviewedCount; $totalCount = $this->TotalCount; $reviewers = ""; if (strpos($messageTemplate, "#REVIEWERS#") !== false) { $reviewers = $this->GetReviewersNames(); } if ($reviewers == "") { $reviewers = GetMessage("BPAA_ACT_APPROVERS_NONE"); } $this->SetStatusTitle(str_replace(array("#PERC#", "#PERCENT#", "#REV#", "#REVIEWED#", "#TOT#", "#TOTAL#", "#REVIEWERS#"), array($votedPercent, $votedPercent, $votedCount, $votedCount, $totalCount, $totalCount, $reviewers), $messageTemplate)); } if ($result != "Continue") { $this->WriteToTrackingService(GetMessage("BPAR_ACT_REVIEWED")); $this->taskStatus = CBPTaskStatus::CompleteOk; $this->Unsubscribe($this); $this->workflow->CloseActivity($this); } }
echo intval($arParams["ADV_FILTER"]["F_ACCOMPLICE"]); ?> " /> <?php $name = $APPLICATION->IncludeComponent("bitrix:intranet.user.selector.new", ".default", array("MULTIPLE" => "N", "NAME" => "FILTER_ACCOMPLICE", "INPUT_NAME" => "filter-field-assistant", "VALUE" => intval($arParams["ADV_FILTER"]["F_ACCOMPLICE"]), "POPUP" => "Y", "ON_SELECT" => "onFilterAccompliceSelect", "GROUP_ID_FOR_SITE" => intval($_GET["GROUP_ID"]) > 0 ? $_GET["GROUP_ID"] : (intval($arParams["GROUP_ID"]) > 0 ? $arParams["GROUP_ID"] : false), 'SHOW_INACTIVE_USERS' => 'Y', 'SHOW_EXTRANET_USERS' => 'FROM_MY_GROUPS', 'DISPLAY_TAB_GROUP' => 'Y', "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"]), null, array("HIDE_ICONS" => "Y")); ?> </div> <div class="filter-field"> <label class="filter-field-title" for="filter-field-auditor"><?php echo GetMessage("TASKS_AUDITOR"); ?> </label> <?php $userName = ""; if (intval($arParams["ADV_FILTER"]["F_AUDITOR"]) > 0) { $rsUser = CUser::GetById(intval($arParams["ADV_FILTER"]["F_AUDITOR"])); if ($arUser = $rsUser->Fetch()) { $userName = CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser); } } ?> <span class="webform-field webform-field-textbox<?php if (!strlen($userName)) { ?> webform-field-textbox-empty<?php } ?> webform-field-textbox-clearable"> <span class="webform-field-textbox-inner"> <input type="text" id="filter-field-auditor" class="webform-field-textbox" autocomplete="off" value="<?php echo $userName;
public function OnExternalEvent($arEventParameters = array()) { if ($this->executionStatus == CBPActivityExecutionStatus::Closed) { return; } $timeoutDuration = $this->CalculateTimeoutDuration(); if ($timeoutDuration > 0) { if (array_key_exists("SchedulerService", $arEventParameters) && $arEventParameters["SchedulerService"] == "OnAgent") { $this->IsTimeout = 1; $this->Unsubscribe($this); $this->ExecuteOnNonApprove(); return; } } if (!array_key_exists("USER_ID", $arEventParameters) || intval($arEventParameters["USER_ID"]) <= 0) { return; } if (!array_key_exists("APPROVE", $arEventParameters)) { return; } $approve = $arEventParameters["APPROVE"] ? true : false; $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $arUsersTmp = $this->Users; $arUsers = CBPHelper::ExtractUsers($arUsersTmp, $documentId, false); $arEventParameters["USER_ID"] = intval($arEventParameters["USER_ID"]); if (!in_array($arEventParameters["USER_ID"], $arUsers)) { return; } if ($this->IsPropertyExists("LastApprover")) { $this->LastApprover = "user_" . $arEventParameters["USER_ID"]; } $taskService = $this->workflow->GetService("TaskService"); $taskService->MarkCompleted($this->taskId, $arEventParameters["USER_ID"]); $dbUser = CUser::GetById($arEventParameters["USER_ID"]); if ($arUser = $dbUser->Fetch()) { $this->Comments = $this->Comments . CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUser) . " (" . $arUser["LOGIN"] . "): " . ($approve ? GetMessage("BPAA_LOG_Y") : GetMessage("BPAA_LOG_N")) . "\n" . (strlen($arEventParameters["COMMENT"]) > 0 ? GetMessage("BPAA_LOG_COMMENTS") . ": " . $arEventParameters["COMMENT"] : "") . "\n"; } if ($approve) { $this->WriteToTrackingService(str_replace(array("#PERSON#", "#COMMENT#"), array("{=user:user_" . $arEventParameters["USER_ID"] . "}", strlen($arEventParameters["COMMENT"]) > 0 ? ": " . $arEventParameters["COMMENT"] : ""), GetMessage("BPAA_ACT_APPROVE_TRACK")), $arEventParameters["USER_ID"]); } else { $this->WriteToTrackingService(str_replace(array("#PERSON#", "#COMMENT#"), array("{=user:user_" . $arEventParameters["USER_ID"] . "}", strlen($arEventParameters["COMMENT"]) > 0 ? ": " . $arEventParameters["COMMENT"] : ""), GetMessage("BPAA_ACT_NONAPPROVE_TRACK")), $arEventParameters["USER_ID"]); } $result = "Continue"; $this->arApproveResults[$arEventParameters["USER_ID"]] = $approve; if ($approve) { $this->ApprovedCount = $this->ApprovedCount + 1; } else { $this->NotApprovedCount = $this->NotApprovedCount + 1; } $this->VotedCount = count($this->arApproveResults); $this->VotedPercent = intval($this->VotedCount / $this->TotalCount * 100); $this->ApprovedPercent = intval($this->ApprovedCount / $this->TotalCount * 100); $this->NotApprovedPercent = intval($this->NotApprovedCount / $this->TotalCount * 100); if ($this->ApproveType == "any") { $result = $approve ? "Approve" : "NonApprove"; } elseif ($this->ApproveType == "all" || $this->ApproveType == "vote" && $this->ApproveMinPercent >= 100) { if (!$approve) { $result = "NonApprove"; } else { $allAproved = true; foreach ($arUsers as $userId) { if (!isset($this->arApproveResults[$userId])) { // && $this->arApproveResults[$userId]!==true $allAproved = false; } } if ($allAproved) { $result = "Approve"; } } } elseif ($this->ApproveType == "vote") { if ($this->ApproveWaitForAll == "Y") { if ($this->VotedPercent == 100) { if ($this->ApprovedPercent > $this->ApproveMinPercent) { $result = "Approve"; } else { $result = "NonApprove"; } } } else { if ($this->ApprovedPercent > $this->ApproveMinPercent) { $result = "Approve"; } elseif (($this->VotedCount - $this->ApprovedCount) / $this->TotalCount * 100 >= 100 - $this->ApproveMinPercent) { $result = "NonApprove"; } } } $approvers = ""; $rejecters = ""; if (!$this->IsPropertyExists("SetStatusMessage") || $this->SetStatusMessage == "Y") { $messageTemplate = $this->IsPropertyExists("StatusMessage") && strlen($this->StatusMessage) > 0 ? $this->StatusMessage : GetMessage("BPAA_ACT_INFO"); $votedPercent = $this->VotedPercent; $votedCount = $this->VotedCount; $totalCount = $this->TotalCount; if (strpos($messageTemplate, "#REJECTERS#") !== false) { $rejecters = $this->GetApproversNames(false); } if (strpos($messageTemplate, "#APPROVERS#") !== false) { $approvers = $this->GetApproversNames(true); } if ($approvers == "") { $approvers = GetMessage("BPAA_ACT_APPROVERS_NONE"); } if ($rejecters == "") { $rejecters = GetMessage("BPAA_ACT_APPROVERS_NONE"); } $this->SetStatusTitle(str_replace(array("#PERC#", "#PERCENT#", "#REV#", "#VOTED#", "#TOT#", "#TOTAL#", "#APPROVERS#", "#REJECTERS#"), array($votedPercent, $votedPercent, $votedCount, $votedCount, $totalCount, $totalCount, $approvers, $rejecters), $messageTemplate)); } if ($result != "Continue") { $this->Unsubscribe($this); if ($rejecters == "") { $this->Rejecters = $this->GetApproversNames(false); } else { $this->Rejecters = $rejecters; } if ($approvers == "") { $this->Approvers = $this->GetApproversNames(true); } else { $this->Approvers = $approvers; } if ($result == "Approve") { $this->ExecuteOnApprove(); } else { $this->ExecuteOnNonApprove(); } } }
static function PrepareUserPhoto($uid, &$arLdapUser) { if (!isset($arLdapUser["PERSONAL_PHOTO"])) { return false; } $dbRes = CUser::GetById($uid); $arUser = $dbRes->Fetch(); if (!isset($arUser["PERSONAL_PHOTO"]) || is_null($arUser["PERSONAL_PHOTO"])) { return false; } if ($arLdapUser["PERSONAL_PHOTO"] == "") { $arLdapUser["PERSONAL_PHOTO"]["del"] = "Y"; } $arLdapUser["PERSONAL_PHOTO"]["old_file"] = $arUser["PERSONAL_PHOTO"]; return true; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } $user_id = $arResult['DISPLAY_PROPERTIES']['USER_ID']['DISPLAY_VALUE']; if ($user_id) { $rsUSER = CUser::GetById($user_id); $f = $rsUSER->Fetch(); $arResult['DISPLAY_PROPERTIES']['USER_ID']['DISPLAY_VALUE'] = CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $f['NAME'], "LAST_NAME" => $f['LAST_NAME'], "SECOND_NAME" => $f['SECOND_NAME'], "LOGIN" => $f['LOGIN'])); }
public static function getExtranetRedirectSite($extranetSiteId) { global $USER; $arRedirectSite = false; if ($USER->IsAuthorized()) { $rsCurrentUser = CUser::GetById($USER->GetId()); if ($arCurrentUser = $rsCurrentUser->Fetch()) { $bCurrentUserIntranet = !empty($arCurrentUser["UF_DEPARTMENT"]) && is_array($arCurrentUser["UF_DEPARTMENT"]) && intval($arCurrentUser["UF_DEPARTMENT"][0]) > 0; if (SITE_ID == $extranetSiteId && $bCurrentUserIntranet && !CSocNetUser::IsCurrentUserModuleAdmin()) { $arRedirectSite = CSocNetLogComponent::GetSiteByDepartmentId($arCurrentUser["UF_DEPARTMENT"]); if ($arRedirectSite["LID"] == SITE_ID) { $arRedirectSite = false; } } if (SITE_ID != $extranetSiteId && !$bCurrentUserIntranet) { $rsRedirectSite = CSite::GetList($b = "SORT", $o = "asc", array("ACTIVE" => "Y", "LID" => $extranetSiteId)); // cache used $arRedirectSite = $rsRedirectSite->Fetch(); } } } return $arRedirectSite; }
$sec->SetKeys($arKeys); $errno = $sec->AcceptFromForm(array('NEW_PASSWORD', 'NEW_PASSWORD_CONFIRM')); if ($errno == CRsaSecurity::ERROR_SESS_CHECK) { $strError .= GetMessage("main_profile_sess_expired") . '<br />'; } elseif ($errno < 0) { $strError .= GetMessage("main_profile_decode_err", array("#ERRCODE#" => $errno)) . '<br />'; } } } if ($strError == '') { $user = new CUser(); $arPERSONAL_PHOTO = $_FILES["PERSONAL_PHOTO"]; $arWORK_LOGO = $_FILES["WORK_LOGO"]; $arUser = false; if ($ID > 0) { $dbUser = CUser::GetById($ID); $arUser = $dbUser->Fetch(); } if ($arUser) { $arPERSONAL_PHOTO["old_file"] = $arUser["PERSONAL_PHOTO"]; $arPERSONAL_PHOTO["del"] = $_POST["PERSONAL_PHOTO_del"]; $arWORK_LOGO["old_file"] = $arUser["WORK_LOGO"]; $arWORK_LOGO["del"] = $_POST["WORK_LOGO_del"]; } $arFields = array("NAME" => $_POST["NAME"], "LAST_NAME" => $_POST["LAST_NAME"], "SECOND_NAME" => $_POST["SECOND_NAME"], "EMAIL" => $_POST["EMAIL"], "LOGIN" => $_POST["LOGIN"], "PERSONAL_PROFESSION" => $_POST["PERSONAL_PROFESSION"], "PERSONAL_WWW" => $_POST["PERSONAL_WWW"], "PERSONAL_ICQ" => $_POST["PERSONAL_ICQ"], "PERSONAL_GENDER" => $_POST["PERSONAL_GENDER"], "PERSONAL_BIRTHDAY" => $_POST["PERSONAL_BIRTHDAY"], "PERSONAL_PHOTO" => $arPERSONAL_PHOTO, "PERSONAL_PHONE" => $_POST["PERSONAL_PHONE"], "PERSONAL_FAX" => $_POST["PERSONAL_FAX"], "PERSONAL_MOBILE" => $_POST["PERSONAL_MOBILE"], "PERSONAL_PAGER" => $_POST["PERSONAL_PAGER"], "PERSONAL_STREET" => $_POST["PERSONAL_STREET"], "PERSONAL_MAILBOX" => $_POST["PERSONAL_MAILBOX"], "PERSONAL_CITY" => $_POST["PERSONAL_CITY"], "PERSONAL_STATE" => $_POST["PERSONAL_STATE"], "PERSONAL_ZIP" => $_POST["PERSONAL_ZIP"], "PERSONAL_COUNTRY" => $_POST["PERSONAL_COUNTRY"], "PERSONAL_NOTES" => $_POST["PERSONAL_NOTES"], "WORK_COMPANY" => $_POST["WORK_COMPANY"], "WORK_DEPARTMENT" => $_POST["WORK_DEPARTMENT"], "WORK_POSITION" => $_POST["WORK_POSITION"], "WORK_WWW" => $_POST["WORK_WWW"], "WORK_PHONE" => $_POST["WORK_PHONE"], "WORK_FAX" => $_POST["WORK_FAX"], "WORK_PAGER" => $_POST["WORK_PAGER"], "WORK_STREET" => $_POST["WORK_STREET"], "WORK_MAILBOX" => $_POST["WORK_MAILBOX"], "WORK_CITY" => $_POST["WORK_CITY"], "WORK_STATE" => $_POST["WORK_STATE"], "WORK_ZIP" => $_POST["WORK_ZIP"], "WORK_COUNTRY" => $_POST["WORK_COUNTRY"], "WORK_PROFILE" => $_POST["WORK_PROFILE"], "WORK_LOGO" => $arWORK_LOGO, "WORK_NOTES" => $_POST["WORK_NOTES"], "AUTO_TIME_ZONE" => $_POST["AUTO_TIME_ZONE"] == "Y" || $_POST["AUTO_TIME_ZONE"] == "N" ? $_POST["AUTO_TIME_ZONE"] : ""); if (isset($_POST["TIME_ZONE"])) { $arFields["TIME_ZONE"] = $_POST["TIME_ZONE"]; } if ($USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users')) { if ($_POST["LID"] != '') { $arFields["LID"] = $_POST["LID"];
} break; } } $user_id = 0; if (!$err) { //external authentication foreach (GetModuleEvents("main", "OnUserLoginExternal", true) as $arEvent) { $user_id = ExecuteModuleEventEx($arEvent, array(&$arParams)); if ($user_id > 0) { break; } } } if ($user_id > 0) { $dbUser = CUser::GetById($user_id); } else { $dbUser = CUser::GetByLogin($oRequest->arParameters['login']); } if (!($arUser = $dbUser->Fetch())) { $oResponse->status = "444 User is not found."; $oResponse->text = "User is not found."; $arControllerLog['STATUS'] = 'N'; $arControllerLog['DESCRIPTION'] = $oResponse->text; $a = CControllerLog::Add($arControllerLog); } else { if (strlen($arUser["PASSWORD"]) > 32) { $salt = substr($arUser["PASSWORD"], 0, strlen($arUser["PASSWORD"]) - 32); $db_password = substr($arUser["PASSWORD"], -32); } else { $salt = "";
protected function buildUser($id) { $res = $id; if (is_integer($res)) { if (!array_key_exists($res, static::$users)) { $res = \CUser::GetById($res)->Fetch(); $res = array("ID" => $res["ID"], "NAME" => $res["NAME"], "LAST_NAME" => $res["LAST_NAME"], "SECOND_NAME" => $res["SECOND_NAME"], "AVATAR" => $res["AVATAR"]); static::$users[$id] = $res; } $res = static::$users[$id]; } $res["NAME"] = htmlspecialcharsbx($res["NAME"]); $res["LAST_NAME"] = htmlspecialcharsbx($res["LAST_NAME"]); $res["SECOND_NAME"] = htmlspecialcharsbx($res["SECOND_NAME"]); $res["IS_EXTRANET"] = is_array($GLOBALS["arExtranetUserID"]) && in_array($res["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N"; return $res; }
<?php $name = $APPLICATION->IncludeComponent("bitrix:socialnetwork.group.selector", ".default", array("BIND_ELEMENT" => "task-report-filter-group", "ON_SELECT" => "onFilterGroupSelect", "SEARCH_INPUT" => "filter-field-group", "SELECTED" => $arResult["FILTER"]["F_GROUP_ID"] ? $arResult["FILTER"]["F_GROUP_ID"] : 0), null, array("HIDE_ICONS" => "Y")); ?> </div> <?php } ?> <div class="filter-field"> <label for="filter-field-employee" class="filter-field-title"><?php echo GetMessage("TASKS_REPORT_SUBORDINATE"); ?> </label> <?php $userName = ""; if (intval($arResult["FILTER"]["F_RESPONSIBLE_ID"]) > 0) { $rsUser = CUser::GetById(intval($arResult["FILTER"]["F_RESPONSIBLE_ID"])); if ($arUser = $rsUser->Fetch()) { $userName = CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser); } } ?> <span class="webform-field webform-field-textbox<?php if (!strlen($userName)) { ?> webform-field-textbox-empty<?php } ?> webform-field-textbox-clearable"> <span class="webform-field-textbox-inner"> <input type="text" id="filter-field-employee" class="webform-field-textbox" value="<?php echo $userName;