• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CharsetConverter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CharsetConverter的典型用法代码示例。如果您正苦于以下问题:PHP CharsetConverter类的具体用法?PHP CharsetConverter怎么用?PHP CharsetConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CharsetConverter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:34,代码来源:ajax.php


示例2: referenceItemsStart

 public function referenceItemsStart($path, $attr)
 {
     if ($this->NS["fp"] <= 0) {
         $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 10));
     } else {
         $this->deleteBySessid($this->NS["HL"], $this->NS["SESSID"]);
         $xmlPosition = $this->xmlStream->getPosition();
         $filePosition = $this->decodePostion($xmlPosition);
         $xmlString = $this->xmlStream->readFilePart($this->NS["fp"], $filePosition);
         $error = "";
         if ($xmlPosition[0]) {
             $xmlString = CharsetConverter::convertCharset($xmlString, $xmlPosition[0], LANG_CHARSET, $error);
         }
         $xmlString .= "</" . GetMessage("CC_BCIH_XML_REFERENCE") . ">";
         $xmlObject = new CDataXML();
         if ($xmlObject->loadString($xmlString)) {
             $highBlockID = $this->checkReference($xmlObject->GetArray());
             $this->dataClass = "";
             $this->step = true;
             $this->message = GetMessage("CC_BCIH_REFERENCE_FOUND_OR_CREATED", array("#CODE#" => $highBlockID));
             if ($highBlockID > 0) {
                 $this->NS["HL"] = $highBlockID;
                 $this->NS["FM"] = array();
                 $this->NS["C"] = 0;
             } else {
                 $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 30));
             }
         } else {
             $this->error = GetMessage("CC_BCIH_XML_PARSE_ERROR", array("#CODE#" => 20));
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:32,代码来源:class.php


示例3: GetInstance

	/**
	 * @static
	 * @return CharsetConverter
	 */
	public static function GetInstance()
	{
		if (!isset(self::$instance))
		{
			$c = __CLASS__;
			self::$instance = new $c;
		}

		return self::$instance;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:14,代码来源:charset_converter.php


示例4: qiwiWalletXmlResponse

 function qiwiWalletXmlResponse($code)
 {
     global $APPLICATION;
     $APPLICATION->RestartBuffer();
     header("Content-Type: text/xml");
     header("Pragma: no-cache");
     $xml = '<?xml version="1.0" encoding="UTF-8"?><result><result_code>' . $code . '</result_code></result>';
     $siteCharset = Application::getInstance()->getContext()->getCulture()->getCharset();
     print \CharsetConverter::getInstance()->ConvertCharset($xml, $siteCharset, "utf-8");
     die;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:functions.php


示例5: 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;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:domain_registrar.php


示例6: readXml

 /**
  * Reads xml chunk from the file preserving it's position
  *
  * @param int $startPosition
  * @param int $endPosition
  * @return CDataXML|false
  */
 private function readXml($startPosition, $endPosition)
 {
     $savedPosition = ftell($this->fileHandler);
     fseek($this->fileHandler, $startPosition);
     $xmlChunk = fread($this->fileHandler, $endPosition - $startPosition);
     fseek($this->fileHandler, $savedPosition);
     if ($xmlChunk && $this->fileCharset) {
         $error = "";
         $xmlChunk = CharsetConverter::convertCharset($xmlChunk, $this->fileCharset, LANG_CHARSET, $error);
     }
     $xmlObject = new CDataXML();
     if ($xmlObject->loadString($xmlChunk)) {
         return $xmlObject;
     } else {
         return false;
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:24,代码来源:xml.php


示例7: _extractFile

 private function _extractFile(&$arEntry, $path, $removePath, $removeAllPath, &$arParams)
 {
     if (($res = $this->_readFileHeader($header)) != 1) {
         return $res;
     }
     //to be checked: file header should be coherent with $arEntry info
     $arEntry["filename"] = CharsetConverter::ConvertCharset($arEntry["filename"], "cp866", $this->fileSystemEncoding);
     $arEntry["stored_filename"] = CharsetConverter::ConvertCharset($arEntry["stored_filename"], "cp866", $this->fileSystemEncoding);
     //protecting against ../ etc in file path
     //only absolute path should be in the $arEntry
     $arEntry['filename'] = _normalizePath($arEntry['filename']);
     $arEntry['stored_filename'] = _normalizePath($arEntry['stored_filename']);
     if ($removeAllPath == true) {
         $arEntry['filename'] = basename($arEntry['filename']);
     } else {
         if ($removePath != "") {
             if ($this->_containsPath($removePath, $arEntry['filename']) == 2) {
                 //change file status
                 $arEntry['status'] = "filtered";
                 return $res;
             }
             $removePath_size = strlen($removePath);
             if (substr($arEntry['filename'], 0, $removePath_size) == $removePath) {
                 //remove path
                 $arEntry['filename'] = substr($arEntry['filename'], $removePath_size);
             }
         }
     }
     //making absolute path to the extracted file out of filename stored in the zip header and passed extracting path
     if ($path != '') {
         $arEntry['filename'] = $path . "/" . $arEntry['filename'];
     }
     //pre-extract callback
     if (isset($arParams['callback_pre_extract']) && $arParams['callback_pre_extract'] != '') {
         //generate local info
         $arLocalHeader = array();
         $this->_convertHeader2FileInfo($arEntry, $arLocalHeader);
         //callback call
         eval('$res = ' . $arParams['callback_pre_extract'] . '(\'callback_pre_extract\', $arLocalHeader);');
         //change file status
         if ($res == 0) {
             $arEntry['status'] = "skipped";
             $res = 1;
         }
         //update the info, only some fields can be modified
         $arEntry['filename'] = $arLocalHeader['filename'];
     }
     //check if extraction should be done
     if ($arEntry['status'] == 'ok') {
         $logicalFilename = $this->io->GetLogicalName($arEntry['filename']);
         if ((HasScriptExtension($arEntry['filename']) || IsFileUnsafe($arEntry['filename']) || !$this->io->ValidatePathString($logicalFilename) || !$this->io->ValidateFilenameString(GetFileName($logicalFilename))) && $this->checkBXPermissions == true) {
             $arEntry['status'] = "no_permissions";
         } else {
             //if the file exists, change status
             if (file_exists($arEntry['filename'])) {
                 if (is_dir($arEntry['filename'])) {
                     $arEntry['status'] = "already_a_directory";
                 } else {
                     if (!is_writeable($arEntry['filename'])) {
                         $arEntry['status'] = "write_protected";
                     } else {
                         if (filemtime($arEntry['filename']) > $arEntry['mtime'] && !$this->replaceExistentFiles) {
                             $arEntry['status'] = "newer_exist";
                         }
                     }
                 }
             } else {
                 //check the directory availability and create it if necessary
                 if (($arEntry['external'] & 0x10) == 0x10 || substr($arEntry['filename'], -1) == '/') {
                     $checkDir = $arEntry['filename'];
                 } else {
                     if (!strstr($arEntry['filename'], "/")) {
                         $checkDir = "";
                     } else {
                         $checkDir = dirname($arEntry['filename']);
                     }
                 }
                 if (($res = $this->_checkDir($checkDir, ($arEntry['external'] & 0x10) == 0x10)) != 1) {
                     //change file status
                     $arEntry['status'] = "path_creation_fail";
                     //return $res;
                     $res = 1;
                 }
             }
         }
     }
     //check if extraction should be done
     if ($arEntry['status'] == 'ok') {
         //if not a folder - extract
         if (!(($arEntry['external'] & 0x10) == 0x10)) {
             //if zip file with 0 compression
             if ($arEntry['compression'] == 0 && $arEntry['compressed_size'] == $arEntry['size']) {
                 if (($destFile = @fopen($arEntry['filename'], 'wb')) == 0) {
                     $arEntry['status'] = "write_error";
                     return $res;
                 }
                 //reading the fileby by self::ReadBlockSize octets blocks
                 $size = $arEntry['compressed_size'];
                 while ($size != 0) {
                     $length = $size < self::ReadBlockSize ? $size : self::ReadBlockSize;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:zip.php


示例8: chr

 protected static function chr($a)
 {
     return \CharsetConverter::ConvertCharset($a, 'cp1251', SITE_CHARSET);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:4,代码来源:textparser.php


示例9: LocalRedirect

             if (!empty($arResult['SETTINGS']['link'])) {
                 LocalRedirect($arResult['SETTINGS']['link'], true);
             } else {
                 LocalRedirect($APPLICATION->GetCurPage() . '?STEP=setup');
             }
         }
     }
     break;
 case 'check':
     $APPLICATION->RestartBuffer();
     $error = false;
     $unseen = CMailUtil::CheckImapMailbox($acc['SERVER'], $acc['PORT'], $acc['USE_TLS'], $acc['LOGIN'], $acc['PASSWORD'], $error, 30);
     CUserCounter::Set($USER->GetID(), 'mail_unseen', $unseen, SITE_ID);
     CUserOptions::SetOption('global', 'last_mail_check_' . SITE_ID, time());
     CUserOptions::SetOption('global', 'last_mail_check_success_' . SITE_ID, $unseen >= 0);
     $response = array('result' => $error === false ? 'ok' : 'error', 'unseen' => $unseen, 'error' => CharsetConverter::ConvertCharset($error, SITE_CHARSET, 'UTF-8'));
     header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
     echo json_encode($response);
     die;
     break;
 case 'setup':
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['SERVICE'])) {
         $arResult['ERRORS'] = array();
         $arResult['SETTINGS'] = $arParams['SERVICES'][$arResult['SERVICE']];
         foreach ($arParams['OPTIONS'] as $option) {
             if (empty($arResult['SETTINGS'][$option])) {
                 unset($error);
                 $arResult['SETTINGS'][$option] = isset($_REQUEST[$option]) ? $_REQUEST[$option] : null;
                 $arResult['SETTINGS'][$option] = CheckOption($option, $arResult['SETTINGS'][$option], $error);
                 if (!empty($error)) {
                     $arResult['ERRORS'][] = $error;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


示例10: prepareAnswer

 protected function prepareAnswer($result)
 {
     if (!defined("BX_UTF")) {
         $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
     }
     $res = CUtil::JsObjectToPhp($result);
     if (!$res) {
         AddMessage2Log('Strange answer from Network! ' . $result . print_r($res, 1));
     }
     return $res;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:11,代码来源:bitrix24net.php


示例11: GetVideoOembed

	public static function GetVideoOembed($url = '')
	{
		// Get oembed url
		$oembed = self::GetOembedUrlInfo($url);
		$output = array('result' => false, 'error' => "");
		$http = new \Bitrix\Main\Web\HttpClient();
		$resp = $http->get($oembed['url']);
		if ($resp === false)
		{
			$error = $http->getError();
			foreach($error as $errorCode => $errorMessage)
			{
				$output['error'] .=  '['.$errorCode.'] '.$errorMessage.";\n";
			}
		}
		else
		{
			$resParams = json_decode($resp, true);
			if ($resParams && is_array($resParams))
			{
				if (!defined('BX_UTF') || BX_UTF !== true)
				{
					$resParams['title'] = CharsetConverter::ConvertCharset($resParams['title'], 'UTF-8', SITE_CHARSET);
					$resParams['html'] = CharsetConverter::ConvertCharset($resParams['html'], 'UTF-8', SITE_CHARSET);
					$resParams['provider_name'] = CharsetConverter::ConvertCharset($resParams['provider_name'], 'UTF-8', SITE_CHARSET);

				}

				$resParams['html'] = preg_replace("/https?:\/\//is", '//', $resParams['html']);
				$output['result'] = true;
				$output['data'] = array(
					'html' => $resParams['html'],
					'title' => $resParams['title'],
					'width' => intval($resParams['width']),
					'height' => intval($resParams['height']),
					'provider' => $resParams['provider_name']
				);
			}
			else
			{
				$output['error'] .=  '[FVID404] '.GetMessage('HTMLED_VIDEO_NOT_FOUND').";\n";
			}
		}

		return $output;
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:46,代码来源:html_editor.php


示例12: query

 protected function query($url)
 {
     if ($this->access_token === false) {
         return false;
     }
     $http = new HttpClient();
     $http->setHeader("authorization", "Bearer " . $this->access_token);
     $result = $http->get($url);
     if (!defined("BX_UTF")) {
         $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
     }
     $result = CUtil::JsObjectToPhp($result);
     return $result;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:14,代码来源:googleplus.php


示例13: StrangeUrlEncode

 public static function StrangeUrlEncode($url)
 {
     if (!defined('BX_UTF')) {
         $url = CharsetConverter::ConvertCharset($url, SITE_CHARSET, "UTF-8");
     }
     $ind = strpos($url, "?");
     $url = str_replace("%2F", "/", rawurlencode(substr($url, 0, $ind))) . substr($url, $ind);
     return $url;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:uploader.php


示例14: array

<?php

require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/include.php";
if (!check_bitrix_sessid()) {
    die;
}
if (!CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), $_REQUEST['DocumentType'])) {
    die;
}
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
CUtil::DecodeUriComponent($_REQUEST);
CUtil::DecodeUriComponent($_POST);
if (LANG_CHARSET != "UTF-8" && isset($_REQUEST['Type']['Options']) && is_array($_REQUEST['Type']['Options'])) {
    $newarr = array();
    foreach ($_REQUEST['Type']['Options'] as $k => $v) {
        $newarr[CharsetConverter::ConvertCharset($k, "UTF-8", LANG_CHARSET)] = $v;
    }
    $_REQUEST['Type']['Options'] = $newarr;
}
$v = $documentService->GetFieldInputValue($_REQUEST['DocumentType'], $_REQUEST['Type'], $_REQUEST['Field'], $_REQUEST, $arErrors);
$vp = $documentService->GetFieldInputValuePrintable($_REQUEST['DocumentType'], $_REQUEST['Type'], $v);
if (is_array($vp)) {
    $vp = implode(", ", $vp);
}
echo CUtil::PhpToJSObject(array($v, $vp));
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:28,代码来源:bizproc_set_field.php


示例15: 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;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:82,代码来源:google.php


示例16: SendFeed

 public function SendFeed($socServUserId, $message, $getNewToken = true)
 {
     if (!$this->access_token || intval($this->userId) < 1) {
         self::SetOauthKeys($socServUserId);
     }
     if (!defined("BX_UTF")) {
         $message = CharsetConverter::ConvertCharset($message, LANG_CHARSET, "utf-8");
     }
     $this->sign = strtolower(md5('application_key=' . $this->appKey . 'method=users.setStatusstatus=' . $message . md5($this->access_token . $this->appSecret)));
     $result = CHTTP::sGetHeader(self::CONTACTS_URL . "?method=users.setStatus&application_key=" . $this->appKey . "&access_token=" . $this->access_token . "&sig=" . $this->sign . "&status=" . urlencode($message), array(), $this->httpTimeout);
     if (!defined("BX_UTF")) {
         $result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
     }
     $arResult = CUtil::JsObjectToPhp($result);
     if ($getNewToken === true && isset($arResult["error_code"]) && $arResult["error_code"] == "102") {
         $newToken = self::RefreshToken($socServUserId);
         if ($newToken === true) {
             self::SendFeed($socServUserId, $message, false);
         } else {
             return false;
         }
     }
     return $arResult;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:24,代码来源:odnoklassniki.php


示例17: 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
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:31,代码来源:urlrewrite.php


示例18: ConvertToLangCharset

	function ConvertToLangCharset($string)
	{
		$bUTF = CUtil::DetectUTF8($string);

		$fromCP = false;
		if(defined("BX_UTF") && !$bUTF)
		{
			$fromCP = (defined("BX_DEFAULT_CHARSET")? BX_DEFAULT_CHARSET : "Windows-1251");
			$toCP = "UTF-8";
		}
		elseif(!defined("BX_UTF") && $bUTF)
		{
			$fromCP = "UTF-8";
			$toCP = (defined("LANG_CHARSET")? LANG_CHARSET : (defined("BX_DEFAULT_CHARSET")? BX_DEFAULT_CHARSET : "Windows-1251"));
		}

		if($fromCP !== false)
			$string = CharsetConverter::ConvertCharset($string, $fromCP, $toCP);

		return $string;
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:21,代码来源:tools.php


示例19: 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));
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:openidclient.php


示例20: readXml

 /**
  * Reads xml chunk from the file preserving it's position
  *
  * @param int $startPosition
  * @param int $endPosition
  * @return CDataXML|false
  */
 private function readXml($startPosition, $endPosition)
 {
     $xmlChunk = $this->readFilePart($startPosition, $endPosition);
     if ($xmlChunk && $this->fileCharset) {
         $error = "";
         $xmlChunk = CharsetConverter::convertCharset($xmlChunk, $this->fileCharset, LANG_CHARSET, $error);
     }
     $xmlObject = new CDataXML();
     if ($xmlObject->loadString($xmlChunk)) {
         return $xmlObject;
     } else {
         return false;
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:xml.php



注:本文中的CharsetConverter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Chart类代码示例发布时间:2022-05-20
下一篇:
PHP Character类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap