Exemple #1
0
 /**
  * @param $arParams
  * @return array
  */
 public function onPrepareComponentParams($arParams)
 {
     $arParams['FILTER_NAME'] = $this->initFilterName($arParams['FILTER_NAME']);
     $this->loadTooltipFromSocialNetwork($arParams);
     $arParams["NAME_TEMPLATE"] = empty($arParams["NAME_TEMPLATE"]) || !trim($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat() : $arParams["NAME_TEMPLATE"];
     //set default to Y
     $arParams['SHOW_LOGIN'] = empty($arParams['SHOW_LOGIN']) || $arParams['SHOW_LOGIN'] != "N" ? "Y" : "N";
     //if not set value, set to default
     $arParams["PM_URL"] = empty($arParams["PM_URL"]) ? "/company/personal/messages/chat/#USER_ID#/" : $arParams["PM_URL"];
     $arParams["PATH_TO_CONPANY_DEPARTMENT"] = empty($arParams["PATH_TO_CONPANY_DEPARTMENT"]) ? "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#" : $arParams["PATH_TO_CONPANY_DEPARTMENT"];
     $arParams["PATH_TO_VIDEO_CALL"] = IsModuleInstalled("video") && empty($arParams["PATH_TO_VIDEO_CALL"]) ? "/company/personal/video/#USER_ID#/" : $arParams["PATH_TO_VIDEO_CALL"];
     TrimArr($arParams['ALPHABET_LANG']);
     $arParams['ALPHABET_LANG'] = empty($arParams['ALPHABET_LANG']) ? array(LANGUAGE_ID) : $arParams['ALPHABET_LANG'];
     $arParams['CURRENT_VIEW'] = $this->getCurrentView($arParams);
     $arParams['LIST_URL'] = $this->getApplication()->GetCurPage();
     if (!$arParams['DETAIL_URL']) {
         $arParams['DETAIL_URL'] = $arParams['LIST_URL'] . '?ID=#USER_ID#';
     }
     return parent::onPrepareComponentParams($arParams);
 }
Exemple #2
0
 function GetRandom($TYPE_SID)
 {
     $err_mess = CAdvBanner_all::err_mess() . "<br>Function: GetRandom<br>Line: ";
     global $APPLICATION, $DB, $arrViewedBanners, $arrADV_VIEWED_BANNERS;
     static $arrWeightSum = false;
     $TYPE_SID = trim($TYPE_SID);
     if (strlen($TYPE_SID) <= 0) {
         return false;
     }
     $DONT_USE_CONTRACT = COption::GetOptionString("advertising", "DONT_USE_CONTRACT", "N");
     if ($arrWeightSum === false) {
         // получим массив весов для текущей страницы
         $arrWeightSum = array();
         $arrCookie_counter = array();
         // если мы уже получили на странице значение cookie то
         if (is_array($arrADV_VIEWED_BANNERS)) {
             while (list($banner_id, $arr) = each($arrADV_VIEWED_BANNERS)) {
                 $arrCookie_counter[$banner_id] = $arr["COUNTER"];
             }
         } else {
             $cookie_name = "BANNERS";
             $arr = explode(",", $APPLICATION->get_cookie($cookie_name));
             if (is_array($arr) && count($arr) > 0) {
                 foreach ($arr as $str) {
                     $ar = explode("_", $str);
                     $banner_id = intval($ar[1]);
                     $counter = intval($ar[2]);
                     $arrCookie_counter[$banner_id] = $counter;
                 }
             }
         }
         $arrWeightSum_RequiredKeywords = array();
         $arrWeightSum_DesiredKeywords = array();
         $arrWeightSum_EmptyKeywords = array();
         $arrWeightSum_all = array();
         $arKeywordsSet = array();
         // заданы ли ключевые слова для того или иного типа
         $arrRequiredKeywordsBanners = array();
         // массив баннеров для которых были найдены все ключевые слова
         $arrDesiredKeywordsBanners = array();
         // массив баннеров для которых было найдено хотя бы одно желательное слово
         $arrEmptyKeywordsBanners = array();
         // массив баннеров у которых поле "ключевые слова" не заполнено
         $arrPAGE_KEYWORDS = CAdvBanner::GetKeywords();
         // массив ключевых слов заданных для данной страницы
         $arrDesiredPageKeywords_all = is_array($arrPAGE_KEYWORDS[""]["DESIRED"]) ? $arrPAGE_KEYWORDS[""]["DESIRED"] : array();
         $arrRequiredPageKeywords_all = is_array($arrPAGE_KEYWORDS[""]["REQUIRED"]) ? $arrPAGE_KEYWORDS[""]["REQUIRED"] : array();
         $rs = CAdvBanner::GetPageWeights_RS();
         while ($ar = $rs->Fetch()) {
             // Check for blocked uniformed banners
             if (isset($ar["FLYUNIFORM"]) and $ar["FLYUNIFORM"] == "Y") {
                 $unitest = CAdvBanner_all::GetUniformityCoef($ar);
                 if ($unitest >= 1.0 + BANNER_UNIFORMITY_DIVERGENCE_COEF) {
                     continue;
                 }
             }
             $arKeywordsSet[$ar["TYPE_SID"]] = "N";
             if (intval($ar["SHOWS_FOR_VISITOR"]) > 0 && intval($arrCookie_counter[$ar["BANNER_ID"]]) < intval($ar["SHOWS_FOR_VISITOR"]) || intval($ar["SHOWS_FOR_VISITOR"]) <= 0) {
                 $arr = $arrPAGE_KEYWORDS[$ar["TYPE_SID"]]["DESIRED"];
                 $arrDesiredPageKeywords = is_array($arr) ? $arr : array();
                 $arr = $arrPAGE_KEYWORDS[$ar["TYPE_SID"]]["REQUIRED"];
                 $arrRequiredPageKeywords = is_array($arr) ? $arr : array();
                 if (count($arrRequiredPageKeywords) > 0 || count($arrRequiredPageKeywords_all) > 0 || count($arrDesiredPageKeywords) > 0 || count($arrDesiredPageKeywords_all) > 0) {
                     $arKeywordsSet[$ar["TYPE_SID"]] = "Y";
                 }
                 $arrBannerKeywords = preg_split('/[\\n\\r]+/', $ar["BANNER_KEYWORDS"]);
                 if (is_array($arrBannerKeywords)) {
                     TrimArr($arrBannerKeywords);
                 }
                 if ($DONT_USE_CONTRACT != "Y" && $ar["CONTRACT_KEYWORDS"] != '') {
                     $arrContractKeywords = preg_split('/[\\n\\r]+/', $ar["CONTRACT_KEYWORDS"]);
                     if (is_array($arrContractKeywords)) {
                         TrimArr($arrContractKeywords);
                     }
                     $arrBannerKeywords = array_unique(array_merge($arrBannerKeywords, $arrContractKeywords));
                 }
                 if ($DONT_USE_CONTRACT == "Y" || !array_key_exists("CONTRACT_ID", $ar)) {
                     $ar["CONTRACT_ID"] = 0;
                 }
                 if (count($arrBannerKeywords) > 0) {
                     $found_required = true;
                     if (count($arrRequiredPageKeywords) > 0 || count($arrRequiredPageKeywords_all) > 0) {
                         $arr = array("Y", "N");
                         // совпадение | вхождение
                         foreach ($arr as $exact_match) {
                             $arr1 = is_array($arrRequiredPageKeywords[$exact_match]) ? $arrRequiredPageKeywords[$exact_match] : array();
                             $arr2 = is_array($arrRequiredPageKeywords_all[$exact_match]) ? $arrRequiredPageKeywords_all[$exact_match] : array();
                             $arrRequiredKeywords = array_unique(array_merge($arr1, $arr2));
                             if (count($arrRequiredKeywords) > 0) {
                                 reset($arrRequiredKeywords);
                                 foreach ($arrRequiredKeywords as $page_word) {
                                     $page_word = strtoupper($page_word);
                                     reset($arrBannerKeywords);
                                     $found = false;
                                     foreach ($arrBannerKeywords as $banner_word) {
                                         $banner_word = strtoupper($banner_word);
                                         // совпадение
                                         if ($exact_match == "Y") {
                                             if ($banner_word == $page_word) {
                                                 $found = true;
                                                 break;
                                             }
                                         } elseif ($exact_match == "N") {
                                             if (strpos($page_word, $banner_word) !== false || strpos($banner_word, $page_word) !== false) {
                                                 $found = true;
                                                 break;
                                             }
                                         }
                                     }
                                     if (!$found) {
                                         $found_required = false;
                                         break 2;
                                     }
                                 }
                             }
                         }
                         // если все ключевые слова были найдены то
                         if ($found_required) {
                             // запоминаем баннер в массиве баннеров для которых были найдены все ключевые слова
                             $arrRequiredKeywordsBanners[] = $ar["BANNER_ID"];
                         }
                     }
                     // если по обязательным словам баннер подходит то проверим по желательным словам
                     if ($found_required && (count($arrDesiredPageKeywords) > 0 || count($arrDesiredPageKeywords_all) > 0)) {
                         $found_desired = false;
                         $arr = array("Y", "N");
                         // совпадение | вхождение
                         foreach ($arr as $exact_match) {
                             $arr1 = is_array($arrDesiredPageKeywords) ? $arrDesiredPageKeywords[$exact_match] : array();
                             $arr2 = is_array($arrDesiredPageKeywords_all) ? $arrDesiredPageKeywords_all[$exact_match] : array();
                             if (!is_array($arr1)) {
                                 $arr1 = array();
                             }
                             if (!is_array($arr2)) {
                                 $arr2 = array();
                             }
                             $arrDesiredKeywords = array_unique(array_merge($arr1, $arr2));
                             if (is_array($arrDesiredKeywords) && count($arrDesiredKeywords) > 0) {
                                 reset($arrDesiredKeywords);
                                 foreach ($arrDesiredKeywords as $page_word) {
                                     $page_word = strtoupper($page_word);
                                     reset($arrBannerKeywords);
                                     foreach ($arrBannerKeywords as $banner_word) {
                                         $banner_word = strtoupper($banner_word);
                                         // совпадение
                                         if ($exact_match == "Y") {
                                             if ($banner_word == $page_word) {
                                                 $found_desired = true;
                                                 break 3;
                                             }
                                         } elseif ($exact_match == "N") {
                                             if (strpos($page_word, $banner_word) !== false || strpos($banner_word, $page_word) !== false) {
                                                 $found_desired = true;
                                                 break 3;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         // если все ключевые слова были найдены то
                         if ($found_desired) {
                             // запоминаем баннер в массиве баннеров для которых были найдены все ключевые слова
                             $arrDesiredKeywordsBanners[] = $ar["BANNER_ID"];
                         }
                     }
                 } else {
                     // запомнить баннеры у которых вообще не задано ключевых слов
                     $arrEmptyKeywordsBanners[] = $ar["BANNER_ID"];
                 }
                 if (in_array($ar["BANNER_ID"], $arrRequiredKeywordsBanners)) {
                     $arrWeightSum_RequiredKeywords[$ar["TYPE_SID"]][$ar["CONTRACT_ID"]]["WEIGHT"] = intval($ar["CONTRACT_WEIGHT"]);
                     $arrWeightSum_RequiredKeywords[$ar["TYPE_SID"]][$ar["CONTRACT_ID"]]["BANNERS"][$ar["BANNER_ID"]] = intval($ar["BANNER_WEIGHT"]);
                 }
                 if (in_array($ar["BANNER_ID"], $arrDesiredKeywordsBanners)) {
                     $arrWeightSum_DesiredKeywords[$ar["TYPE_SID"]][$ar["CONTRACT_ID"]]["WEIGHT"] = intval($ar["CONTRACT_WEIGHT"]);
                     $arrWeightSum_DesiredKeywords[$ar["TYPE_SID"]][$ar["CONTRACT_ID"]]["BANNERS"][$ar["BANNER_ID"]] = intval($ar["BANNER_WEIGHT"]);
                 }
                 if (in_array($ar["BANNER_ID"], $arrEmptyKeywordsBanners)) {
                     $arrWeightSum_EmptyKeywords[$ar["TYPE_SID"]][$ar["CONTRACT_ID"]]["WEIGHT"] = intval($ar["CONTRACT_WEIGHT"]);
                     $arrWeightSum_EmptyKeywords[$ar["TYPE_SID"]][$ar["CONTRACT_ID"]]["BANNERS"][$ar["BANNER_ID"]] = intval($ar["BANNER_WEIGHT"]);
                 }
                 $arrWeightSum_all[$ar["TYPE_SID"]][$ar["CONTRACT_ID"]]["WEIGHT"] = intval($ar["CONTRACT_WEIGHT"]);
                 $arrWeightSum_all[$ar["TYPE_SID"]][$ar["CONTRACT_ID"]]["BANNERS"][$ar["BANNER_ID"]] = intval($ar["BANNER_WEIGHT"]);
             }
         }
         $arrAllTypies = array_keys($arrWeightSum_all);
         if (count($arrAllTypies) > 0) {
             foreach ($arrAllTypies as $tsid) {
                 // если для данного типа ключевые слова заданы то
                 if ($arKeywordsSet[$tsid] == "Y") {
                     // желательные слова
                     if (is_array($arrWeightSum_DesiredKeywords[$tsid]) && count($arrWeightSum_DesiredKeywords[$tsid]) > 0) {
                         $arrWeightSum[$tsid] = $arrWeightSum_DesiredKeywords[$tsid];
                     } elseif (is_array($arrWeightSum_RequiredKeywords[$tsid]) && count($arrWeightSum_RequiredKeywords[$tsid]) > 0) {
                         $arrWeightSum[$tsid] = $arrWeightSum_RequiredKeywords[$tsid];
                     } elseif ($arKeywordsSet[$tsid] == "Y" && is_array($arrWeightSum_EmptyKeywords[$tsid])) {
                         $arrWeightSum[$tsid] = $arrWeightSum_EmptyKeywords[$tsid];
                     }
                 } else {
                     $arrWeightSum[$tsid] = $arrWeightSum_all[$tsid];
                 }
             }
         }
     }
     $arrWSum = $arrWeightSum[$TYPE_SID];
     // если массив весов подготовлен то
     if (is_array($arrWSum) && count($arrWSum) > 0) {
         $CONTRACT_ID = 0;
         if ($DONT_USE_CONTRACT == "N" || !array_key_exists("0", $arrWSum)) {
             // получим сумму весов контрактов
             $intSum = 0;
             reset($arrWSum);
             while (list($cid, $arr) = each($arrWSum)) {
                 $CONTRACT_ID = $cid;
                 $intSum += intval($arr["WEIGHT"]);
             }
             // выберем контракт по весу
             $intStep = 0;
             $rndWeight = $intSum * (mt_rand() / mt_getrandmax());
             reset($arrWSum);
             while (list($cid, $arr) = each($arrWSum)) {
                 if ($rndWeight >= $intStep && $rndWeight <= $intStep + $arr["WEIGHT"]) {
                     $CONTRACT_ID = $cid;
                     break;
                 }
                 $intStep += $arr["WEIGHT"];
             }
             $CONTRACT_ID = intval($CONTRACT_ID) <= 0 ? 1 : intval($CONTRACT_ID);
         }
         $arrWeightBanners = $arrWSum[$CONTRACT_ID]["BANNERS"];
         // если ID контракта определен то
         if (is_array($arrWeightBanners) && count($arrWeightBanners) > 0) {
             // получим сумму весов баннеров контракта
             $intSum = 0;
             $strBanners = "0";
             reset($arrWeightBanners);
             while (list($bid, $weight) = each($arrWeightBanners)) {
                 if (in_array($bid, $arrViewedBanners)) {
                     continue;
                 }
                 $intSum += intval($weight);
                 $strBanners .= "," . intval($bid);
             }
             if ($CONTRACT_ID > 0) {
                 $strSql = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tB.*,\n\t\t\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FIRST", "FULL") . " DATE_SHOW_FIRST,\n\t\t\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FROM", "FULL") . " DATE_SHOW_FROM,\n\t\t\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_TO", "FULL") . " DATE_SHOW_TO,\n\t\t\t\t\t\t\tC.MAX_VISITOR_COUNT\t\tCONTRACT_MAX_VISITOR_COUNT\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_adv_banner B,\n\t\t\t\t\t\t\tb_adv_contract C\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tB.CONTRACT_ID = {$CONTRACT_ID}\n\t\t\t\t\t\tand\tB.TYPE_SID = '" . $DB->ForSql($TYPE_SID, 255) . "'\n\t\t\t\t\t\tand B.ID in (" . $strBanners . ")\n\t\t\t\t\t\tand C.ID = B.CONTRACT_ID\n\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\tFLYUNIFORM DESC\n\t\t\t\t\t\t";
             } else {
                 $strSql = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tB.*,\n\t\t\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FIRST", "FULL") . " DATE_SHOW_FIRST,\n\t\t\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FROM", "FULL") . " DATE_SHOW_FROM,\n\t\t\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_TO", "FULL") . " DATE_SHOW_TO\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_adv_banner B\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\tB.TYPE_SID = '" . $DB->ForSql($TYPE_SID, 255) . "'\n\t\t\t\t\t\tAND B.ID in (" . $strBanners . ")\n\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\tFLYUNIFORM DESC\n\t\t\t\t\t\t";
             }
             $intSum = 0;
             $infVal = 0;
             $infUniform = null;
             $stubs = array();
             $rsBanners = $DB->Query($strSql, false, $err_mess . __LINE__);
             while ($arBanner = $rsBanners->Fetch()) {
                 if (isset($arBanner["FLYUNIFORM"]) and $arBanner["FLYUNIFORM"] == "Y") {
                     // Select most last (weak) rotated banner (x<<1)
                     $unitest = CAdvBanner_all::GetUniformityCoef($arBanner);
                     if ($unitest < $infVal or !$infUniform) {
                         $infVal = $unitest;
                         $infUniform = $arBanner;
                     }
                 } else {
                     $intSum += intval($arBanner["WEIGHT"]);
                     array_push($stubs, $arBanner);
                     // Save stubs
                 }
             }
             // Check out selected uniformed banner
             if ($infUniform == null or $infVal >= 1.0 + BANNER_UNIFORMITY_DIVERGENCE_COEF) {
                 // If this, we have to stop alittle this banner, and show stub one.
                 $infUniform = array();
                 if (count($stubs) > 0) {
                     $intStep = 0;
                     $rndWeight = $intSum * (mt_rand() / mt_getrandmax());
                     reset($stubs);
                     $infUniform = current($stubs);
                     if ($rndWeight < $intStep or $rndWeight > $intStep + $infUniform["WEIGHT"]) {
                         $intStep += $infUniform["WEIGHT"];
                         while ($infUniform = next($stubs)) {
                             if ($rndWeight >= $intStep && $rndWeight <= $intStep + $infUniform["WEIGHT"]) {
                                 break;
                             }
                             $intStep += $infUniform["WEIGHT"];
                         }
                     }
                 }
             }
             $arBanner = $infUniform;
             $BANNER_ID = intval($arBanner["ID"]);
             if ($BANNER_ID > 0) {
                 unset($arrWeightSum[$TYPE_SID][$CONTRACT_ID]["BANNERS"][$arBanner["ID"]]);
                 if (count($arrWeightSum[$TYPE_SID][$CONTRACT_ID]["BANNERS"]) <= 0) {
                     unset($arrWeightSum[$TYPE_SID][$CONTRACT_ID]);
                 }
                 $arrViewedBanners[] = $arBanner["ID"];
             }
             return $arBanner;
         }
     }
     return null;
 }
Exemple #3
0
 function Set_sendMails($nf, $v, $arFields)
 {
     $I_Email = null;
     $U_Email = null;
     if (!$v->isNew) {
         $U_Email = "Y";
     } else {
         $I_Email = "Y";
     }
     IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/classes/general/messages.php", $v->arrSite["LANGUAGE_ID"]);
     $mf = self::GetCSupportTableFields("EventFields");
     $mf->ADMIN_EDIT_URL = "/bitrix/admin/ticket_edit.php";
     $mf->LANGUAGE = $v->arrSite["LANGUAGE_ID"];
     $mf->LANGUAGE_ID = $v->arrSite["LANGUAGE_ID"];
     $arrSet = array("ID" => "ID", "DATE_CREATE" => "DATE_CREATE", "TIMESTAMP" => "TIMESTAMP_X", "DATE_CLOSE" => "DATE_CLOSE", "TITLE" => "TITLE", "CATEGORY" => "CATEGORY_NAME", "CRITICALITY" => "CRITICALITY_NAME", "DIFFICULTY" => "DIFFICULTY_NAME", "STATUS" => "STATUS_NAME", "SLA" => "SLA_NAME", "OWNER_USER_ID" => "OWNER_USER_ID", "OWNER_GUEST_ID" => "OWNER_GUEST_ID", "OWNER_SID" => "OWNER_SID", "OWNER_USER_NAME" => "OWNER_NAME", "OWNER_USER_LOGIN" => "OWNER_LOGIN", "OWNER_USER_EMAIL" => "OWNER_EMAIL", "RESPONSIBLE_USER_ID" => "RESPONSIBLE_USER_ID", "RESPONSIBLE_USER_NAME" => "RESPONSIBLE_NAME", "RESPONSIBLE_USER_LOGIN" => "RESPONSIBLE_LOGIN", "RESPONSIBLE_USER_EMAIL" => "RESPONSIBLE_EMAIL", "CREATED_USER_ID" => "CREATED_USER_ID", "CREATED_GUEST_ID" => "CREATED_GUEST_ID", "CREATED_USER_LOGIN" => "CREATED_LOGIN", "CREATED_USER_EMAIL" => "CREATED_EMAIL", "CREATED_USER_NAME" => "CREATED_NAME");
     if (!$v->isNew) {
         $arrSet["MODIFIED_USER_ID"] = "MODIFIED_USER_ID";
         $arrSet["MODIFIED_GUEST_ID"] = "MODIFIED_GUEST_ID";
         $arrSet["MODIFIED_USER_LOGIN"] = "******";
         $arrSet["MODIFIED_USER_EMAIL"] = "MODIFIED_EMAIL";
         $arrSet["MODIFIED_USER_NAME"] = "MODIFIED_NAME";
         $arrSet["RATE"] = "MARK_NAME";
         $arrSet["MESSAGES_AMOUNT"] = "MESSAGES";
     }
     $mf->FromArray((array) $nf, $arrSet);
     $arUserIDs = array($mf->OWNER_USER_ID, $mf->CREATED_USER_ID, $mf->MODIFIED_USER_ID, $mf->RESPONSIBLE_USER_ID);
     $arGuestIDs = array($mf->OWNER_GUEST_ID, $mf->CREATED_GUEST_ID, $mf->MODIFIED_GUEST_ID);
     $arStrUsers = CTicket::GetUsersPropertiesArray($arUserIDs, $arGuestIDs);
     // set name, login, email
     $userCategories = array('OWNER', 'RESPONSIBLE', 'CREATED');
     if (!$v->isNew) {
         $userCategories[] = 'MODIFIED';
     }
     foreach ($userCategories as $userCategory) {
         $propertyId = $userCategory . '_USER_ID';
         if ($mf->{$propertyId} > 0 && isset($arStrUsers['arUsers'][$mf->{$propertyId}])) {
             $name = CUser::FormatName(CSite::GetNameFormat(), $arStrUsers['arUsers'][$mf->{$propertyId}], true, true);
             $propertyName = $userCategory . '_USER_NAME';
             $mf->{$propertyName} = $name;
             $propertyLogin = $userCategory . '_USER_LOGIN';
             $mf->{$propertyLogin} = $arStrUsers['arUsers'][$mf->{$propertyId}]['LOGIN'];
             $propertyEmail = $userCategory . '_USER_EMAIL';
             $mf->{$propertyEmail} = $arStrUsers['arUsers'][$mf->{$propertyId}]['EMAIL'];
         }
     }
     $mf->FILES_LINKS = self::Set_getFilesLinks($v->arrFILES, $v->arrSite["LANGUAGE_ID"]);
     $mf->IMAGE_LINK = $mf->FILES_LINKS;
     $mf->MESSAGE_BODY = PrepareTxtForEmail($arFields["MESSAGE"], $v->arrSite["LANGUAGE_ID"], false, false);
     // сформируем email автора
     // Событие: "TICKET_CHANGE_BY_AUTHOR_FOR_AUTHOR"	- #DEFAULT_EMAIL_FROM# -> #OWNER_EMAIL# (Обращение изменено автором (для автора))
     // Событие: "TICKET_CHANGE_BY_SUPPORT_FOR_AUTHOR"	- #DEFAULT_EMAIL_FROM# -> #OWNER_EMAIL# (Обращение изменено сотрудником техподдержки (для автора))
     // Событие: "TICKET_NEW_FOR_AUTHOR"					- #DEFAULT_EMAIL_FROM# -> #OWNER_EMAIL# (Новое обращение (для автора))
     $ownerEmail = "";
     if ($mf->OWNER_USER_ID > 0 && isset($arStrUsers["arUsers"][$mf->OWNER_USER_ID])) {
         $ownerEmail = $arStrUsers["arUsers"][$mf->OWNER_USER_ID]["EMAIL"];
     } elseif ($mf->OWNER_GUEST_ID > 0 && isset($arStrUsers["arGuests"][$mf->OWNER_GUEST_ID])) {
         $ownerEmail = $arStrUsers["arGuests"][$mf->OWNER_GUEST_ID]["EMAIL"];
     }
     $arrOwnerEmails = self::EmailsFromStringToArray($mf->OWNER_SID, array($ownerEmail));
     if (intval($mf->OWNER_USER_ID) > 0) {
         $rs = CTicket::GetResponsibleList($mf->OWNER_USER_ID, $I_Email, $U_Email);
         while ($arr0 = $rs->Fetch()) {
             if (strlen($arr0['EMAIL']) > 0) {
                 $arrOwnerEmails[] = $arr0['EMAIL'];
             }
         }
     }
     $mf->OWNER_EMAIL = implode(", ", array_unique($arrOwnerEmails));
     // выбираем административные email'ы
     $arrAdminEMails = CTicket::GetAdminEmails();
     if (!is_array($arrAdminEMails)) {
         $arrAdminEMails = array();
     }
     TrimArr($arrAdminEMails);
     // сформируем email техподдержки
     // Событие: "TICKET_OVERDUE_REMINDER"				- #DEFAULT_EMAIL_FROM# -> #SUPPORT_EMAIL# (Напоминание о необходимости ответа (для техподдержки))
     // Событие: "TICKET_CHANGE_FOR_TECHSUPPORT"			- #DEFAULT_EMAIL_FROM# -> #SUPPORT_EMAIL# (Изменения в обращении (для техподдержки))
     // Событие: "TICKET_NEW_FOR_TECHSUPPORT"			- #DEFAULT_EMAIL_FROM# -> #SUPPORT_EMAIL# (Новое обращение (для техподдержки))
     $arrSupportEmails = array();
     if ($mf->RESPONSIBLE_USER_ID > 0 && isset($arStrUsers["arUsers"][$mf->RESPONSIBLE_USER_ID])) {
         $arrSupportEmails[] = $arStrUsers["arUsers"][$mf->RESPONSIBLE_USER_ID]["EMAIL"];
         // из группы ответсвенного, выбираем всех пользователей кто имеет доступ к рассылке
         $rs = CTicket::GetResponsibleList($mf->RESPONSIBLE_USER_ID, $I_Email, $U_Email, "Y");
         while ($arr0 = $rs->Fetch()) {
             if (strlen($arr0['EMAIL']) > 0) {
                 $arrSupportEmails[] = $arr0['EMAIL'];
             }
         }
     }
     if (count($arrSupportEmails) <= 0) {
         $arrSupportEmails = $arrAdminEMails;
     }
     if (count($arrSupportEmails) <= 0) {
         $se = COption::GetOptionString("main", "email_from", "");
         if (strlen($se) > 0) {
             $arrSupportEmails[] = $se;
         }
     }
     TrimArr($arrSupportEmails);
     $mf->SUPPORT_EMAIL = count($arrSupportEmails) > 0 ? TrimEx(implode(",", array_unique($arrSupportEmails)), ",") : "";
     // удалим продублированные адреса из макроса #SUPPORT_ADMIN_EMAIL#
     if (count($arrSupportEmails) > 0) {
         foreach ($arrSupportEmails as $e) {
             unset($arrAdminEMails[$e]);
         }
     }
     $mf->SUPPORT_ADMIN_EMAIL = count($arrAdminEMails) > 0 ? TrimEx(implode(",", $arrAdminEMails), ",") : "";
     if (array_key_exists('PUBLIC_EDIT_URL', $arFields) && strlen($arFields['PUBLIC_EDIT_URL']) > 0) {
         $mf->PUBLIC_EDIT_URL = $arFields['PUBLIC_EDIT_URL'];
     } else {
         $peurl = COption::GetOptionString("support", "SUPPORT_DIR");
         $peurl = str_replace("#LANG_DIR#", $v->arrSite["DIR"], $peurl);
         // совместимость
         $peurl = str_replace("#SITE_DIR#", $v->arrSite["DIR"], $peurl);
         $peurl = str_replace("\\", "/", $peurl);
         $peurl = str_replace("//", "/", $peurl);
         $peurl = TrimEx($peurl, "/");
         $mf->PUBLIC_EDIT_URL = "/" . $peurl . "/" . COption::GetOptionString("support", "SUPPORT_EDIT");
     }
     $mf->SUPPORT_COMMENTS = PrepareTxtForEmail($arFields["SUPPORT_COMMENTS"], $v->arrSite["LANGUAGE_ID"]);
     if (strlen($mf->SUPPORT_COMMENTS) > 0) {
         $mf->SUPPORT_COMMENTS = "\n\n" . $mf->SUPPORT_COMMENTS . "\n";
     }
     $mf->SOURCE = strlen($nf->SOURCE_NAME) <= 0 ? "" : "[" . $nf->SOURCE_NAME . "] ";
     $oUID = intval($mf->OWNER_USER_ID);
     $oGID = intval($mf->OWNER_GUEST_ID);
     if ($oGID > 0) {
         $mf->OWNER_TEXT = $arStrUsers["arGuests"][$oGID]["HTML_NAME_S"];
         if ($oUID > 0) {
             $mf->OWNER_TEXT .= self::addSupportText($oUID);
         }
     } elseif ($oUID > 0) {
         $mf->OWNER_TEXT = $arStrUsers["arUsers"][$oUID]["HTML_NAME_S"];
         $mf->OWNER_TEXT .= self::addSupportText($oUID);
     }
     if (strlen(trim($mf->OWNER_SID)) > 0 && $mf->OWNER_SID != null) {
         $mf->OWNER_TEXT = " / " . $mf->OWNER_TEXT;
     }
     if ($nf->CREATED_MODULE_NAME == "support" || strlen($nf->CREATED_MODULE_NAME) <= 0) {
         $cUID = intval($mf->CREATED_USER_ID);
         $cGID = intval($mf->CREATED_GUEST_ID);
         if ($cGID > 0) {
             $mf->CREATED_TEXT = $arStrUsers["arGuests"][$cGID]["HTML_NAME_S"];
         } elseif ($cUID > 0) {
             $mf->CREATED_TEXT = $arStrUsers["arUsers"][$cUID]["HTML_NAME_S"];
         }
     } else {
         $mf->CREATED_MODULE_NAME = "[" . $nf->CREATED_MODULE_NAME . "]";
     }
     $rUID = intval($mf->RESPONSIBLE_USER_ID);
     if ($rUID > 0) {
         $mf->RESPONSIBLE_TEXT = $arStrUsers["arUsers"][$rUID]["HTML_NAME_S"];
         $mf->RESPONSIBLE_TEXT .= self::addSupportText($rUID);
     }
     /*
     if($mf->OWNER_USER_ID > 0 || strlen(trim($mf->OWNER_USER_LOGIN)) > 0)
     {
     	$mf->OWNER_TEXT = "[" . $mf->OWNER_USER_ID . "] (" . $mf->OWNER_USER_LOGIN . ") " . $mf->OWNER_USER_NAME;
     	if(strlen(trim($mf->OWNER_SID)) > 0 && $mf->OWNER_SID != null) $mf->OWNER_TEXT = " / " . $mf->OWNER_TEXT;
     	$mf->OWNER_TEXT .= self::addSupportText($mf->OWNER_USER_ID);
     }
     
     if($nf->CREATED_MODULE_NAME == "support")
     {
     	$mf->CREATED_MODULE_NAME = "";
     	if($mf->CREATED_USER_ID > 0)
     	{
     		$mf->CREATED_TEXT = "[" . $mf->CREATED_USER_ID . "] (" . $mf->CREATED_USER_LOGIN . ") " . $mf->CREATED_USER_NAME . self::addSupportText($mf->CREATED_USER_ID);
     	}
     }
     else
     {
     	$mf->CREATED_MODULE_NAME = "[" . $nf->CREATED_MODULE_NAME . "]";
     }
     
     if($mf->RESPONSIBLE_USER_ID > 0)
     {
     	$mf->RESPONSIBLE_TEXT = "[" . $mf->RESPONSIBLE_USER_ID . "] (" . $nf->RESPONSIBLE_LOGIN . ") " . $nf->RESPONSIBLE_NAME;
     	$mf->RESPONSIBLE_TEXT .= self::addSupportText($mf->RESPONSIBLE_USER_ID);
     }
     */
     if (!$v->isNew) {
         /*
         if($nf->MODIFIED_MODULE_NAME == "support" && strlen($nf->MODIFIED_MODULE_NAME) > 0)
         {
         	$mf->MODIFIED_MODULE_NAME = "";
         	if($mf->MODIFIED_USER_ID > 0)
         	{
         		$mf->MODIFIED_TEXT = "[" . $mf->MODIFIED_USER_ID . "] (" . $mf->MODIFIED_USER_LOGIN . ") " . $mf->MODIFIED_USER_NAME;
         		$mf->MODIFIED_TEXT .= self::addSupportText($mf->MODIFIED_USER_ID);
         	}
         }
         else $mf->MODIFIED_MODULE_NAME = "[" . $nf->MODIFIED_MODULE_NAME . "]";
         */
         if ($nf->MODIFIED_MODULE_NAME == "support" || strlen($nf->MODIFIED_MODULE_NAME) <= 0) {
             $rUID = intval($mf->MODIFIED_USER_ID);
             $rGID = intval($mf->MODIFIED_GUEST_ID);
             if ($rGID > 0) {
                 $mf->MODIFIED_TEXT = $arStrUsers["arGuests"][$rGID]["HTML_NAME_S"];
                 if ($rUID > 0) {
                     $mf->MODIFIED_TEXT .= self::addSupportText($rUID);
                 }
             } elseif ($rUID > 0) {
                 $mf->MODIFIED_TEXT = $arStrUsers["arUsers"][$rUID]["HTML_NAME_S"];
                 $mf->MODIFIED_TEXT .= self::addSupportText($rUID);
             }
         } else {
             $mf->MODIFIED_MODULE_NAME = "[" . $nf->MODIFIED_MODULE_NAME . "]";
         }
         $mf->MESSAGE_SOURCE = "";
         if ($rsSource = CTicketDictionary::GetByID($arFields["MESSAGE_SOURCE_ID"])) {
             $arSource = $rsSource->Fetch();
             $mf->MESSAGE_SOURCE = array_key_exists("NAME", $arSource) && strlen($arSource["NAME"]) > 0 ? "[" . $arSource["NAME"] . "] " : "";
         }
         if ((strlen(trim($arFields["MESSAGE_AUTHOR_SID"])) > 0 || intval($arFields["MESSAGE_AUTHOR_USER_ID"]) > 0) && $v->bSupportTeam) {
             $mf->MESSAGE_AUTHOR_USER_ID = $arFields["MESSAGE_AUTHOR_USER_ID"];
             $mf->MESSAGE_AUTHOR_SID = $arFields["MESSAGE_AUTHOR_SID"];
         } else {
             $mf->MESSAGE_AUTHOR_USER_ID = $v->uid;
         }
         $arMA = array();
         if ($rsMA = CUser::GetByID($mf->MESSAGE_AUTHOR_USER_ID)) {
             $arMA = $rsMA->Fetch();
         }
         if ($mf->MESSAGE_AUTHOR_USER_ID > 0 || strlen(trim($arMA["LOGIN"])) > 0) {
             $mf->MESSAGE_AUTHOR_TEXT = "[" . $mf->MESSAGE_AUTHOR_USER_ID . "] (" . $arMA["LOGIN"] . ") " . $arMA["NAME"] . " " . $arMA["LAST_NAME"];
             if (strlen(trim($arFields["MESSAGE_AUTHOR_SID"])) > 0) {
                 $mf->MESSAGE_AUTHOR_TEXT = " / " . $mf->MESSAGE_AUTHOR_TEXT;
             }
             if ($mf->MESSAGE_AUTHOR_USER_ID > 0) {
                 $mf->MESSAGE_AUTHOR_TEXT .= self::addSupportText($mf->MESSAGE_AUTHOR_USER_ID);
             }
         }
         if (strlen(trim($arMA["NAME"])) > 0 || strlen(trim($arMA["LAST_NAME"])) > 0) {
             $mf->MESSAGE_AUTHOR_USER_NAME = trim($arMA["NAME"]) . " " . trim($arMA["LAST_NAME"]);
         }
         if (strlen(trim($arMA["LOGIN"])) > 0) {
             $mf->MESSAGE_AUTHOR_USER_LOGIN = $arMA["LOGIN"];
         }
         if (strlen(trim($arMA["EMAIL"])) > 0) {
             $mf->MESSAGE_AUTHOR_USER_EMAIL = $arMA["EMAIL"];
         }
         $mf->MESSAGE_HEADER = str_repeat("=", 23) . " " . GetMessage("SUP_MAIL_MESSAGE") . " " . str_repeat("=", 34);
     }
     $mf->SPAM_MARK = "";
     if (strlen($nf->IS_SPAM) > 0) {
         if ($nf->IS_SPAM == "Y") {
             $mf->SPAM_MARK = "\n" . GetMessage("SUP_EXACTLY_SPAM") . "\n";
         } else {
             $mf->SPAM_MARK = "\n" . GetMessage("SUP_POSSIBLE_SPAM") . "\n";
         }
     }
     self::Set_WriteLog($nf, $v, $mf);
     //$v  +change, +change_hidden
     if (!$v->isNew) {
         $mf->MESSAGE_FOOTER = str_repeat("=", strlen($mf->MESSAGE_HEADER));
     }
     if ($v->isNew && $v->bActiveCoupon) {
         $mf->COUPON = $v->V_COUPON;
     }
     $arEventFields_author = $mf->ToArray(CSupportTableFields::ALL);
     //, array(CSupportTableFields::NOT_NULL)
     $arEventFields_support = $arEventFields_author;
     // отсылаем письмо автору
     if ($v->SEND_EMAIL_TO_AUTHOR == "Y" && ($v->isNew || strlen($v->change) > 0)) {
         $EventType = "TICKET_NEW_FOR_AUTHOR";
         if (!$v->isNew) {
             // HIDDEN
             if ($arFields["HIDDEN"] == "Y") {
                 $arrUnsetHidden = array("MESSAGE_BODY", "IMAGE_LINK");
                 foreach ($arrUnsetHidden as $value) {
                     $arEventFields_author[$value] = "";
                 }
             }
             $EventType = "TICKET_CHANGE_BY_AUTHOR_FOR_AUTHOR";
             if (CTicket::IsSupportTeam($mf->MESSAGE_AUTHOR_USER_ID) || CTicket::IsAdmin($mf->MESSAGE_AUTHOR_USER_ID)) {
                 $EventType = "TICKET_CHANGE_BY_SUPPORT_FOR_AUTHOR";
             }
         }
         $arEventFields_author = CTicket::ExecuteEvents('OnBeforeSendMailToAuthor', $arEventFields_author, $v->isNew, $EventType);
         if ($arEventFields_author) {
             CEvent::Send($EventType, $v->arrSite["ID"], $arEventFields_author);
         }
     }
     // отсылаем письмо техподдержке
     if ($v->SEND_EMAIL_TO_TECHSUPPORT == "Y" && ($v->isNew || strlen($v->change) > 0 || strlen($v->change_hidden) > 0)) {
         $EventType = "TICKET_NEW_FOR_TECHSUPPORT";
         if (!$v->isNew) {
             $arEventFields_support["WHAT_CHANGE"] .= $v->change_hidden;
             $EventType = "TICKET_CHANGE_FOR_TECHSUPPORT";
         }
         $arEventFields_support = CTicket::ExecuteEvents('OnBeforeSendMailToSupport', $arEventFields_support, $v->isNew);
         if ($arEventFields_support) {
             CEvent::Send($EventType, $v->arrSite["ID"], $arEventFields_support);
         }
     }
 }
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arResult['USER_PROP'] = array();
TrimArr($arParams['USER_PROPERTY']);
$arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
if (!empty($arRes)) {
    foreach ($arRes as $key => $val) {
        $arResult['USER_PROP'][$val["FIELD_NAME"]] = strlen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"];
    }
}
foreach ($arResult['USERS'] as $arUser) {
    foreach ($arUser['UF_DEPARTMENT'] as $dept_id => $dept) {
        if (!is_array($arResult['FILTER_VALUES']['UF_DEPARTMENT']) || in_array($dept_id, $arResult['FILTER_VALUES']['UF_DEPARTMENT'])) {
            $arResult['DEPARTMENTS'][$dept_id]['USERS'][] = $arUser;
        }
    }
}
if (!CModule::IncludeModule('extranet') || !CExtranet::IsExtranetSite()) {
    if ($arResult['bAdmin']) {
        global $INTRANET_TOOLBAR;
        __IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
        $INTRANET_TOOLBAR->AddButton(array('ONCLICK' => $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/user_edit.php?lang=" . LANGUAGE_ID . "&bxpublic=Y&from_module=main", 'PARAMS' => array('height' => 500, 'width' => 900, 'resize' => false))), "TEXT" => GetMessage('INTR_ABSC_TPL_ADD_ENTRY'), "ICON" => 'add', "SORT" => 1000));
        if ($USER->CanDoOperation('edit_all_users')) {
            $INTRANET_TOOLBAR->AddButton(array('HREF' => "/bitrix/admin/user_import.php?lang=" . LANGUAGE_ID, "TEXT" => GetMessage('INTR_ABSC_TPL_IMPORT'), 'ICON' => 'import-users', "SORT" => 1100));
        }
        $INTRANET_TOOLBAR->AddButton(array('HREF' => "/bitrix/admin/user_admin.php?lang=" . LANGUAGE_ID, "TEXT" => GetMessage('INTR_ABSC_TPL_EDIT_ENTRIES'), 'ICON' => 'settings', "SORT" => 1100));
    }
}
    $str_CODE_TYPE = "html";
    //if ($isAdmin || $isManager) $str_STATUS_SID = "PUBLISHED";
    $str_STAT_EVENT_1 = "banner";
    $str_STAT_EVENT_2 = "click";
    $str_STAT_EVENT_3 = "#CONTRACT_ID# / [#BANNER_ID#] [#TYPE_SID#] #BANNER_NAME#";
    $str_MAX_SHOW_COUNT = $arContract["MAX_SHOW_COUNT"];
    $str_MAX_CLICK_COUNT = $arContract["MAX_CLICK_COUNT"];
    $arrSITE = array_keys($arrSites);
    $str_CONTRACT_ID = $CONTRACT_ID;
    $str_STAT_TYPE = "COUNTRY";
    $str_TYPE_SID = isset($TYPE_SID) && strlen($TYPE_SID) > 0 ? $TYPE_SID : "";
} else {
    if (strlen($strError) <= 0) {
        if (strlen($str_KEYWORDS) > 0) {
            $arrKEYWORDS = preg_split('/[\\n\\r]+/', $str_KEYWORDS);
            TrimArr($arrKEYWORDS);
        }
        $arrSITE = CAdvBanner::GetSiteArray($ID);
        $arrSHOW_PAGE = CAdvBanner::GetPageArray($ID, "SHOW");
        $str_SHOW_PAGE = implode("\n", $arrSHOW_PAGE);
        $arrNOT_SHOW_PAGE = CAdvBanner::GetPageArray($ID, "NOT_SHOW");
        $str_NOT_SHOW_PAGE = implode("\n", $arrNOT_SHOW_PAGE);
        if ($str_STAT_TYPE !== "CITY" && $str_STAT_TYPE != "REGION") {
            $str_STAT_TYPE = "COUNTRY";
        }
        $arrSTAT_TYPE_VALUES = CAdvBanner::GetCountryArray($ID, $str_STAT_TYPE);
        $arrWEEKDAY = CAdvBanner::GetWeekdayArray($ID);
        while (list($key, $value) = each($arrWEEKDAY)) {
            ${"arr" . $key} = $value;
        }
        $arrSTAT_ADV = CAdvBanner::GetStatAdvArray($ID);
}
IncludeModuleLangFile(__FILE__);
CModule::IncludeModule('seo');
CUtil::JSPostUnescape();
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
$arCallbacks = array('set_stats' => 'window.BXSetStats', 'set_keywords_stats' => 'window.BXUpdateKeywordsStats');
if ($_SERVER['REQUEST_METHOD'] == 'POST' && check_bitrix_sessid() && $_REQUEST['url'] && substr($_REQUEST['url'], 0, 1) == '/' && $_REQUEST['site'] && $_REQUEST['callback'] && array_key_exists($_REQUEST['callback'], $arCallbacks)) {
    $bGetFullInfo = $_REQUEST['first'] == 'Y';
    $obChecker = new CSeoPageChecker($_REQUEST['site'], $_REQUEST['url'], true, $bGetFullInfo);
    if (!$obChecker->bError) {
        if ($_REQUEST['keywords']) {
            $arKeywords = explode(',', $_REQUEST['keywords']);
            foreach ($arKeywords as $k => $v) {
                $arKeywords[$k] = trim($v);
            }
            TrimArr($arKeywords);
            $arPageResult = $obChecker->CheckKeyword($arKeywords);
            $arResult = array();
            foreach ($arKeywords as $key => $value) {
                $arWordData = array_values($arPageResult[$key]);
                $arWordData = $arWordData[0];
                if (is_array($arWordData)) {
                    $arWordData['CONTRAST'] = number_format($arWordData['CONTRAST'], 2);
                }
                $arResult[] = array($value, $arWordData);
            }
        } else {
            $arResult = array();
        }
        if ($bGetFullInfo) {
            $extended = $obChecker->GetExtendedData();
	/**
	 * <p>Для указанного <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#result">результата</a> обновляет значения <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#answer">ответа</a> на <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#question">вопрос</a> или обновляет значение <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#field">поля</a>.</p>
	 *
	 *
	 *
	 *
	 * @param int $result_id  ID <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#result">результата</a>.
	 *
	 *
	 *
	 * @param string $field_sid  Символьный идентификатор <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#question">вопроса</a> или <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#field">поля</a>.
	 *
	 *
	 *
	 * @param mixed $value = false Значение, которое необходимо сохранить. В зависимости от типа
	 * обновляемого поля, данный параметр имеет различный формат. <ul>
	 * <li>При обновлении значения <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#field">поля</a>, в данном параметре
	 * достаточно указать новое значение обновляемого <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#field">поля</a>. </li> <li>При обновлении
	 * значений <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#answer">ответов</a> на <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#question">вопрос</a>, формат данного
	 * параметра следующий: <pre>array ( <i>ID ответа 1</i> =&gt; <i>значение ответа
	 * 1</i>, <i>ID ответа 2</i> =&gt; <i>значение ответа 2</i>, ... )</pre>Если <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#answer">ответ</a> принадлежит к одним из
	 * следующих типов: <ul> <li> <b>radio</b> - переключатель одиночного выбора
	 * (radio-кнопка); </li> <li> <b>checkbox</b> - флаг множественного выбора (checkbox); </li>
	 * <li> <b>dropdown</b> - элемент выпадающего списка одиночного выбора; </li> <li>
	 * <b>multiselect</b> - элемент списка множественного выбора, </li> </ul>то в
	 * качестве "<i>значения ответа</i>" достаточно указать "" (пустое
	 * значение). <br><br>Если <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#answer">ответ</a>
	 * имеет один из следующих типов: <ul> <li> <b>text</b> - однострочное
	 * текстовое поле; </li> <li> <b>textarea</b> - многострочное текстовое поле; </li>
	 * <li> <b>date</b> - поле для ввода даты; </li> <li> <b>password</b> - поле для ввода
	 * пароля, </li> </ul>то в качестве "<i>значения ответа</i>" необходимо
	 * указать значение, которое могло бы быть введено с клавиатуры при
	 * ответе на данный <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#question">вопрос</a>.
	 * <br><br>Если <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#answer">ответ</a> имеет один
	 * из следующих типов: <ul> <li> <b>image</b> - поле для загрузки изображения;
	 * </li> <li> <b>file</b> - поле для загрузки произвольного файла. </li> </ul>то в
	 * качестве "<i>значения ответа</i>" необходимо указать массив,
	 * описывающий файл и имеющий следующий ключи: <ul> <li> <b>name</b> - имя
	 * файла; </li> <li> <b>size</b> - размер файла; </li> <li> <b>tmp_name</b> - временный путь
	 * на сервере; </li> <li> <b>type</b> - тип загружаемого файла. </li> </ul>Такой
	 * массив можно получить с помощью функции <a
	 * href="http://dev.1c-bitrix.ru/api_help/main/reference/cfile/makefilearray.php">CFile::MakeFileArray</a>. </li>
	 * </ul>Параметр <i>value</i> необязательный. По умолчанию - false (значение <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#field">поля</a> или значение <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#answer">ответа</a> на <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#question">вопрос</a> будут просто
	 * удалены).
	 *
	 *
	 *
	 * @return mixed 
	 *
	 *
	 * <h4>Example</h4> 
	 * <pre>
	 * $RESULT_ID = 186;
	 * 
	 * //<*************************************************************
	 *             Обновление значений ответов на вопросы
	 * *************************************************************>//
	 * 
	 * // обновим ответ на вопрос "Фамилия, имя, отчество"
	 * $arVALUE = array();
	 * $FIELD_SID = "VS_NAME"; // символьный идентификатор вопроса
	 * $ANSWER_ID = 586; // ID поля ответа
	 * $arVALUE[$ANSWER_ID] = "Иванов Иван";
	 * <b>CFormResult::SetField</b>($RESULT_ID, $FIELD_SID, $arVALUE);
	 * 
	 * // обновим ответ на вопрос "Дата рождения"
	 * $arVALUE = array();
	 * $FIELD_SID = "VS_BIRTHDAY"; // символьный идентификатор вопроса
	 * $ANSWER_ID = 587; // ID поля ответа
	 * $arVALUE[$ANSWER_ID] = "18.06.1975";
	 * <b>CFormResult::SetField</b>($RESULT_ID, $FIELD_SID, $arVALUE);
	 * 
	 * // обновим ответ на вопрос "Какие области знаний вас интересуют?"
	 * $arVALUE = array();
	 * $FIELD_SID = "VS_INTEREST"; // символьный идентификатор вопроса
	 * $arVALUE[612] = ""; // ID поля ответа "математика"
	 * $arVALUE[613] = ""; // ID поля ответа "физика"
	 * $arVALUE[614] = ""; // ID поля ответа "история"
	 * <b>CFormResult::SetField</b>($RESULT_ID, $FIELD_SID, $arVALUE);
	 * 
	 * // обновим ответ на вопрос "Фотография"
	 * $arVALUE = array();
	 * $FIELD_SID = "VS_PHOTO"; // символьный идентификатор вопроса
	 * $ANSWER_ID = 607; // ID поля ответа
	 * $path = $_SERVER["DOCUMENT_ROOT"]."/images/news.gif"; // путь к файлу
	 * $arVALUE[$ANSWER_ID] = CFile::MakeFileArray($path);
	 * <b>CFormResult::SetField</b>($RESULT_ID, $FIELD_SID, $arVALUE);
	 * 
	 * // обновим ответ на вопрос "Резюме"
	 * $arVALUE = array();
	 * $FIELD_SID = "VS_RESUME"; // символьный идентификатор вопроса
	 * $ANSWER_ID = 610; // ID поля ответа
	 * $path = $_SERVER["DOCUMENT_ROOT"]."/docs/alawarauthorarea.doc"; // путь к файлу
	 * $arVALUE[$ANSWER_ID] = CFile::MakeFileArray($path);
	 * <b>CFormResult::SetField</b>($RESULT_ID, $FIELD_SID, $arVALUE);
	 * 
	 * //<*************************************************************
	 *                 Обновление значений полей
	 * *************************************************************>//
	 * 
	 * // обновим значение поля "Рассчитанная стоимость"
	 * $FIELD_SID = "VS_PRICE"; // символьный идентификатор вопроса
	 * $VALUE = "155";
	 * <b>CFormResult::SetField</b>($RESULT_ID, $FIELD_SID, $VALUE);
	 * ?&gt;
	 * </pre>
	 *
	 *
	 *
	 * <h4>See Also</h4> 
	 * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/form/classes/cformresult/update.php">CFormResult::Update</a> </li>
	 * <li><a href="http://dev.1c-bitrix.ru/api_help/main/reference/cfile/makefilearray.php">CFile::MakeFileArray</a></li>
	 * </ul><a name="examples"></a>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/form/classes/cformresult/setfield.php
	 * @author Bitrix
	 */
	public static function SetField($RESULT_ID, $FIELD_SID, $VALUE=false)
	{
		global $DB, $strError;
		$err_mess = (CAllFormResult::err_mess())."<br>Function: SetField<br>Line: ";
		$RESULT_ID = intval($RESULT_ID);
		if (intval($RESULT_ID)>0)
		{
			$strSql = "
				SELECT
					FORM_ID
				FROM
					b_form_result
				WHERE
					ID = $RESULT_ID
				";
			$z = $DB->Query($strSql, false, $err_mess.__LINE__);
			$zr = $z->Fetch();
			$WEB_FORM_ID = $zr["FORM_ID"];
			if (intval($WEB_FORM_ID)>0)
			{
				$strSql = "
					SELECT
						ID,
						FIELD_TYPE,
						ADDITIONAL
					FROM
						b_form_field
					WHERE
						FORM_ID = $WEB_FORM_ID
					and SID = '".$DB->ForSql($FIELD_SID,50)."'
					";
				$q = $DB->Query($strSql, false, $err_mess.__LINE__);
				if ($arField = $q->Fetch())
				{
					$FIELD_ID = $arField["ID"];
					$IS_FIELD = ($arField["ADDITIONAL"]=="Y") ? true : false;

					if ($IS_FIELD)
					{
						$strSql = "
							DELETE FROM
								b_form_result_answer
							WHERE
								RESULT_ID = $RESULT_ID
							and FIELD_ID = $FIELD_ID
							";
						//echo "<pre>".$strSql."</pre>";
						$DB->Query($strSql, false, $err_mess.__LINE__);

						if (strlen($VALUE)>0)
						{

							$FIELD_TYPE = $arField["FIELD_TYPE"];
							switch ($FIELD_TYPE) :

								case "text":
								case "integer":

									$arFields = array(
										"RESULT_ID"			=> $RESULT_ID,
										"FORM_ID"			=> $WEB_FORM_ID,
										"FIELD_ID"			=> $FIELD_ID,
										"USER_TEXT"			=> $VALUE,
										"USER_TEXT_SEARCH"	=> ToUpper($VALUE)
										);
									CFormResult::AddAnswer($arFields);
								break;

								case "date":

									if (CheckDateTime($VALUE))
									{
										$arFields = array(
											"RESULT_ID"			=> $RESULT_ID,
											"FORM_ID"			=> $WEB_FORM_ID,
											"FIELD_ID"			=> $FIELD_ID,
											"USER_DATE"			=> $VALUE,
											"USER_TEXT"			=> $VALUE,
											"USER_TEXT_SEARCH"	=> ToUpper($VALUE)
											);
										CFormResult::AddAnswer($arFields);
									}
								break;

							endswitch;
						}
					}
					else
					{
						$strSql = "
							SELECT
								USER_FILE_ID
							FROM
								b_form_result_answer
							WHERE
								RESULT_ID = $RESULT_ID
							and FIELD_ID = $FIELD_ID
							and USER_FILE_ID>0
							";
						$rsFiles = $DB->Query($strSql, false, $err_mess.__LINE__);
						while ($arFile = $rsFiles->Fetch()) CFile::Delete($arFile["USER_FILE_ID"]);

						$strSql = "
							DELETE FROM
								b_form_result_answer
							WHERE
								RESULT_ID = $RESULT_ID
							and FIELD_ID = $FIELD_ID
							";
						$DB->Query($strSql, false, $err_mess.__LINE__);

						if (is_array($VALUE) && count($VALUE)>0)
						{
							$arrANSWER_TEXT = array();
							$arrANSWER_VALUE = array();
							$arrUSER_TEXT = array();
							foreach ($VALUE as $ANSWER_ID => $val)
							{
								$rsAnswer = CFormAnswer::GetByID($ANSWER_ID);
								if ($arAnswer = $rsAnswer->Fetch())
								{
									switch ($arAnswer["FIELD_TYPE"]) :

										case "radio":
										case "dropdown":
										case "checkbox":
										case "multiselect":

											$arFields = array(
												"RESULT_ID"				=> $RESULT_ID,
												"FORM_ID"				=> $WEB_FORM_ID,
												"FIELD_ID"				=> $FIELD_ID,
												"ANSWER_ID"				=> $ANSWER_ID,
												"ANSWER_TEXT"			=> trim($arAnswer["MESSAGE"]),
												"ANSWER_VALUE"			=> $arAnswer["VALUE"],
											);
											CFormResult::AddAnswer($arFields);
											$arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
											$arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);

										break;

										case "text":
										case "textarea":
										case "password":
										case "email":
										case "url":
										case "hidden":

											$arFields = array(
												"RESULT_ID"				=> $RESULT_ID,
												"FORM_ID"				=> $WEB_FORM_ID,
												"FIELD_ID"				=> $FIELD_ID,
												"ANSWER_ID"				=> $ANSWER_ID,
												"ANSWER_TEXT"			=> trim($arAnswer["MESSAGE"]),
												"ANSWER_VALUE"			=> $arAnswer["VALUE"],
												"USER_TEXT"				=> $val,
											);
											CFormResult::AddAnswer($arFields);
											$arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
											$arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
											$arrUSER_TEXT[$FIELD_ID][] = ToUpper($arFields["USER_TEXT"]);

										break;

										case "date":

											if (CheckDateTime($val))
											{
												$arFields = array(
													"RESULT_ID"				=> $RESULT_ID,
													"FORM_ID"				=> $WEB_FORM_ID,
													"FIELD_ID"				=> $FIELD_ID,
													"ANSWER_ID"				=> $ANSWER_ID,
													"ANSWER_TEXT"			=> trim($arAnswer["MESSAGE"]),
													"ANSWER_VALUE"			=> $arAnswer["VALUE"],
													"USER_TEXT"				=> $val,
													"USER_DATE"				=> $val
												);
												CFormResult::AddAnswer($arFields);
												$arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
												$arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
												$arrUSER_TEXT[$FIELD_ID][] = ToUpper($arFields["USER_TEXT"]);
											}

										break;

										case "image":

											$arIMAGE = $val;
											if (is_array($arIMAGE) && count($arIMAGE)>0)
											{
												$arIMAGE["MODULE_ID"] = "form";
												if (strlen(CFile::CheckImageFile($arIMAGE))<=0)
												{
													if (!array_key_exists("MODULE_ID", $arIMAGE) || strlen($arIMAGE["MODULE_ID"]) <= 0)
														$arIMAGE["MODULE_ID"] = "form";

													$fid = CFile::SaveFile($arIMAGE, "form");
													if (intval($fid)>0)
													{
														$arFields = array(
															"RESULT_ID"				=> $RESULT_ID,
															"FORM_ID"				=> $WEB_FORM_ID,
															"FIELD_ID"				=> $FIELD_ID,
															"ANSWER_ID"				=> $ANSWER_ID,
															"ANSWER_TEXT"			=> trim($arAnswer["MESSAGE"]),
															"ANSWER_VALUE"			=> $arAnswer["VALUE"],
															"USER_FILE_ID"			=> $fid,
															"USER_FILE_IS_IMAGE"	=> "Y",
															"USER_FILE_NAME"		=> $arIMAGE["name"],
															"USER_FILE_SIZE"		=> $arIMAGE["size"],
															"USER_TEXT"				=> $arIMAGE["name"]
															);
														CFormResult::AddAnswer($arFields);
														$arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
														$arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
														$arrUSER_TEXT[$FIELD_ID][] = ToUpper($arFields["USER_TEXT"]);
													}
												}
											}

										break;

										case "file":

											$arFILE = $val;
											if (is_array($arFILE) && count($arFILE)>0)
											{
												$arFILE["MODULE_ID"] = "form";
												$original_name = $arFILE["name"];
												$max_size = COption::GetOptionString("form", "MAX_FILESIZE");
												$upload_dir = COption::GetOptionString("form", "NOT_IMAGE_UPLOAD_DIR");
												$fid = CFile::SaveFile($arFILE, $upload_dir, $max_size);
												if (intval($fid)>0)
												{
													$arFields = array(
														"RESULT_ID"				=> $RESULT_ID,
														"FORM_ID"				=> $WEB_FORM_ID,
														"FIELD_ID"				=> $FIELD_ID,
														"ANSWER_ID"				=> $ANSWER_ID,
														"ANSWER_TEXT"			=> trim($arAnswer["MESSAGE"]),
														"ANSWER_VALUE"			=> $arAnswer["VALUE"],
														"USER_FILE_ID"			=> $fid,
														"USER_FILE_IS_IMAGE"	=> "N",
														"USER_FILE_NAME"		=> $original_name,
														"USER_FILE_HASH"		=> md5(uniqid(mt_rand(), true).time()),
														"USER_FILE_SIZE"		=> $arFILE["size"],
														"USER_FILE_SUFFIX"		=> $suffix,
														"USER_TEXT"				=> $original_name,
														);
													CFormResult::AddAnswer($arFields);
													$arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
													$arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
													$arrUSER_TEXT[$FIELD_ID][] = ToUpper($arFields["USER_TEXT"]);
												}
											}

										break;

									endswitch;
								}
							}
							// update search fields
							$arrANSWER_TEXT_upd = $arrANSWER_TEXT[$FIELD_ID];
							$arrANSWER_VALUE_upd = $arrANSWER_VALUE[$FIELD_ID];
							$arrUSER_TEXT_upd = $arrUSER_TEXT[$FIELD_ID];
							TrimArr($arrANSWER_TEXT_upd);
							TrimArr($arrANSWER_VALUE_upd);
							TrimArr($arrUSER_TEXT_upd);
							if (is_array($arrANSWER_TEXT_upd)) $vl_ANSWER_TEXT = trim(implode(" ",$arrANSWER_TEXT_upd));
							if (is_array($arrANSWER_VALUE_upd)) $vl_ANSWER_VALUE = trim(implode(" ",$arrANSWER_VALUE_upd));
							if (is_array($arrUSER_TEXT_upd)) $vl_USER_TEXT = trim(implode(" ",$arrUSER_TEXT_upd));
							if (strlen($vl_ANSWER_TEXT)<=0) $vl_ANSWER_TEXT = false;
							if (strlen($vl_ANSWER_VALUE)<=0) $vl_ANSWER_VALUE = false;
							if (strlen($vl_USER_TEXT)<=0) $vl_USER_TEXT = false;
							$arFields = array(
								"ANSWER_TEXT_SEARCH"	=> $vl_ANSWER_TEXT,
								"ANSWER_VALUE_SEARCH"	=> $vl_ANSWER_VALUE,
								"USER_TEXT_SEARCH"		=> $vl_USER_TEXT
								);
							CFormResult::UpdateField($arFields, $RESULT_ID, $FIELD_ID);
						}
					}
					return true;
				}
			}
		}
		return false;
	}
Exemple #8
0
 function SetField($RESULT_ID, $FIELD_SID, $VALUE = false)
 {
     global $DB, $strError;
     $err_mess = CAllFormResult::err_mess() . "<br>Function: SetField<br>Line: ";
     $RESULT_ID = intval($RESULT_ID);
     if (intval($RESULT_ID) > 0) {
         // получим ID веб-формы
         $strSql = "\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tFORM_ID\r\n\t\t\t\tFROM\r\n\t\t\t\t\tb_form_result\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tID = {$RESULT_ID}\r\n\t\t\t\t";
         $z = $DB->Query($strSql, false, $err_mess . __LINE__);
         $zr = $z->Fetch();
         $WEB_FORM_ID = $zr["FORM_ID"];
         if (intval($WEB_FORM_ID) > 0) {
             // получим данные по вопросу/полю
             $strSql = "\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tID,\r\n\t\t\t\t\t\tFIELD_TYPE,\r\n\t\t\t\t\t\tADDITIONAL\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\tb_form_field\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tFORM_ID = {$WEB_FORM_ID}\r\n\t\t\t\t\tand SID = '" . $DB->ForSql($FIELD_SID, 50) . "'\r\n\t\t\t\t\t";
             $q = $DB->Query($strSql, false, $err_mess . __LINE__);
             if ($arField = $q->Fetch()) {
                 $FIELD_ID = $arField["ID"];
                 $IS_FIELD = $arField["ADDITIONAL"] == "Y" ? true : false;
                 // если это поле веб-формы то
                 if ($IS_FIELD) {
                     // удаляем значения по данному полю у данного результата
                     $strSql = "\r\n\t\t\t\t\t\t\tDELETE FROM\r\n\t\t\t\t\t\t\t\tb_form_result_answer\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tRESULT_ID = {$RESULT_ID}\r\n\t\t\t\t\t\t\tand FIELD_ID = {$FIELD_ID}\r\n\t\t\t\t\t\t\t";
                     //echo "<pre>".$strSql."</pre>";
                     $DB->Query($strSql, false, $err_mess . __LINE__);
                     if (strlen($VALUE) > 0) {
                         $FIELD_TYPE = $arField["FIELD_TYPE"];
                         switch ($FIELD_TYPE) {
                             case "text":
                             case "integer":
                                 $arFields = array("RESULT_ID" => $RESULT_ID, "FORM_ID" => $WEB_FORM_ID, "FIELD_ID" => $FIELD_ID, "USER_TEXT" => $VALUE, "USER_TEXT_SEARCH" => ToUpper($VALUE));
                                 CFormResult::AddAnswer($arFields);
                                 break;
                             case "date":
                                 if (CheckDateTime($VALUE)) {
                                     $arFields = array("RESULT_ID" => $RESULT_ID, "FORM_ID" => $WEB_FORM_ID, "FIELD_ID" => $FIELD_ID, "USER_DATE" => $VALUE, "USER_TEXT" => $VALUE, "USER_TEXT_SEARCH" => ToUpper($VALUE));
                                     CFormResult::AddAnswer($arFields);
                                 }
                                 break;
                         }
                     }
                 } else {
                     // выберем все файлы
                     $strSql = "\r\n\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\tUSER_FILE_ID\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\tb_form_result_answer\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tRESULT_ID = {$RESULT_ID}\r\n\t\t\t\t\t\t\tand FIELD_ID = {$FIELD_ID}\r\n\t\t\t\t\t\t\tand USER_FILE_ID>0\r\n\t\t\t\t\t\t\t";
                     $rsFiles = $DB->Query($strSql, false, $err_mess . __LINE__);
                     while ($arFile = $rsFiles->Fetch()) {
                         CFile::Delete($arFile["USER_FILE_ID"]);
                     }
                     // удалим все значения ответов по данному вопросу у данного результата
                     $strSql = "\r\n\t\t\t\t\t\t\tDELETE FROM\r\n\t\t\t\t\t\t\t\tb_form_result_answer\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tRESULT_ID = {$RESULT_ID}\r\n\t\t\t\t\t\t\tand FIELD_ID = {$FIELD_ID}\r\n\t\t\t\t\t\t\t";
                     $DB->Query($strSql, false, $err_mess . __LINE__);
                     if (is_array($VALUE) && count($VALUE) > 0) {
                         $arrANSWER_TEXT = array();
                         $arrANSWER_VALUE = array();
                         $arrUSER_TEXT = array();
                         while (list($ANSWER_ID, $value) = each($VALUE)) {
                             $rsAnswer = CFormAnswer::GetByID($ANSWER_ID);
                             if ($arAnswer = $rsAnswer->Fetch()) {
                                 switch ($arAnswer["FIELD_TYPE"]) {
                                     case "radio":
                                     case "dropdown":
                                     case "checkbox":
                                     case "multiselect":
                                         $arFields = array("RESULT_ID" => $RESULT_ID, "FORM_ID" => $WEB_FORM_ID, "FIELD_ID" => $FIELD_ID, "ANSWER_ID" => $ANSWER_ID, "ANSWER_TEXT" => trim($arAnswer["MESSAGE"]), "ANSWER_VALUE" => $arAnswer["VALUE"]);
                                         CFormResult::AddAnswer($arFields);
                                         $arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
                                         $arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
                                         break;
                                     case "text":
                                     case "textarea":
                                     case "password":
                                     case "email":
                                     case "url":
                                         $arFields = array("RESULT_ID" => $RESULT_ID, "FORM_ID" => $WEB_FORM_ID, "FIELD_ID" => $FIELD_ID, "ANSWER_ID" => $ANSWER_ID, "ANSWER_TEXT" => trim($arAnswer["MESSAGE"]), "ANSWER_VALUE" => $arAnswer["VALUE"], "USER_TEXT" => $value);
                                         CFormResult::AddAnswer($arFields);
                                         $arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
                                         $arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
                                         $arrUSER_TEXT[$FIELD_ID][] = ToUpper($arFields["USER_TEXT"]);
                                         break;
                                     case "date":
                                         if (CheckDateTime($value)) {
                                             $arFields = array("RESULT_ID" => $RESULT_ID, "FORM_ID" => $WEB_FORM_ID, "FIELD_ID" => $FIELD_ID, "ANSWER_ID" => $ANSWER_ID, "ANSWER_TEXT" => trim($arAnswer["MESSAGE"]), "ANSWER_VALUE" => $arAnswer["VALUE"], "USER_TEXT" => $value, "USER_DATE" => $value);
                                             CFormResult::AddAnswer($arFields);
                                             $arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
                                             $arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
                                             $arrUSER_TEXT[$FIELD_ID][] = ToUpper($arFields["USER_TEXT"]);
                                         }
                                         break;
                                     case "image":
                                         $arIMAGE = $value;
                                         if (is_array($arIMAGE) && count($arIMAGE) > 0) {
                                             $arIMAGE["MODULE_ID"] = "form";
                                             if (strlen(CFile::CheckImageFile($arIMAGE)) <= 0) {
                                                 $fid = CFile::SaveFile($arIMAGE, "form");
                                                 if (intval($fid) > 0) {
                                                     $arFields = array("RESULT_ID" => $RESULT_ID, "FORM_ID" => $WEB_FORM_ID, "FIELD_ID" => $FIELD_ID, "ANSWER_ID" => $ANSWER_ID, "ANSWER_TEXT" => trim($arAnswer["MESSAGE"]), "ANSWER_VALUE" => $arAnswer["VALUE"], "USER_FILE_ID" => $fid, "USER_FILE_IS_IMAGE" => "Y", "USER_FILE_NAME" => $arIMAGE["name"], "USER_FILE_SIZE" => $arIMAGE["size"], "USER_TEXT" => $arIMAGE["name"]);
                                                     CFormResult::AddAnswer($arFields);
                                                     $arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
                                                     $arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
                                                     $arrUSER_TEXT[$FIELD_ID][] = ToUpper($arFields["USER_TEXT"]);
                                                 }
                                             }
                                         }
                                         break;
                                     case "file":
                                         $arFILE = $value;
                                         if (is_array($arFILE) && count($arFILE) > 0) {
                                             $arFILE["MODULE_ID"] = "form";
                                             $original_name = $arFILE["name"];
                                             $max_size = COption::GetOptionString("form", "MAX_FILESIZE");
                                             $suffix = COption::GetOptionString("form", "NOT_IMAGE_EXTENSION_SUFFIX");
                                             $arFILE["name"] .= $suffix;
                                             $upload_dir = COption::GetOptionString("form", "NOT_IMAGE_UPLOAD_DIR");
                                             $fid = CFile::SaveFile($arFILE, $upload_dir, $max_size);
                                             if (intval($fid) > 0) {
                                                 $arFields = array("RESULT_ID" => $RESULT_ID, "FORM_ID" => $WEB_FORM_ID, "FIELD_ID" => $FIELD_ID, "ANSWER_ID" => $ANSWER_ID, "ANSWER_TEXT" => trim($arAnswer["MESSAGE"]), "ANSWER_VALUE" => $arAnswer["VALUE"], "USER_FILE_ID" => $fid, "USER_FILE_IS_IMAGE" => "N", "USER_FILE_NAME" => $original_name, "USER_FILE_HASH" => md5(uniqid(mt_rand(), true) . time()), "USER_FILE_SIZE" => $arFILE["size"], "USER_FILE_SUFFIX" => $suffix, "USER_TEXT" => $original_name);
                                                 CFormResult::AddAnswer($arFields);
                                                 $arrANSWER_TEXT[$FIELD_ID][] = ToUpper($arFields["ANSWER_TEXT"]);
                                                 $arrANSWER_VALUE[$FIELD_ID][] = ToUpper($arFields["ANSWER_VALUE"]);
                                                 $arrUSER_TEXT[$FIELD_ID][] = ToUpper($arFields["USER_TEXT"]);
                                             }
                                         }
                                         break;
                                 }
                             }
                         }
                         // обновляем поля для поиска
                         $arrANSWER_TEXT_upd = $arrANSWER_TEXT[$FIELD_ID];
                         $arrANSWER_VALUE_upd = $arrANSWER_VALUE[$FIELD_ID];
                         $arrUSER_TEXT_upd = $arrUSER_TEXT[$FIELD_ID];
                         TrimArr($arrANSWER_TEXT_upd);
                         TrimArr($arrANSWER_VALUE_upd);
                         TrimArr($arrUSER_TEXT_upd);
                         if (is_array($arrANSWER_TEXT_upd)) {
                             $vl_ANSWER_TEXT = trim(implode(" ", $arrANSWER_TEXT_upd));
                         }
                         if (is_array($arrANSWER_VALUE_upd)) {
                             $vl_ANSWER_VALUE = trim(implode(" ", $arrANSWER_VALUE_upd));
                         }
                         if (is_array($arrUSER_TEXT_upd)) {
                             $vl_USER_TEXT = trim(implode(" ", $arrUSER_TEXT_upd));
                         }
                         if (strlen($vl_ANSWER_TEXT) <= 0) {
                             $vl_ANSWER_TEXT = false;
                         }
                         if (strlen($vl_ANSWER_VALUE) <= 0) {
                             $vl_ANSWER_VALUE = false;
                         }
                         if (strlen($vl_USER_TEXT) <= 0) {
                             $vl_USER_TEXT = false;
                         }
                         $arFields = array("ANSWER_TEXT_SEARCH" => $vl_ANSWER_TEXT, "ANSWER_VALUE_SEARCH" => $vl_ANSWER_VALUE, "USER_TEXT_SEARCH" => $vl_USER_TEXT);
                         CFormResult::UpdateField($arFields, $RESULT_ID, $FIELD_ID);
                     }
                 }
                 return true;
             }
         }
     }
     return false;
 }
Exemple #9
0
     $statDB->Query("DELETE FROM b_stat_adv_page WHERE ADV_ID = " . $ID, false, $err_mess . __LINE__);
     $arPAGES_TO = preg_split("/[\n\r]+/", $PAGES_TO);
     if (is_array($arPAGES_TO)) {
         $arPAGES_TO = array_unique($arPAGES_TO);
         TrimArr($arPAGES_TO);
         if (count($arPAGES_TO) > 0) {
             foreach ($arPAGES_TO as $page_to) {
                 $arFields = array("ADV_ID" => $ID, "PAGE" => "'" . $statDB->ForSql($page_to, 2000) . "'", "C_TYPE" => "'TO'");
                 $statDB->Insert("b_stat_adv_page", $arFields, $err_mess . __LINE__);
             }
         }
     }
     $arPAGES_FROM = preg_split("/[\n\r]+/", $PAGES_FROM);
     if (is_array($arPAGES_FROM)) {
         $arPAGES_FROM = array_unique($arPAGES_FROM);
         TrimArr($arPAGES_FROM);
         if (count($arPAGES_FROM) > 0) {
             foreach ($arPAGES_FROM as $page_from) {
                 $arFields = array("ADV_ID" => $ID, "PAGE" => "'" . $statDB->ForSql($page_from, 2000) . "'", "C_TYPE" => "'FROM'");
                 $statDB->Insert("b_stat_adv_page", $arFields, $err_mess . __LINE__);
             }
         }
     }
     if (strlen($strError) <= 0) {
         if (strlen($save) > 0) {
             LocalRedirect("adv_list.php?lang=" . LANG);
         } else {
             LocalRedirect($APPLICATION->GetCurPage() . "?lang=" . LANG . "&ID=" . $ID . "&" . $tabControl->ActiveTabParam());
         }
     }
 }
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!$USER->IsAuthorized()) {
    $APPLICATION->AuthForm(GetMessage('FRLM_NEED_AUTH'));
    return false;
}
if (!CModule::IncludeModule('form')) {
    ShowError('FRLM_MODULE_NOT_INSTALLED');
    return false;
}
if (!is_array($arParams['FORMS'])) {
    $arParams['FORMS'] = array();
} else {
    TrimArr($arParams['FORMS']);
}
$arResult['FORMS'] = array();
$arResult['RESULTS'] = array();
if (count($arParams['FORMS']) <= 0) {
    $dbRes = CForm::GetList($by = 'sort', $order = 'asc', array('SITE' => SITE_ID), $is_filtered);
    while ($arRes = $dbRes->GetNext()) {
        $arParams['FORMS'][] = $arRes['ID'];
        $arResult['FORMS'][$arRes['ID']] = $arRes;
    }
}
foreach ($arParams['FORMS'] as $FORM_ID) {
    if (is_array($arResult['FORMS'][$FORM_ID])) {
        $arForm = $arResult['FORMS'][$FORM_ID];
    } else {
        $dbRes = CForm::GetByID($FORM_ID);
Exemple #11
0
     $arParams["arrNOT_SHOW_FILTER"] = explode(",", $arParams["NOT_SHOW_FILTER"]);
 }
 if (is_array($arParams["arrNOT_SHOW_FILTER"])) {
     //array_walk($arParams["arrNOT_SHOW_FILTER"], create_function("&\$item", "\$item=trim(\$item);"));
     TrimArr($arParams["arrNOT_SHOW_FILTER"]);
 } else {
     $arParams["arrNOT_SHOW_FILTER"] = array();
 }
 if (is_array($arParams["NOT_SHOW_TABLE"])) {
     $arParams["arrNOT_SHOW_TABLE"] = $arParams["NOT_SHOW_TABLE"];
 } else {
     $arParams["arrNOT_SHOW_TABLE"] = explode(",", $arParams["NOT_SHOW_TABLE"]);
 }
 if (is_array($arParams["arrNOT_SHOW_TABLE"])) {
     //array_walk($arParams["arrNOT_SHOW_TABLE"], create_function("&\$item", "\$item=trim(\$item);"));
     TrimArr($arParams["arrNOT_SHOW_TABLE"]);
 } else {
     $arParams["arrNOT_SHOW_TABLE"] = array();
 }
 // deleting single form result
 $del_id = intval($_REQUEST["del_id"]);
 if ($del_id > 0) {
     $GLOBALS['strError'] = '';
     CFormResult::Delete($del_id);
     if (strlen($GLOBALS['strError']) <= 0) {
         LocalRedirect($APPLICATION->GetCurPageParam("", array("del_id", "sessid", 'formresult'), false));
         exit;
     }
 }
 // deleting multiple form results
 if ($_REQUEST["delete"] && check_bitrix_sessid()) {
Exemple #12
0
 public static function SupportDeadlineNotify($arrTicket0)
 {
     //SUPPORT_DEADLINE_NOTIFY
     //SUPPORT_DEADLINE			= EXPIRATION_DATE
     //SUPPORT_DEADLINE_STMP		= EXPIRATION_DATE_STMP
     $err_mess = CAllTicketReminder::err_mess() . "<br>Function: SupportDeadlineNotify<br>Line: ";
     $rs = CTicket::GetByID($arrTicket0["ID"], false, "N");
     if (!($arTicket = $rs->Fetch())) {
         return false;
     }
     $rsMessage = CTicket::GetMessageByID(intval($arTicket["ID_1_USER_M_AFTER_SUP_M"]), "N", "N");
     if (!($arMessage = $rsMessage->Fetch())) {
         return false;
     }
     $arMessage["EXPIRATION_DATE"] = $arrTicket0["SUPPORT_DEADLINE"];
     $arMessage["EXPIRATION_DATE_STMP"] = MakeTimeStamp($arMessage["EXPIRATION_DATE"]);
     //$SUPPORT_DEADLINE_STMP = MakeTimeStamp($arrTicket0["SUPPORT_DEADLINE"]);
     $rsSite = CSite::GetByID($arTicket["SITE_ID"]);
     $arSite = $rsSite->Fetch();
     global $MESS, $DB;
     //$oldMess = $MESS;
     IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/classes/general/messages.php", $arSite["LANGUAGE_ID"]);
     $sourceName = strlen($arTicket["SOURCE_NAME"]) <= 0 ? "" : "[" . $arTicket["SOURCE_NAME"] . "] ";
     if (intval($arTicket["OWNER_USER_ID"]) > 0 || strlen(trim($arTicket["OWNER_LOGIN"])) > 0) {
         $ownerText = "[" . $arTicket["OWNER_USER_ID"] . "] (" . $arTicket["OWNER_LOGIN"] . ") " . $arTicket["OWNER_NAME"];
         //if(strlen(trim($OWNER_SID)) > 0 && $OWNER_SID != "null") $ownerText = " / " . $ownerText;
     }
     if (intval($arTicket["RESPONSIBLE_USER_ID"]) > 0) {
         $responsibleText = "[" . $arTicket["RESPONSIBLE_USER_ID"] . "] (" . $arTicket["RESPONSIBLE_LOGIN"] . ") " . $arTicket["RESPONSIBLE_NAME"];
         if (CTicket::IsSupportTeam($arTicket["RESPONSIBLE_USER_ID"]) || CTicket::IsAdmin($arTicket["RESPONSIBLE_USER_ID"])) {
             $responsibleText .= " " . GetMessage("SUP_TECHSUPPORT_HINT");
         }
     }
     $arAdminEMails = CTicket::GetAdminEmails();
     if (count($arAdminEMails) > 0) {
         $support_admin_email = implode(",", $arAdminEMails);
     }
     // prepare email to author
     $arrOwnerEMail = array($arTicket["OWNER_EMAIL"]);
     $arrEmails = explode(",", $arTicket["OWNER_SID"]);
     if (is_array($arrEmails) && count($arrEmails) > 0) {
         foreach ($arrEmails as $email) {
             $email = trim($email);
             if (strlen($email) > 0) {
                 preg_match_all("#[<\\[\\(](.*?)[>\\]\\)]#i" . BX_UTF_PCRE_MODIFIER, $email, $arr);
                 if (is_array($arr[1]) && count($arr[1]) > 0) {
                     foreach ($arr[1] as $email) {
                         $email = trim($email);
                         if (strlen($email) > 0 && !in_array($email, $arrOwnerEMail) && check_email($email)) {
                             $arrOwnerEMail[] = $email;
                         }
                     }
                 } elseif (!in_array($email, $arrOwnerEMail) && check_email($email)) {
                     $arrOwnerEMail[] = $email;
                 }
             }
         }
     }
     TrimArr($arrOwnerEMail);
     $ownerEmail = implode(", ", $arrOwnerEMail);
     // prepare email to support
     $support_email = $arTicket["RESPONSIBLE_EMAIL"];
     if (strlen($support_email) <= 0) {
         $support_email = $support_admin_email;
     }
     if (strlen($support_email) <= 0) {
         $support_email = COption::GetOptionString("main", "email_from", "");
     }
     $arr = explode(",", $support_email);
     $arr = array_unique($arr);
     $support_email = implode(",", $arr);
     if (is_array($arr) && count($arr) > 0) {
         foreach ($arr as $email) {
             unset($arAdminEMails[$email]);
         }
     }
     $support_admin_email = implode(",", $arAdminEMails);
     $createdModuleName = "";
     if ($arTicket["CREATED_MODULE_NAME"] == "support" || !strlen($arTicket["CREATED_MODULE_NAME"])) {
         if (intval($arTicket["CREATED_USER_ID"]) > 0) {
             $createdText = "[" . $arTicket["CREATED_USER_ID"] . "] (" . $arTicket["CREATED_LOGIN"] . ") " . $arTicket["CREATED_NAME"];
             if (CTicket::IsSupportTeam($arTicket["CREATED_USER_ID"]) || CTicket::IsAdmin($arTicket["CREATED_USER_ID"])) {
                 $createdText .= " " . GetMessage("SUP_TECHSUPPORT_HINT");
             }
         }
     } else {
         $createdModuleName = "[" . $arTicket["CREATED_MODULE_NAME"] . "]";
     }
     $MESSAGE = PrepareTxtForEmail($arMessage["MESSAGE"], $arSite["LANGUAGE_ID"], false, false);
     $remainedTime = $arMessage["EXPIRATION_DATE_STMP"] - time();
     if ($remainedTime > 0) {
         $strRemainedTime = "";
         $hours = intval($remainedTime / 3600);
         if ($hours > 0) {
             $strRemainedTime .= $hours . " " . GetMessage("SUP_HOUR") . " ";
             $remainedTime = $remainedTime - $hours * 3600;
         }
         $strRemainedTime .= intval($remainedTime / 60) . " " . GetMessage("SUP_MIN") . " ";
         $strRemainedTime .= $remainedTime % 60 . " " . GetMessage("SUP_SEC");
     }
     $arFields_notify = array("ID" => $arTicket["ID"], "LANGUAGE_ID" => $arSite["LANGUAGE_ID"], "DATE_CREATE" => $arTicket["DATE_CREATE"], "TITLE" => $arTicket["TITLE"], "STATUS" => $arTicket["STATUS_NAME"], "CATEGORY" => $arTicket["CATEGORY_NAME"], "CRITICALITY" => $arTicket["CRITICALITY_NAME"], "DIFFICULTY" => $arTicket["DIFFICULTY_NAME"], "RATE" => $arTicket["MARK_NAME"], "SLA" => $arTicket["SLA_NAME"], "SOURCE" => $sourceName, "ADMIN_EDIT_URL" => "/bitrix/admin/ticket_edit.php", "EXPIRATION_DATE" => $arMessage["EXPIRATION_DATE"], "REMAINED_TIME" => $strRemainedTime, "OWNER_EMAIL" => TrimEx($ownerEmail, ","), "OWNER_USER_ID" => $arTicket["OWNER_USER_ID"], "OWNER_USER_NAME" => $arTicket["OWNER_NAME"], "OWNER_USER_LOGIN" => $arTicket["OWNER_LOGIN"], "OWNER_USER_EMAIL" => $arTicket["OWNER_EMAIL"], "OWNER_TEXT" => $ownerText, "OWNER_SID" => $arTicket["OWNER_SID"], "SUPPORT_EMAIL" => TrimEx($support_email, ","), "RESPONSIBLE_USER_ID" => $arTicket["RESPONSIBLE_USER_ID"], "RESPONSIBLE_USER_NAME" => $arTicket["RESPONSIBLE_NAME"], "RESPONSIBLE_USER_LOGIN" => $arTicket["RESPONSIBLE_LOGIN"], "RESPONSIBLE_USER_EMAIL" => $arTicket["RESPONSIBLE_EMAIL"], "RESPONSIBLE_TEXT" => $responsibleText, "SUPPORT_ADMIN_EMAIL" => TrimEx($support_admin_email, ","), "CREATED_USER_ID" => $arTicket["CREATED_USER_ID"], "CREATED_USER_LOGIN" => $arTicket["CREATED_LOGIN"], "CREATED_USER_EMAIL" => $arTicket["CREATED_EMAIL"], "CREATED_USER_NAME" => $arTicket["CREATED_NAME"], "CREATED_MODULE_NAME" => $createdModuleName, "CREATED_TEXT" => $createdText, "MESSAGE_BODY" => $MESSAGE);
     //$MESS = $oldMess;
     $arFields = array("NOTIFY_AGENT_ID" => "null", "IS_NOTIFIED" => "'Y'");
     // execute event
     $rs = GetModuleEvents('support', 'OnBeforeTicketNotify');
     while ($arr = $rs->Fetch()) {
         $arFields = ExecuteModuleEventEx($arr, array($arTicket["ID"], $arFields));
         if (!$arFields) {
             return false;
         }
     }
     // check value again and send notification
     if (isset($arFields['IS_NOTIFIED']) && $arFields['IS_NOTIFIED'] === "'Y'") {
         CEvent::Send("TICKET_OVERDUE_REMINDER", $arTicket["SITE_ID"], $arFields_notify);
     }
     // event for notification
     $DB->Update("b_ticket", $arFields, "WHERE ID='" . $arTicket["ID"] . "'", $err_mess . __LINE__);
     $arFields = array("NOTIFY_AGENT_DONE" => "'Y'");
     $DB->Update("b_ticket_message", $arFields, "WHERE ID='" . $arMessage["ID"] . "'", $err_mess . __LINE__);
 }
}
$arParams['IS_AJAX'] = !empty($_REQUEST['ajaxid']) && $_REQUEST['ajaxid'] == $arParams['FORM_CODE'];
$arParams['IBLOCK_ID'] = intval($arParams['IBLOCK_ID']);
$arParams['USE_IBLOCK'] = $arParams['USE_IBLOCK'] == 'Y' && $arParams['IBLOCK_ID'] > 0;
$arParams['PARENT_SECTION_ID'] = intval($arParams['PARENT_SECTION_ID']);
$arParams['AJAX_OPEN_FORM'] = $arParams['AJAX_OPEN_FORM'] == 'Y';
$arParams['ENABLE_FAKE_FORM'] = $arParams['ENABLE_FAKE_FORM'] == 'Y';
$arParams['EVENT_NAME'] = trim($arParams['EVENT_NAME']);
$arParams['SEND_NOTIFICATION'] = $arParams['SEND_NOTIFICATION'] == 'Y' && !empty($arParams['EVENT_NAME']);
if (is_array($arParams['SHOW_FOR_USER_GROUPS'])) {
    TrimArr($arParams['SHOW_FOR_USER_GROUPS']);
} else {
    $arParams['SHOW_FOR_USER_GROUPS'] = array();
}
if (is_array($arParams['ENABLE_FOR_USER_GROUPS'])) {
    TrimArr($arParams['ENABLE_FOR_USER_GROUPS']);
} else {
    $arParams['ENABLE_FOR_USER_GROUPS'] = array();
}
$arParams['NOT_ENABLE_NOTE'] = trim($arParams['NOT_ENABLE_NOTE']);
$arParams['CACHE_TIME'] = intval($arParams['CACHE_TIME']);
/**
 *	проверка прав доступа к форме
 */
$arUserGroups = $USER->GetUserGroupArray();
$arParams['USER_CAN_POST'] = true;
if (!empty($arParams['SHOW_FOR_USER_GROUPS']) && !count(array_intersect($arParams['SHOW_FOR_USER_GROUPS'], $arUserGroups)) && !$USER->IsAdmin()) {
    $arParams['USER_CAN_POST'] = false;
}
/**
 * инициализация шаблона компонента
Exemple #14
0
 if ($IS_LANG_DIR) {
     foreach ($arTLangs as $hlang) {
         $ph = add_lang_id($path, $hlang, $arTLangs);
         if (strlen($ph) > 0) {
             GetTDirList($ph, $GET_SUBFOLRERS);
         }
         $ph = "";
     }
 } else {
     GetTDirList($path, $GET_SUBFOLRERS);
 }
 $arrChain = array();
 $arr = explode("/", $go_path);
 if (is_array($arr)) {
     $arrP = array();
     TrimArr($arr);
     foreach ($arr as $d) {
         $arrP[] = $d;
         $p = prepare_path("/" . implode("/", $arrP) . "/");
         if (remove_lang_id($path, $arTLangs) == $p) {
             $p = "";
         }
         $arrChain[] = array("NAME" => $d, "PATH" => $p);
     }
 }
 $show_error = COption::GetOptionString("translate", "ONLY_ERRORS");
 $show_error = $show_error == "Y" ? "Y" : "";
 GetLangDirs($arDirs, $SHOW_LANG_DIFF);
 $arLangDirFiles = array_merge($arLangDirs, $arFiles);
 // find
 if ($arSearchParam) {
Exemple #15
0
if (strlen($arParams["PATH_TO_USER"]) <= 0) {
    $arParams["PATH_TO_USER"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=user&" . $arParams["USER_VAR"] . "=#user_id#");
}
if (strlen($arParams["PATH_TO_USER_EDIT"]) <= 0) {
    $arParams["PATH_TO_USER_EDIT"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=user&" . $arParams["USER_VAR"] . "=#user_id#&mode=edit");
}
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
$arParams['IS_FORUM'] = CModule::IncludeModule('forum') ? 'Y' : 'N';
$arParams['IS_BLOG'] = CModule::IncludeModule('blog') && !IsModuleInstalled("intranet") ? 'Y' : 'N';
TrimArr($arParams['USER_FIELDS_PERSONAL']);
TrimArr($arParams['USER_FIELDS_CONTACT']);
TrimArr($arParams['USER_FIELDS_MAIN']);
TrimArr($arParams['USER_PROPERTY_PERSONAL']);
TrimArr($arParams['USER_PROPERTY_CONTACT']);
TrimArr($arParams['USER_PROPERTY_MAIN']);
TrimArr($arParams['EDITABLE_FIELDS']);
if (!is_array($arParams['EDITABLE_FIELDS']) || count($arParams['EDITABLE_FIELDS']) <= 0) {
    $arParams['EDITABLE_FIELDS'] = array('LOGIN', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'EMAIL', 'TIME_ZONE', 'PERSONAL_BIRTHDAY', 'PERSONAL_CITY', 'PERSONAL_COUNTRY', 'PERSONAL_FAX', 'PERSONAL_GENDER', 'PERSONAL_ICQ', 'PERSONAL_MAILBOX', 'PERSONAL_MOBILE', 'PERSONAL_PAGER', 'PERSONAL_PHONE', 'PERSONAL_PHOTO', 'PERSONAL_STATE', 'PERSONAL_STREET', 'PERSONAL_WWW', 'PERSONAL_ZIP');
    if ($arParams['IS_FORUM'] == 'Y') {
        $arParams['EDITABLE_FIELDS'] = array_merge($arParams['EDITABLE_FIELDS'], array('FORUM_SHOW_NAME', 'FORUM_DESCRIPTION', 'FORUM_INTERESTS', 'FORUM_SIGNATURE', 'FORUM_AVATAR', 'FORUM_HIDE_FROM_ONLINE', 'FORUM_SUBSC_GROUP_MESSAGE', 'FORUM_SUBSC_GET_MY_MESSAGE'));
    }
    if ($arParams['IS_BLOG'] == 'Y') {
        $arParams['EDITABLE_FIELDS'] = array_merge($arParams['EDITABLE_FIELDS'], array('BLOG_ALIAS', 'BLOG_DESCRIPTION', 'BLOG_INTERESTS', 'BLOG_AVATAR', 'BLOG_SIGNATURE'));
    }
}
$arResult["arSocServ"] = array();
if (CModule::IncludeModule("socialservices")) {
    $oAuthManager = new CSocServAuthManager();
    $arResult["arSocServ"] = $oAuthManager->GetActiveAuthServices(array());
    if (!empty($arResult["arSocServ"])) {
        $arParams['EDITABLE_FIELDS'][] = 'SOCSERVICES';
Exemple #16
0
}
//200KB
$arParams["USE_ZIP"] = $arParams["USE_ZIP"] != "N";
$arParams["STRUCTURE_CHECK"] = $arParams["STRUCTURE_CHECK"] != "N";
if (!is_array($arParams['UPDATE_PROPERTIES'])) {
    $arParams['UPDATE_PROPERTIES'] = array('NAME', 'SECOND_NAME', 'LAST_NAME', 'PERSONAL_PROFESSION', 'PERSONAL_WWW', 'PERSONAL_BIRTHDAY', 'PERSONAL_ICQ', 'PERSONAL_GENDER', 'PERSONAL_PHOTO', 'PERSONAL_PHONE', 'PERSONAL_FAX', 'PERSONAL_MOBILE', 'PERSONAL_PAGER', 'PERSONAL_STREET', 'PERSONAL_CITY', 'PERSONAL_STATE', 'PERSONAL_ZIP', 'PERSONAL_COUNTRY', 'WORK_POSITION', 'WORK_PHONE');
    $arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
    if (!empty($arRes)) {
        foreach ($arRes as $key => $val) {
            if ($val["EDIT_FORM_LABEL"] != "UF_STATE_FIRST" && $val["EDIT_FORM_LABEL"] != "UF_STATE_LAST" && $val["EDIT_FORM_LABEL"] != "UF_1C") {
                $arParams['UPDATE_PROPERTIES'][] = $val["EDIT_FORM_LABEL"];
            }
        }
    }
}
TrimArr($arParams['UPDATE_PROPERTIES']);
$arParams['UPDATE_PROPERTIES'][] = 'UF_STATE_FIRST';
$arParams['UPDATE_PROPERTIES'][] = 'UF_STATE_LAST';
$arParams["UPDATE_LOGIN"] = in_array('LOGIN', $arParams['UPDATE_PROPERTIES']);
$arParams["UPDATE_PASSWORD"] = in_array('PASSWORD', $arParams['UPDATE_PROPERTIES']);
$arParams["UPDATE_EMAIL"] = in_array('EMAIL', $arParams['UPDATE_PROPERTIES']);
$arParams['EMAIL_NOTIFY'] = $arParams['EMAIL_NOTIFY'] == 'Y' ? 'Y' : ($arParams['EMAIL_NOTIFY'] == 'E' ? 'E' : 'N');
$arParams['EMAIL_NOTIFY_IMMEDIATELY'] = $arParams['EMAIL_NOTIFY_IMMEDIATELY'] == 'Y' ? 'Y' : 'N';
//if ($arParams["INTERVAL"] <= 0)
@set_time_limit(0);
$start_time = time();
if (function_exists("file_get_contents")) {
    $DATA = file_get_contents("php://input");
} elseif (isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
    $DATA =& $GLOBALS["HTTP_RAW_POST_DATA"];
} else {
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
CUtil::InitJSCore();
if (is_array($arParams['ALPHABET_LANG'])) {
    TrimArr($arParams['ALPHABET_LANG']);
}
if (!isset($arParams['ALPHABET_LANG']) || !is_array($arParams['ALPHABET_LANG']) || count($arParams['ALPHABET_LANG']) <= 0) {
    $arParams['ALPHABET_LANG'] = array(LANGUAGE_ID);
}
$arResult['ALPHABET'] = array();
foreach ($arParams['ALPHABET_LANG'] as $key => $language_id) {
    $file = dirname(__FILE__) . '/lang/' . $language_id . '/template.php';
    if (file_exists($file)) {
        if ($arMess = __IncludeLang($file, true)) {
        }
        $arResult['ALPHABET'][$language_id] = $arMess;
    }
}
Exemple #18
0
        $arInnerKeywords = explode(',', $arInnerKeywords);
    } else {
        $arInnerKeywords = array();
    }
    ?>
<tr id="bx_keywords_stats_loading_notify"><td align="center"><?php 
    echo BeginNote(), GetMessage('SEO_TOOLS_LOADING'), EndNote();
    ?>
</td></tr>
<tr id="bx_keywords_stats" style="display: none;">
	<td colspan="2">
<?php 
    foreach ($arInnerKeywords as $k => $v) {
        $arInnerKeywords[$k] = trim($v);
    }
    TrimArr($arInnerKeywords);
    ?>
		<div><input type="text" id="internal_keywords" rows="5" name="internal_keywords" style="width: 80%;" value="<?php 
    echo htmlspecialcharsEx(implode(', ', $arInnerKeywords));
    ?>
" /><button onclick="BXCallUpdateKeywordsStats(document.getElementById('internal_keywords').value); return false;" title="<?php 
    echo GetMessage('SEO_TOOLS_INTERNAL_KEYWORDS_RELOAD_TITLE');
    ?>
"><?php 
    echo GetMessage('SEO_TOOLS_INTERNAL_KEYWORDS_RELOAD');
    ?>
</button></div>
		<br />
		<table width="100%" class="bx-seo-words-table" id="bx_seo_words_table">
			<thead>
				<tr class="heading">