本文整理汇总了PHP中CharsetConverter::ConvertCharset方法的典型用法代码示例。如果您正苦于以下问题:PHP CharsetConverter::ConvertCharset方法的具体用法?PHP CharsetConverter::ConvertCharset怎么用?PHP CharsetConverter::ConvertCharset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CharsetConverter
的用法示例。
在下文中一共展示了CharsetConverter::ConvertCharset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public static function execute()
{
global $USER;
$result = array();
$error = false;
if (!CModule::IncludeModule('voximplant')) {
$error = 'Module voximplant is not installed.';
} else {
if (!is_object($USER) || !$USER->IsAuthorized()) {
$error = GetMessage('ACCESS_DENIED');
} else {
if (!CVoxImplantMain::CheckAccess()) {
$error = GetMessage('ACCESS_DENIED');
} else {
if (!check_bitrix_sessid()) {
$error = GetMessage('ACCESS_DENIED');
} else {
if ($_REQUEST["act"] == "edit") {
$result = self::executeEditPhones($error);
} else {
if ($_REQUEST["act"] == "getInfo") {
$result = self::executeGetInfo($error);
} else {
if ($_REQUEST["act"] == "option") {
$result = self::executeSaveOption($error);
}
}
}
}
}
}
}
self::returnJson(array_merge(array('result' => $error === false ? 'ok' : 'error', 'error' => CharsetConverter::ConvertCharset($error, SITE_CHARSET, 'UTF-8')), $result));
}
示例2: createDomain
public static function createDomain($user, $password, $domain, $params, &$error)
{
$domain = CharsetConverter::ConvertCharset($domain, SITE_CHARSET, 'UTF-8');
$result = CMailRegru::createDomain($user, $password, $domain, array('period' => 1, 'enduser_ip' => $params['ip'], 'profile_type' => $params['profile_type'], 'profile_name' => $params['profile_name'], 'nss' => array('ns0' => 'ns1.reg.ru.', 'ns1' => 'ns2.reg.ru.')), $error);
if ($result !== false) {
if (isset($result['dname']) && strtolower($result['dname']) == strtolower($domain)) {
return true;
} else {
$error = 'unknown';
}
}
$error = self::getErrorCode($result['error_code']);
return null;
}
示例3: strpos
if (!empty($errorMessageTmp)) {
$errorMessage .= $errorMessageTmp;
}
}
if (empty($errorMessage)) {
$isUTF = CUtil::DetectUTF8($responseBody);
if (!$isUTF && SITE_CHARSET == "UTF-8") {
$responseBody = CharsetConverter::ConvertCharset($responseBody, SITE_CHARSET, "CP1251");
}
if (strpos($responseBody, "bsid=") !== false) {
$p1 = strpos($responseBody, "bsid=");
$p2 = strpos($responseBody, ";", $p1);
$body["sessid"] = substr($responseBody, $p1 + 5, $p2 - $p1 - 5);
$body1 = http_build_query($body);
if (!defined("BX_UTF")) {
$body1 = CharsetConverter::ConvertCharset($body1, SITE_CHARSET, "UTF-8");
}
$head1 = "";
foreach ($arResponseHeaders as $h) {
$p1 = strpos($h, "PHPSESSID=");
if ($p1 !== false) {
$p2 = strpos($h, ";", $p1);
$head1 .= "Cookie: PHPSESSID=" . ($p2 !== false ? substr($h, $p1 + 10, $p2 - $p1 - 10) : substr($h, $p1 + 10)) . "\r\n";
break;
}
}
list($arResponseHeaders, $responseBody) = __CrmSaleQuery($crmUrlScheme, $crmUrlHost, $crmUrlPort, $crmLogin, $crmPassword, $head1, $body1, $errorMessageTmp);
if (!empty($errorMessageTmp)) {
$errorMessage .= $errorMessageTmp;
}
}
示例4: ParseOrderData
private function ParseOrderData($orderData, &$modificationLabel, &$arErrors)
{
if (empty($orderData)) {
$arErrors[] = array("PD1", GetMessage("CRM_EXT_SALE_IMPORT_EMPTY_ANSW"));
return null;
}
if (substr(ltrim($orderData), 0, strlen('<?xml')) != '<?xml') {
$orderDataTmp = @gzuncompress($orderData);
if (substr(ltrim($orderDataTmp), 0, strlen('<?xml')) != '<?xml') {
if (strpos($orderDataTmp, "You haven't rights for exchange") !== false) {
$arErrors[] = array("PD2", GetMessage("CRM_EXT_SALE_IMPORT_UNKNOWN_ANSW_PERMS"));
} elseif (strpos($orderDataTmp, "failure") !== false) {
$arErrors[] = array("PD2", GetMessage("CRM_EXT_SALE_IMPORT_UNKNOWN_ANSW_F"));
$arErrors[] = array("PD2", preg_replace("/\\s*failure\n/", "", $orderDataTmp));
} elseif (strpos($orderData, "Authorization") !== false || strpos($orderData, "Access denied") !== false) {
$arErrors[] = array("PD2", GetMessage("CRM_EXT_SALE_IMPORT_UNKNOWN_ANSW_PERMS1"));
} else {
$arErrors[] = array("PD2", GetMessage("CRM_EXT_SALE_IMPORT_UNKNOWN_ANSW") . substr($orderData, 0, 100));
}
return null;
}
$orderData = $orderDataTmp;
unset($orderDataTmp);
}
$charset = "";
if (preg_match("/^<" . "\\?xml[^>]+?encoding=[\"']([^>\"']+)[\"'][^>]*\\?" . ">/i", $orderData, $matches)) {
$charset = trim($matches[1]);
}
if (!empty($charset) && strtoupper($charset) != strtoupper(SITE_CHARSET)) {
$orderData = CharsetConverter::ConvertCharset($orderData, $charset, SITE_CHARSET);
}
$objXML = new CDataXML();
if ($objXML->LoadString($orderData)) {
$arOrderData = $objXML->GetArray();
} else {
$arErrors[] = array("XL1", GetMessage("CRM_EXT_SALE_IMPORT_ERROR_XML"));
return null;
}
$arSettings = array();
foreach ($arOrderData["CommerceInformation"]["@"] as $key => $value) {
$arSettings[$key] = array();
$ar1 = explode(";", $value);
foreach ($ar1 as $v1) {
$ar2 = explode("=", $v1);
if (count($ar2) == 2) {
$arSettings[$key][trim($ar2[0])] = $ar2[1];
}
}
if (count($arSettings[$key]) <= 0) {
$arSettings[$key] = $value;
}
}
if (!isset($arSettings["SumFormat"]["CRD"])) {
$arSettings["SumFormat"]["CRD"] = '.';
}
if (!isset($arSettings["QuantityFormat"]["CRD"])) {
$arSettings["QuantityFormat"]["CRD"] = '.';
}
if (!isset($arSettings["DateFormat"]["DF"])) {
$arSettings["DateFormat"]["DF"] = 'yyyy-MM-dd';
}
$arSettings["DateFormat"]["DF"] = strtoupper($arSettings["DateFormat"]["DF"]);
if (!isset($arSettings["TimeFormat"]["DF"])) {
$arSettings["TimeFormat"]["DF"] = 'HH:MM:SS';
}
$arSettings["TimeFormat"]["DF"] = str_replace("MM", "MI", $arSettings["TimeFormat"]["DF"]);
$arOrders = array();
if (is_array($arOrderData["CommerceInformation"]["#"]) && is_array($arOrderData["CommerceInformation"]["#"]["Document"])) {
foreach ($arOrderData["CommerceInformation"]["#"]["Document"] as $arDocument) {
if ($arDocument["#"]["BusinessTransaction"][0]["#"] == "ItemOrder") {
$v = $this->ParseOrderDataOrder($arDocument, $arSettings);
if (is_array($v)) {
$arOrders[] = $v;
if (isset($v["DATE_UPDATE"])) {
$modificationLabelTmp = MakeTimeStamp($v["DATE_UPDATE"]);
if ($modificationLabelTmp > $modificationLabel) {
$modificationLabel = $modificationLabelTmp;
}
}
}
}
}
}
return $arOrders;
}
示例5: SendFeed
public function SendFeed($socServUserId, $message, $messageId)
{
$isSetOauthKeys = true;
if (!$this->access_token || !$this->userId) {
$isSetOauthKeys = self::SetOauthKeys($socServUserId);
}
if ($isSetOauthKeys === false) {
CSocServMessage::Delete($messageId);
return false;
}
$message = CharsetConverter::ConvertCharset($message, LANG_CHARSET, "utf-8");
$arPost = array("access_token" => $this->access_token, "message" => $message);
$result = @CHTTP::sPostHeader($this::GRAPH_URL . "/" . $this->userId . "/feed", $arPost, array(), $this->httpTimeout);
if ($result !== false) {
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
return CUtil::JsObjectToPhp($result);
} else {
return false;
}
}
示例6: Authorize
public function Authorize()
{
global $APPLICATION, $USER;
$errorCode = 1;
if ($arOpenID = $this->Validate()) {
$arFields = array('EXTERNAL_AUTH_ID' => 'OPENID#' . $arOpenID['server'], 'XML_ID' => $arOpenID['identity'], 'PASSWORD' => randString(30), 'LID' => SITE_ID, "PERSONAL_WWW" => $arOpenID['identity']);
if (array_key_exists('openid_sreg_email', $_GET)) {
$arFields['EMAIL'] = $_GET['openid_sreg_email'];
}
if (array_key_exists('openid_sreg_gender', $_GET) && ($_GET['openid_sreg_gender'] == 'M' || $_GET['openid_sreg_gender'] == 'F')) {
$arFields['PERSONAL_GENDER'] = $_GET['openid_sreg_gender'];
}
if (array_key_exists('openid_sreg_fullname', $_GET)) {
$fullname = defined("BX_UTF") ? $_GET['openid_sreg_fullname'] : CharsetConverter::ConvertCharset($_GET['openid_sreg_fullname'], 'UTF-8', LANG_CHARSET);
$fullname = trim($fullname);
if (($pos = strpos($fullname, ' ')) !== false) {
$arFields['NAME'] = substr($fullname, 0, $pos);
$arFields['LAST_NAME'] = substr($fullname, $pos + 1);
} else {
$arFields['NAME'] = $fullname;
}
}
if (array_key_exists('openid_sreg_postcode', $_GET)) {
$arFields['PERSONAL_ZIP'] = $_GET['openid_sreg_postcode'];
}
if (array_key_exists('openid_sreg_timezone', $_GET)) {
$arFields['TIME_ZONE'] = $_GET['openid_sreg_timezone'];
}
if (array_key_exists('openid_sreg_country', $_GET)) {
$arFields['PERSONAL_COUNTRY'] = GetCountryIdByCode($_GET['openid_sreg_country']);
}
if (array_key_exists('openid_sreg_dob', $_GET)) {
$arFields['PERSONAL_BIRTHDAY'] = CDatabase::FormatDate($_GET['openid_sreg_dob'], "YYYY-MM-DD", FORMAT_DATE);
}
if (array_key_exists('BX_OPENID_IDENTITY', $_SESSION)) {
$arFields['LOGIN'] = $_SESSION['BX_OPENID_IDENTITY'];
} else {
$arFields['LOGIN'] = $arOpenID['identity'];
}
$arFields['LOGIN'] = preg_replace("#^(http://|https://)#i", "", $arFields['LOGIN']);
$USER_ID = 0;
if ($GLOBALS["USER"]->IsAuthorized() && $GLOBALS["USER"]->GetID()) {
if (!CSocServAuth::isSplitDenied()) {
$arFields['USER_ID'] = $GLOBALS["USER"]->GetID();
CSocServAuthDB::Add($arFields);
self::CleanParam();
} else {
$errorCode = SOCSERV_REGISTRATION_DENY;
}
} else {
$dbUsersOld = $GLOBALS["USER"]->GetList($by, $ord, array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID'], 'ACTIVE' => 'Y'), array('NAV_PARAMS' => array("nTopCount" => "1")));
$dbUsersNew = $GLOBALS["USER"]->GetList($by, $ord, array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => 'socservices', 'ACTIVE' => 'Y'), array('NAV_PARAMS' => array("nTopCount" => "1")));
$dbSocUser = CSocServAuthDB::GetList(array(), array('XML_ID' => $arFields['XML_ID'], 'EXTERNAL_AUTH_ID' => $arFields['EXTERNAL_AUTH_ID']), false, false, array("USER_ID", "ACTIVE"));
if ($arUser = $dbSocUser->Fetch()) {
if ($arUser["ACTIVE"] === 'Y') {
$USER_ID = $arUser["USER_ID"];
}
} elseif ($arUser = $dbUsersOld->Fetch()) {
$USER_ID = $arUser['ID'];
} elseif ($arUser = $dbUsersNew->Fetch()) {
$USER_ID = $arUser["ID"];
} elseif (COption::GetOptionString("main", "new_user_registration", "N") == "Y") {
$def_group = COption::GetOptionString('main', 'new_user_registration_def_group', '');
if ($def_group != '') {
$arFields['GROUP_ID'] = explode(',', $def_group);
}
if (!empty($arFields['GROUP_ID']) && CSocServAuth::isAuthDenied($arFields['GROUP_ID'])) {
$errorCode = SOCSERV_REGISTRATION_DENY;
} else {
foreach (GetModuleEvents("main", "OnBeforeOpenIDUserAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($arFields));
}
$arFieldsUser = $arFields;
$arFieldsUser["EXTERNAL_AUTH_ID"] = "socservices";
if (!($USER_ID = $GLOBALS["USER"]->Add($arFieldsUser))) {
return false;
}
$arFields['CAN_DELETE'] = 'N';
$arFields['USER_ID'] = $USER_ID;
CSocServAuthDB::Add($arFields);
unset($arFields['CAN_DELETE']);
}
} elseif (COption::GetOptionString("main", "new_user_registration", "N") == "N") {
$errorCode = 2;
}
if (intval($USER_ID) > 0) {
$arGroups = $USER->GetUserGroup($USER_ID);
if (CSocServAuth::isAuthDenied($arGroups)) {
$errorCode = SOCSERV_AUTHORISATION_ERROR;
} else {
$USER->AuthorizeWithOtp($USER_ID);
$arKillParams = array("auth_service_id", "check_key");
foreach (array_keys($_GET) as $k) {
if (strpos($k, 'openid_') === 0) {
$arKillParams[] = $k;
}
}
$redirect_url = $APPLICATION->GetCurPageParam('', $arKillParams, false);
foreach (GetModuleEvents("main", "OnBeforeOpenIDAuthFinalRedirect", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($redirect_url, $USER_ID, $arFields));
//.........这里部分代码省略.........
示例7: require_once
}
}
if (!defined("AUTH_404"))
// define("AUTH_404", "Y");
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/bx_root.php");
require_once($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/dbconn.php");
// define("BX_URLREWRITE", true);
$requestUri = urldecode($_SERVER["REQUEST_URI"]);
$bUTF = (!defined("BX_UTF") && CUtil::DetectUTF8($_SERVER["REQUEST_URI"]));
if($bUTF)
$requestUri = CharsetConverter::ConvertCharset($requestUri, "utf-8", (defined("BX_DEFAULT_CHARSET")? BX_DEFAULT_CHARSET : "windows-1251"));
include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/virtual_io.php");
$io = CBXVirtualIo::GetInstance();
$arUrlRewrite = array();
if(file_exists($_SERVER['DOCUMENT_ROOT']."/urlrewrite.php"))
include($_SERVER['DOCUMENT_ROOT']."/urlrewrite.php");
if(isset($_SERVER['REDIRECT_STATUS']) && $_SERVER['REDIRECT_STATUS'] == '404' || isset($_GET["SEF_APPLICATION_CUR_PAGE_URL"]))
{
if(isset($_SERVER['REDIRECT_STATUS']) && $_SERVER['REDIRECT_STATUS'] == '404' && !isset($_GET["SEF_APPLICATION_CUR_PAGE_URL"]))
{
$url = $requestUri;
}
else
示例8: GetCurrentUserFriends
public function GetCurrentUserFriends($limit, &$next)
{
if ($this->access_token === false) {
return false;
}
$http = new HttpClient();
$http->setHeader('GData-Version', '3.0');
$http->setHeader('Authorization', 'Bearer ' . $this->access_token);
$url = static::FRIENDS_URL . '?';
$limit = intval($limit);
$next = intval($next);
if ($limit > 0) {
$url .= '&max-results=' . $limit;
}
if ($next > 0) {
$url .= '&start-index=' . $next;
}
$result = $http->get($url);
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
if ($http->getStatus() == 200) {
$obXml = new \CDataXML();
if ($obXml->loadString($result)) {
$tree = $obXml->getTree();
$total = $tree->elementsByName("totalResults");
$total = intval($total[0]->textContent());
$limitNode = $tree->elementsByName("itemsPerPage");
$next += intval($limitNode[0]->textContent());
if ($next >= $total) {
$next = '__finish__';
}
$arFriends = array();
$arEntries = $tree->elementsByName('entry');
foreach ($arEntries as $entry) {
$arEntry = array();
$entryChildren = $entry->children();
foreach ($entryChildren as $child) {
$tag = $child->name();
switch ($tag) {
case 'category':
case 'updated':
case 'edited':
break;
case 'name':
$arEntry[$tag] = array();
foreach ($child->children() as $subChild) {
$arEntry[$tag][$subChild->name()] = $subChild->textContent();
}
break;
case 'email':
if ($child->getAttribute('primary') == 'true') {
$arEntry[$tag] = $child->getAttribute('address');
}
break;
default:
$tagContent = $tag == 'link' ? $child->getAttribute('href') : $child->textContent();
if ($child->getAttribute('rel')) {
if (!isset($arEntry[$tag])) {
$arEntry[$tag] = array();
}
$arEntry[$tag][preg_replace("/^[^#]*#/", "", $child->getAttribute('rel'))] = $tagContent;
} elseif (isset($arEntry[$tag])) {
if (!is_array($arEntry[$tag][0]) || !isset($arEntry[$tag][0])) {
$arEntry[$tag] = array($arEntry[$tag], $tagContent);
} else {
$arEntry[$tag][] = $tagContent;
}
} else {
$arEntry[$tag] = $tagContent;
}
}
}
if ($arEntry['email']) {
$arFriends[] = $arEntry;
}
}
return $arFriends;
}
}
return false;
}
示例9: GetServerName
public static function GetServerName()
{
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
$server_name = SITE_SERVER_NAME;
}
if (!$server_name) {
$server_name = COption::GetOptionString("main", "server_name", "");
}
if (!$server_name) {
$server_name = $_SERVER['HTTP_HOST'];
}
$server_name = rtrim($server_name, '/');
if (!preg_match('/^[a-z0-9\\.\\-]+$/i', $server_name)) {
$converter = new CBXPunycode(defined('BX_UTF') && BX_UTF === true ? 'UTF-8' : 'windows-1251');
$host = $converter->Encode($server_name);
if (!preg_match('#--p1ai$#', $host)) {
// trying to guess
$host = $converter->Encode(CharsetConverter::ConvertCharset($server_name, 'utf-8', 'windows-1251'));
}
$server_name = $host;
}
return $server_name;
}
示例10: ConvertCharset
function ConvertCharset($string, $charset_in, $charset_out)
{
$this->ResetException();
$error = "";
$result = CharsetConverter::ConvertCharset($string, $charset_in, $charset_out, $error);
if (!$result && !empty($error)) {
$this->ThrowException($error, "ERR_CHAR_BX_CONVERT");
}
return $result;
}
示例11: Encode
/**
* Encode the given string
*
* @param string $domainName String to be encoded
* @return string Encoded form of the given string
*/
public function Encode($domainName)
{
$this->ClearErrors();
$domainName = strtolower(trim($domainName));
$scheme = "";
$schemePosition = strpos($domainName, "://");
if ($schemePosition !== false) {
$scheme = substr($domainName, 0, $schemePosition);
$domainName = substr($domainName, $schemePosition + 3);
}
if ($this->encoding != "utf-8") {
$domainName = CharsetConverter::ConvertCharset($domainName, $this->encoding, "utf-8");
}
$domainNameUcs4 = $this->Utf8ToUcs4($domainName);
if (empty($domainNameUcs4)) {
return "";
}
$arDomainNameUcs4 = $this->ExplodeDomainName($domainNameUcs4);
foreach ($arDomainNameUcs4 as $key => $value) {
$checked = array_slice($value, 0, self::$punycodePrefixLength);
if (self::$punycodePrefixUcs4 == $checked) {
continue;
}
$arDomainNameUcs4[$key] = $this->NamePrepUcs4($arDomainNameUcs4[$key]);
if (!$arDomainNameUcs4[$key] || !is_array($arDomainNameUcs4[$key])) {
return false;
}
$arDomainNameUcs4[$key] = $this->DoEncodeUcs4($arDomainNameUcs4[$key]);
}
$domainNameUcs4 = $this->ImplodeDomainName($arDomainNameUcs4);
$domainName = $this->Ucs4ToUtf8($domainNameUcs4);
if ($this->encoding != "utf-8") {
$domainName = CharsetConverter::ConvertCharset($domainName, "utf-8", $this->encoding);
}
if (!empty($scheme)) {
$domainName = $scheme . "://" . $domainName;
}
return $domainName;
}
示例12: ExportOrders2Xml
//.........这里部分代码省略.........
}
$dbSite = CSite::GetByID($arOrder["LID"]);
$arSite = $dbSite->Fetch();
?>
<<?php
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
<<?php
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php
echo GetMessage("SALE_EXPORT_SITE_NAME");
?>
</<?php
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
<<?php
echo GetMessage("SALE_EXPORT_VALUE");
?>
>[<?php
echo $arOrder["LID"];
?>
] <?php
echo htmlspecialcharsbx($arSite["NAME"]);
?>
</<?php
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
</<?php
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
<?
if(!empty($agent["REKV"]))
{
foreach($agent["REKV"] as $k => $v)
{
if(strlen($agentParams[$k]["NAME"]) > 0 && strlen($v) > 0)
{
?>
<<?php
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
<<?php
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php
echo htmlspecialcharsbx($agentParams[$k]["NAME"]);
?>
</<?php
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
<<?php
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php
echo htmlspecialcharsbx($v);
?>
</<?php
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
</<?php
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
<?
}
}
}
?>
</<?php
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
</<?php
echo GetMessage("SALE_EXPORT_DOCUMENT");
?>
>
<?
if ($crmMode)
{
$c = ob_get_clean();
$c = CharsetConverter::ConvertCharset($c, $arCharSets[$arOrder["LID"]], "utf-8");
echo $c;
}
}
?>
</<?php
echo GetMessage("SALE_EXPORT_COM_INFORMATION");
?>
>
<?
return $arResultStat;
}
示例13: foreach
foreach ($_POST['IB_SEG_PRICETYPE'] as $key => $priceTypeId) {
$arPriceGroup[$priceTypeId] = array("TYPE" => $_POST['IB_SEG_PRICETYPE'][$key], "PRICE" => $_POST['IB_SEG_PRICE'][$key], "CURRENCY" => $_POST['IB_SEG_CURRENCY'][$key]);
}
}
foreach ($arPropertyValues as $propertyId => $arValues) {
if (isset($arPropertyChecks[$propertyId])) {
$arPropertyValue[$propertyId] = array_intersect_key($arValues, $arPropertyChecks[$propertyId]);
}
}
$arCombinationResult = arraysCombination($arPropertyValue);
if ($_POST['AJAX_MODE'] == 'Y') {
$APPLICATION->RestartBuffer();
foreach ($arPropertyValue as &$value) {
foreach ($value as &$value2) {
if (!defined("BX_UTF")) {
$value2 = CharsetConverter::ConvertCharset($value2, "utf-8", LANG_CHARSET);
}
}
}
echo CUtil::PhpToJSObject(array($arPropertyValue));
exit;
}
$dbIBlockElement = CIBlockElement::GetList(array(), array("ID" => $subPropValue));
$arIBlockElement = $dbIBlockElement->Fetch();
if (strlen($_POST['save']) > 0) {
$parentElementId = 0 < $subPropValue ? $subPropValue : -$subTmpId;
$parentElement = new \Bitrix\Iblock\Template\Entity\Element($parentElementId);
if ($parentElementId < 0) {
$arFields = array("NAME" => htmlspecialcharsbx($_POST['PRODUCT_NAME_HIDDEN']));
$parentElement->setFields($arFields);
}
示例14: GetCurrentUserFriends
public function GetCurrentUserFriends($limit = 0, $offset = 0)
{
if($this->access_token === false)
return false;
$url = self::FRIENDS_URL."?access_token=".urlencode($this->access_token);
if($limit > 0)
{
$url .= '&limit='.intval($limit)."&offset=".intval($offset);
}
$result = CHTTP::sGetHeader($url, array(), $this->httpTimeout);
if(!defined("BX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
$result = CUtil::JsObjectToPhp($result);
if(is_array($result))
{
$result["access_token"] = $this->access_token;
$result["refresh_token"] = $this->refresh_token;
$result["expires_in"] = $this->accessTokenExpires;
}
return $result;
}
示例15: md5
$_SESSION['CRM_IMPORT_FILE'] = $sTmpFilePath . md5($_FILES['IMPORT_FILE']['tmp_name']) . '.tmp';
$_SESSION['CRM_IMPORT_FILE_POS'] = 0;
move_uploaded_file($_FILES['IMPORT_FILE']['tmp_name'], $_SESSION['CRM_IMPORT_FILE']);
@chmod($_SESSION['CRM_IMPORT_FILE'], BX_FILE_PERMISSIONS);
if (isset($_POST['IMPORT_FILE_ENCODING'])) {
$fileEncoding = $_POST['IMPORT_FILE_ENCODING'];
if ($fileEncoding !== '' && $fileEncoding !== '_' && $fileEncoding !== strtolower(SITE_CHARSET)) {
$convertCharsetErrorMsg = '';
$fileHandle = fopen($_SESSION['CRM_IMPORT_FILE'], 'rb');
$fileContents = fread($fileHandle, filesize($_SESSION['CRM_IMPORT_FILE']));
fclose($fileHandle);
//HACK: Remove UTF-8 BOM
if ($fileEncoding === 'utf-8' && substr($fileContents, 0, 3) === "") {
$fileContents = substr($fileContents, 3);
}
$fileContents = CharsetConverter::ConvertCharset($fileContents, $fileEncoding, SITE_CHARSET, $convertCharsetErrorMsg);
$fileHandle = fopen($_SESSION['CRM_IMPORT_FILE'], 'wb');
fwrite($fileHandle, $fileContents);
fclose($fileHandle);
}
}
$_SESSION['CRM_IMPORT_DEFAULT_RESPONSIBLE_ID'] = isset($_POST['IMPORT_DEFAULT_RESPONSIBLE_ID']) ? $_POST['IMPORT_DEFAULT_RESPONSIBLE_ID'] : '';
$_SESSION['CRM_IMPORT_IMPORT_NAME_FORMAT'] = isset($_POST['IMPORT_NAME_FORMAT']) && \Bitrix\Crm\Format\PersonNameFormatter::isDefined($_POST['IMPORT_NAME_FORMAT']) ? intval($_POST['IMPORT_NAME_FORMAT']) : \Bitrix\Crm\Format\PersonNameFormatter::FirstLast;
if ($_POST['IMPORT_FILE_SEPORATOR'] == 'semicolon') {
$_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ';';
} elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'comma') {
$_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ',';
} elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'tab') {
$_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = "\t";
} elseif ($_POST['IMPORT_FILE_SEPORATOR'] == 'space') {
$_SESSION['CRM_IMPORT_FILE_SEPORATOR'] = ' ';