本文整理汇总了PHP中TrimArr函数的典型用法代码示例。如果您正苦于以下问题:PHP TrimArr函数的具体用法?PHP TrimArr怎么用?PHP TrimArr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TrimArr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPrepareComponentParams
/**
* @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);
}
示例2: GetRandom
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;
//.........这里部分代码省略.........
示例3: Set_sendMails
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"] = "MODIFIED_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)), ",") : "";
//.........这里部分代码省略.........
示例4: array
<?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));
}
}
示例5: array_keys
$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);
示例6: IncludeModuleLangFile
}
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();
示例7: SetField
//.........这里部分代码省略.........
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;
}
示例8: preg_split
$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());
}
}
}
示例9: ShowError
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);
示例10: explode
$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()) {
示例11: SupportDeadlineNotify
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");
}
//.........这里部分代码省略.........
示例12: intval
}
$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;
}
/**
* инициализация шаблона компонента
示例13: foreach
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) {
示例14: htmlspecialcharsbx
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';
示例15: array
}
//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 {