本文整理汇总了PHP中CUtil::JsObjectToPhp方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::JsObjectToPhp方法的具体用法?PHP CUtil::JsObjectToPhp怎么用?PHP CUtil::JsObjectToPhp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtil
的用法示例。
在下文中一共展示了CUtil::JsObjectToPhp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UploadFile
public static function UploadFile($hash, &$file, &$package, &$upload, &$error)
{
$post = \Bitrix\Main\Context::getCurrent()->getRequest()->getPostList()->toArray();
$post['PARAMS'] = CUtil::JsObjectToPhp($post['REG_PARAMS']);
$chatId = intval($post['REG_CHAT_ID']);
if (intval($chatId) <= 0) {
return false;
}
$chatRelation = CIMChat::GetRelationById($chatId);
if (!$chatRelation[self::GetUserId()]) {
$error = GetMessage('IM_DISK_ERR_UPLOAD');
return false;
}
$folderModel = self::GetFolderModel($chatId);
if (!$folderModel) {
$error = GetMessage('IM_DISK_ERR_UPLOAD');
return false;
}
$fileId = $post['PARAMS'][$file["id"]];
if (!$fileId) {
return false;
}
$fileModel = \Bitrix\Disk\File::getById($fileId);
if (!$fileModel || $fileModel->getParentId() != $folderModel->getId()) {
$error = GetMessage('IM_DISK_ERR_UPLOAD');
return false;
}
$resultUpdate = $fileModel->uploadVersion($file["files"]["default"], self::GetUserId());
if (!$resultUpdate) {
return false;
}
$file['fileId'] = $fileId;
$file['fileTmpId'] = $file["id"];
$file['fileMessageId'] = $messageId;
$file['fileChatId'] = $chatId;
$file['fileParams'] = self::GetFileParams($chatId, $fileModel);
$messageId = intval($post['REG_MESSAGE_ID']);
if (CModule::IncludeModule('pull')) {
foreach ($chatRelation as $relation) {
CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'fileUpload', 'params' => array('fileChatId' => $file['fileChatId'], 'fileId' => $file['fileId'], 'fileTmpId' => $file["id"], 'fileMessageId' => $file["fileMessageId"], 'fileParams' => $file['fileParams'])));
}
}
$arFiles[$fileId] = $file['fileParams'];
$file['fileMessageOut'] = CIMMessenger::GetFormatFilesMessageOut($arFiles);
CIMMessage::UpdateMessageOut($messageId, $file['fileMessageOut']);
foreach (GetModuleEvents("im", "OnAfterFileUpload", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(array('CHAT_ID' => $file['fileChatId'], 'FILE_ID' => $file['fileId'], 'MESSAGE_ID' => $file['fileMessageId'], 'MESSAGE_OUT' => $file['fileMessageOut'], 'FILE' => $file['fileParams'])));
}
return true;
}
示例2: GetLastDepartment
/**
* Retrieves last used department from socialnetwork/log_destination UserOption
* @deprecated
*/
public static function GetLastDepartment()
{
$arLastSelected = CUserOptions::GetOption("socialnetwork", "log_destination", array());
$arLastSelected = is_array($arLastSelected) && strlen($arLastSelected['department']) > 0 && $arLastSelected['department'] != '"{}"' ? array_reverse(CUtil::JsObjectToPhp($arLastSelected['department'])) : array();
$count = 0;
$arDepartment = array();
foreach ($arLastSelected as $depId) {
if ($count < 4) {
$count++;
} else {
break;
}
$arDepartment[$depId] = $depId;
}
return array_reverse($arDepartment);
}
示例3: GetCurrentUser
public function GetCurrentUser()
{
if($this->access_token === false)
return false;
$result = CHTTP::sGet(self::GRAPH_URL.'/me?access_token='.$this->access_token."&fields=picture,id,name,first_name,last_name,gender,birthday,email");
if(!defined("BX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
return CUtil::JsObjectToPhp($result);
}
示例4: GetUserInfo
public function GetUserInfo($user_id)
{
$result = CHTTP::sGet(self::API_URL.'users/show.json?user_id='.$user_id);
if(!defined("BX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
return CUtil::JsObjectToPhp($result);
}
示例5: array
{
if (is_array($item)) {
$ar = array();
foreach ($item as $k => $v) {
$ar[$GLOBALS["APPLICATION"]->ConvertCharset($k, "UTF-8", LANG_CHARSET)] = BPasDecodeArrayKeys($v);
}
return $ar;
} else {
return $item;
}
}
$_POST = BPasDecodeArrayKeys($_POST);
}
foreach (array('arWorkflowTemplate', 'arWorkflowParameters', 'arWorkflowVariables', 'arWorkflowConstants') as $k) {
if (!is_array($_POST[$k])) {
$_POST[$k] = (array) CUtil::JsObjectToPhp($_POST[$k]);
}
}
$arFields = array("DOCUMENT_TYPE" => array(MODULE_ID, ENTITY, $document_type), "AUTO_EXECUTE" => $_POST["workflowTemplateAutostart"], "NAME" => $_POST["workflowTemplateName"], "DESCRIPTION" => $_POST["workflowTemplateDescription"], "TEMPLATE" => $_POST["arWorkflowTemplate"], "PARAMETERS" => $_POST["arWorkflowParameters"], "VARIABLES" => $_POST["arWorkflowVariables"], "CONSTANTS" => $_POST["arWorkflowConstants"], "USER_ID" => intval($USER->GetID()), "MODIFIER_USER" => new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
if (!is_array($arFields["VARIABLES"])) {
$arFields["VARIABLES"] = array();
}
if (!is_array($arFields["CONSTANTS"])) {
$arFields["CONSTANTS"] = array();
}
function wfeexception_handler($e)
{
// PHP 5.2.1 bug http://bugs.php.net/bug.php?id=40456
//print_r($e);
?>
<script>
示例6: intval
$id = intval($id);
$userId = intval($userId);
$paySystemId = intval($paySystemId);
$buyerTypeId = intval($buyerTypeId);
$location = intval($location);
$locationID = intval($locationID);
$locationZip = intval($locationZip);
$locationZipID = intval($locationZipID);
$WEIGHT_UNIT = htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', "", $LID));
$WEIGHT_KOEF = htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, $LID));
$arDelivery = array();
$recomMore = ($recomMore == "Y") ? "Y" : "N";
$recalcOrder = ($recalcOrder == "Y") ? "Y" : "N";
$cartFix = ('Y' == $cartFix ? 'Y' : 'N');
$arOrderProduct = CUtil::JsObjectToPhp($product);
$arCoupon = fGetCoupon($coupon);
$arOrderOptions = array(
'CART_FIX' => $cartFix
);
$arOrderProductPrice = fGetUserShoppingCart($arOrderProduct, $LID, $recalcOrder);
foreach ($arOrderProductPrice as &$arItem) // tmp hack not to update basket quantity data from catalog
{
$arItem["ID_TMP"] = $arItem["ID"];
unset($arItem["ID"]);
}
unset($arItem);
示例7: GetCurrentUser
public function GetCurrentUser()
{
if($this->access_token === false)
return false;
$result = CHTTP::sGet(self::CONTACTS_URL."?access_token=".urlencode($this->access_token));
if(!defined("BX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
return CUtil::JsObjectToPhp($result);
}
示例8: getNewAccessToken
public function getNewAccessToken($refreshToken = false, $userId = 0, $save = false)
{
if ($this->appID == false || $this->appSecret == false) {
return false;
}
if ($refreshToken == false) {
$refreshToken = $this->refresh_token;
}
$result = CHTTP::sPostHeader(static::TOKEN_URL, array("refresh_token" => $refreshToken, "client_id" => $this->appID, "client_secret" => $this->appSecret, "grant_type" => "refresh_token"), array(), $this->httpTimeout);
$this->arResult = CUtil::JsObjectToPhp($result);
if (isset($this->arResult["access_token"]) && $this->arResult["access_token"] != '') {
$this->access_token = $this->arResult["access_token"];
$this->accessTokenExpires = $this->arResult["expires_in"] + time();
if ($save && intval($userId) > 0) {
$dbSocservUser = CSocServAuthDB::GetList(array(), array('USER_ID' => intval($userId), "EXTERNAL_AUTH_ID" => static::SERVICE_ID), false, false, array("ID"));
if ($arOauth = $dbSocservUser->Fetch()) {
CSocServAuthDB::Update($arOauth["ID"], array("OATOKEN" => $this->access_token, "OATOKEN_EXPIRES" => $this->accessTokenExpires));
}
}
return true;
}
return false;
}
示例9:
CVoxImplantTransfer::Answer($_POST['PARAMS']['CALL_ID']);
} else {
if ($_POST['COMMAND'] == 'waitTransfer') {
$_POST['PARAMS'] = CUtil::JsObjectToPhp($_POST['PARAMS']);
CVoxImplantTransfer::Wait($_POST['PARAMS']['CALL_ID']);
} else {
if ($_POST['COMMAND'] == 'declineTransfer') {
$_POST['PARAMS'] = CUtil::JsObjectToPhp($_POST['PARAMS']);
CVoxImplantTransfer::Decline($_POST['PARAMS']['CALL_ID']);
} else {
if ($_POST['COMMAND'] == 'cancelTransfer') {
$_POST['PARAMS'] = CUtil::JsObjectToPhp($_POST['PARAMS']);
CVoxImplantTransfer::Cancel($_POST['PARAMS']['CALL_ID']);
} else {
if ($_POST['COMMAND'] == 'timeoutTransfer') {
$_POST['PARAMS'] = CUtil::JsObjectToPhp($_POST['PARAMS']);
CVoxImplantTransfer::Timeout($_POST['PARAMS']['CALL_ID']);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
示例10: htmlspecialcharsbx
echo CUtil::PhpToJsObject(array('USER_ID' => htmlspecialcharsbx($_POST['USER_ID']), 'ERROR' => ''));
} else {
if ($_POST['IM_CHAT_ADD'] == 'Y') {
$_POST['USERS'] = CUtil::JsObjectToPhp($_POST['USERS']);
$errorMessage = "";
$CIMChat = new CIMChat();
$chatId = $CIMChat->Add('', $_POST['USERS']);
if (!$chatId) {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage = $e->GetString();
}
}
echo CUtil::PhpToJsObject(array('CHAT_ID' => intval($chatId), 'ERROR' => $errorMessage));
} else {
if ($_POST['IM_CHAT_EXTEND'] == 'Y') {
$_POST['USERS'] = CUtil::JsObjectToPhp($_POST['USERS']);
$errorMessage = "";
$CIMChat = new CIMChat();
$result = $CIMChat->AddUser($_POST['CHAT_ID'], $_POST['USERS']);
if (!$result) {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage = $e->GetString();
}
}
echo CUtil::PhpToJsObject(array('ERROR' => $errorMessage));
} else {
if ($_POST['IM_CHAT_LEAVE'] == 'Y') {
$CIMChat = new CIMChat();
$result = $CIMChat->DeleteUser($_POST['CHAT_ID'], intval($_POST['USER_ID']) > 0 ? intval($_POST['USER_ID']) : $USER->GetID());
echo CUtil::PhpToJsObject(array('CHAT_ID' => intval($_POST['CHAT_ID']), 'USER_ID' => intval($_POST['USER_ID']), 'ERROR' => $result ? '' : 'AUTHORIZE_ERROR'));
} else {
示例11: RefreshToken
private function RefreshToken($socServUserId)
{
$result = CHTTP::sPostHeader(self::TOKEN_URL, array("refresh_token" => $this->refresh_token, "client_id" => $this->appID, "client_secret" => $this->appSecret, "grant_type" => "refresh_token"), array(), $this->httpTimeout);
$arResult = CUtil::JsObjectToPhp($result);
if (isset($arResult["access_token"]) && $arResult["access_token"] != '') {
$this->access_token = $arResult["access_token"];
CSocServAuthDB::Update($socServUserId, array("OATOKEN" => $arResult["access_token"]));
return true;
}
return false;
}
示例12: GetCurrentUser
public function GetCurrentUser()
{
if($this->access_token === false)
return false;
$result = CHTTP::sGet(self::CONTACTS_URL.'contacts/default/full?v=3.0&alt=json&oauth_token='.urlencode($this->access_token));
return CUtil::JsObjectToPhp($result);
}
示例13: SendTwit
public function SendTwit($socServUserId, $message, $messageId)
{
$isSetOauthKeys = true;
if (!$this->token || !$this->tokenSecret) {
$isSetOauthKeys = self::SetOauthKeys($socServUserId);
}
if ($isSetOauthKeys === false) {
CSocServMessage::Delete($messageId);
return false;
}
if (strlen($message) > 139) {
$message = substr($message, 0, 137) . "...";
}
if (!defined("BX_UTF")) {
$message = CharsetConverter::ConvertCharset($message, LANG_CHARSET, "utf-8");
}
$arParams = array_merge($this->GetDefParams(), array("oauth_token" => $this->token, "status" => $message));
$arParams["oauth_signature"] = urlencode($this->BuildSignature($this->GetSignatureString($arParams, $this::POST_URL)));
$arHeaders = array("Authorization" => 'OAuth oauth_consumer_key="' . $arParams["oauth_consumer_key"] . '", oauth_nonce="' . $arParams["oauth_nonce"] . '", oauth_signature="' . $arParams["oauth_signature"] . '", oauth_signature_method="HMAC-SHA1", oauth_timestamp="' . $arParams["oauth_timestamp"] . '", oauth_token="' . $this->token . '", oauth_version="1.0"');
$arPost = array("status" => $message);
$result = @CHTTP::sPostHeader($this::POST_URL, $arPost, $arHeaders, $this->httpTimeout);
if ($result !== false) {
if (!defined("BX_UTF")) {
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
}
return CUtil::JsObjectToPhp($result);
} else {
return false;
}
}
示例14: getNewAccessToken
public function getNewAccessToken($refreshToken = false, $userId = 0, $save = false, $scope = array())
{
if ($this->appID == false || $this->appSecret == false) {
return false;
}
if ($refreshToken == false) {
$refreshToken = $this->refresh_token;
}
if ($scope != null) {
$this->addScope($scope);
}
$http = new \Bitrix\Main\Web\HttpClient(array('socketTimeout' => $this->httpTimeout));
$result = $http->get(self::NET_URL . self::TOKEN_URL . '?' . http_build_query(array('client_id' => $this->appID, 'client_secret' => $this->appSecret, 'refresh_token' => $refreshToken, 'scope' => implode(',', $this->getScope()), 'grant_type' => 'refresh_token')));
$arResult = CUtil::JsObjectToPhp($result);
if (isset($arResult["access_token"]) && $arResult["access_token"] != '') {
$this->access_token = $arResult["access_token"];
$this->accessTokenExpires = time() + $arResult["expires_in"];
$this->refresh_token = $arResult["refresh_token"];
if ($save && intval($userId) > 0) {
$dbSocservUser = CSocServAuthDB::GetList(array(), array("USER_ID" => intval($userId), "EXTERNAL_AUTH_ID" => CSocServBitrix24Net::ID), false, false, array("ID"));
$arOauth = $dbSocservUser->Fetch();
if ($arOauth) {
CSocServAuthDB::Update($arOauth["ID"], array("OATOKEN" => $this->access_token, "OATOKEN_EXPIRES" => $this->accessTokenExpires, "REFRESH_TOKEN" => $this->refresh_token));
}
}
return true;
}
return false;
}
示例15: foreach
foreach ($_POST[$field][$name]["Options"] as $k => $v) {
$newarr[$GLOBALS["APPLICATION"]->ConvertCharset($k, "UTF-8", LANG_CHARSET)] = $v;
}
$_POST[$field][$name]["Options"] = $newarr;
}
}
}
} else {
$_POST[$field] = CUtil::JsObjectToPhp($_POST[$field]);
if (!is_array($_POST[$field])) {
$_POST[$field] = array();
}
}
}
if (!is_array($_POST['arWorkflowTemplate'])) {
$_POST['arWorkflowTemplate'] = CUtil::JsObjectToPhp($_POST['arWorkflowTemplate']);
}
$arWorkflowParameters = $_POST['arWorkflowParameters'];
$arWorkflowVariables = $_POST['arWorkflowVariables'];
$arWorkflowConstants = $_POST['arWorkflowConstants'];
try {
$canWrite = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::CreateWorkflow, $GLOBALS["USER"]->GetID(), array(MODULE_ID, ENTITY, $_POST['document_type']));
} catch (Exception $e) {
$canWrite = false;
}
if (!$canWrite || !check_bitrix_sessid()) {
ShowError(GetMessage("ACCESS_DENIED"));
die;
}
if ($_POST["save"] == "Y") {
$perms = array();