- Модуль: socialservices
- Путь к файлу: ~/bitrix/modules/socialservices/classes/general/twitter.php
- Класс: CTwitterInterface
- Вызов: CTwitterInterface::SearchByHash
public function SearchByHash($hash, $socServUserArray, $sinceId)
{
if(!defined("BX_UTF"))
$hash = CharsetConverter::ConvertCharset($hash, LANG_CHARSET, "utf-8");
$arParams = array_merge(array("count" => 100, "include_entities" => "false"), $this->GetDefParams());
$arParams = array_merge($arParams, array(
"oauth_token" => $this->token,
"q" => $hash,
"since_id" => $sinceId,
));
$arParams["oauth_signature"] = urlencode($this->BuildSignature($this->GetSignatureString($arParams, self::SEARCH_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"',
"Content-type" => "application/x-www-form-urlencoded",
);
$result = @CHTTP::sGetHeader(self::SEARCH_URL."?count=100&include_entities=false&q=".urlencode($hash)."&since_id=".$sinceId, $arHeaders, $this->httpTimeout);
if($result)
{
if(!defined("BX_UTF"))
$result = CharsetConverter::ConvertCharset($result, "utf-8", LANG_CHARSET);
$arResult = CUtil::JsObjectToPhp($result);
//if(isset($arResult["search_metadata"]["next_results"]))
// $arTwits = self::GetAllPages($arResult);
if(!empty($arTwits) && is_array($arTwits) && is_array($arResult["statuses"]))
$arResult["statuses"] = array_merge($arResult["statuses"], $arTwits);
if(is_array($arResult["statuses"]))
foreach($arResult["statuses"] as $key => $value)
{
if(!$find = array_search($value["user"]["id_str"], $socServUserArray[0]))
unset($arResult["statuses"][$key]);
else
{
$arResult["statuses"][$key]["kp_user_id"] = $find;
$arResult["statuses"][$key]["user_perms"] = self::GetUserPerms($value["user"]["id_str"]);
}
}
return $arResult;
}
return false;
}