本文整理汇总了PHP中CHTTP::urnEncode方法的典型用法代码示例。如果您正苦于以下问题:PHP CHTTP::urnEncode方法的具体用法?PHP CHTTP::urnEncode怎么用?PHP CHTTP::urnEncode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHTTP
的用法示例。
在下文中一共展示了CHTTP::urnEncode方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRealPath
/**
* Returns script filename by URL
*
* @param string $site Site ID.
* @param string $url URL.
* @return string|null
*/
public static function getRealPath($site, $url)
{
$docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
$url = str_replace('\\', '/', $url);
$url = \CHTTP::urnEncode($url);
$uri = new Web\Uri($url);
$path = \CHTTP::urnDecode($uri->getPath());
if (substr($path, -1, 1) == '/') {
$path .= 'index.php';
}
$file = new IO\File($docRoot . $path);
if ($file->isExists()) {
return substr($file->getPath(), strlen($docRoot));
}
if ($rewriteRules = AdminHelper::getRewriteRules($site)) {
$pathQuery = \CHTTP::urnDecode($uri->getPathQuery());
foreach ($rewriteRules as &$item) {
if (preg_match($item['CONDITION'], $pathQuery)) {
$url = empty($item['PATH']) && !empty($item['RULE']) ? preg_replace($item['CONDITION'], $item['RULE'], $pathQuery) : $item['PATH'];
$url = \CHTTP::urnEncode($url);
$uri = new Web\Uri($url);
$path = \CHTTP::urnDecode($uri->getPath());
$file = new IO\File($docRoot . $path);
if ($file->isExists()) {
$pathTmp = str_replace('.', '', strtolower(ltrim($path, '/\\')));
$pathTmp7 = substr($pathTmp, 0, 7);
if ($pathTmp7 == 'upload/' || $pathTmp7 == 'bitrix/') {
continue;
}
if ($file->getExtension() != 'php') {
continue;
}
return substr($file->getPath(), strlen($docRoot));
}
}
}
}
return null;
}
示例2: foreach
}
if (!CHTTP::isPathTraversalUri($_SERVER["REQUEST_URI"])) {
foreach ($arUrlRewrite as $val) {
if (preg_match($val["CONDITION"], $requestUri)) {
if (strlen($val["RULE"]) > 0) {
$url = preg_replace($val["CONDITION"], (strlen($val["PATH"]) > 0 ? $val["PATH"] . "?" : "") . $val["RULE"], $requestUri);
} else {
$url = $val["PATH"];
}
if (($pos = strpos($url, "?")) !== false) {
$params = substr($url, $pos + 1);
parse_str($params, $vars);
unset($vars["SEF_APPLICATION_CUR_PAGE_URL"]);
$_GET += $vars;
$_REQUEST += $vars;
$_SERVER["QUERY_STRING"] = $QUERY_STRING = CHTTP::urnEncode($params);
$url = substr($url, 0, $pos);
}
$url = _normalizePath($url);
if (!$io->FileExists($_SERVER['DOCUMENT_ROOT'] . $url)) {
continue;
}
if (!$io->ValidatePathString($url)) {
continue;
}
$urlTmp = strtolower(ltrim($url, "/\\"));
$urlTmp = str_replace(".", "", $urlTmp);
$urlTmp7 = substr($urlTmp, 0, 7);
if ($urlTmp7 == "upload/" || $urlTmp7 == "bitrix/" && substr($urlTmp, 0, 16) != "bitrix/services/" && substr($urlTmp, 0, 18) != "bitrix/groupdavphp") {
continue;
}
示例3: IncludeModuleLangFile
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mail/prolog.php";
$MOD_RIGHT = $APPLICATION->GetGroupRight("mail");
if ($MOD_RIGHT < "R") {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mail/include.php";
$dbr = $DB->Query("SELECT * FROM b_mail_msg_attachment WHERE ID=" . intval($ID));
if ($dbr_arr = $dbr->Fetch()) {
$utfName = CHTTP::urnEncode($dbr_arr['FILE_NAME'], 'UTF-8');
$translitName = CUtil::translit($dbr_arr['FILE_NAME'], LANGUAGE_ID, array('max_len' => 1024, 'safe_chars' => '.', 'replace_space' => '-'));
header("Content-Type: application/force-download; name=\"" . $translitName . "\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $dbr_arr["FILE_SIZE"]);
header("Content-Disposition: attachment; filename=\"" . $translitName . "\"; filename*=utf-8''" . $utfName);
header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
if ($dbr_arr['FILE_ID']) {
if ($file = CFile::makeFileArray($dbr_arr['FILE_ID'])) {
readfile($file['tmp_name']);
}
} else {
echo $dbr_arr['FILE_DATA'];
}
die;
}
$APPLICATION->SetTitle(GetMessage("EDIT_MESSAGE_TITLE"));
示例4: intval
$strTmpOff.= "<price>".$minPrice."</price>\n";
$strTmpOff.= "<currencyId>".$minPriceCurrency."</currencyId>\n";
$strTmpOff.= $strTmpOff_tmp;
if (intval($arAcc["DETAIL_PICTURE"])>0 || intval($arAcc["PREVIEW_PICTURE"])>0)
{
$pictNo = intval($arAcc["DETAIL_PICTURE"]);
if ($pictNo<=0) $pictNo = intval($arAcc["PREVIEW_PICTURE"]);
$arPictInfo = CFile::GetFileArray($pictNo);
if (is_array($arPictInfo))
{
if(substr($arPictInfo["SRC"], 0, 1) == "/")
$strFile = "http://".$arAcc['SERVER_NAME'].CHTTP::urnEncode($arPictInfo["SRC"], 'utf-8');
else
$strFile = $arPictInfo["SRC"];
$strTmpOff.="<picture>".$strFile."</picture>\n";
}
}
$strTmpOff.= "<name>".yandex_text2xml($arAcc["~NAME"], true)."</name>\n";
$strTmpOff.=
"<description>".
yandex_text2xml(TruncateText(
($arAcc["PREVIEW_TEXT_TYPE"]=="html"?
strip_tags(preg_replace_callback("'&[^;]*;'", "yandex_replace_special", $arAcc["~PREVIEW_TEXT"])) : preg_replace_callback("'&[^;]*;'", "yandex_replace_special", $arAcc["~PREVIEW_TEXT"])),
255), true).
"</description>\n";
$strTmpOff.= "</offer>\n";
示例5: array
$lAdmin->AddHeaders(array(array("id" => "DOMAIN", "content" => Loc::getMessage('SEO_DOMAIN'), "sort" => "DOMAIN", "default" => true), array("id" => "SITE", "content" => Loc::getMessage("SEO_SITE"), "default" => true), array("id" => "SITE_ACTIVE", "content" => Loc::getMessage('SEO_SITE_ACTIVE'), "sort" => "active", "default" => true), array("id" => "BINDED", "content" => Loc::getMessage("SEO_BINDED"), "default" => true), array("id" => "VERIFIED", "content" => Loc::getMessage("SEO_VERIFIED"), "default" => true)));
$bNeedAuth = !$engine->getAuthSettings();
try {
$currentUser = $engine->getCurrentUser();
} catch (Exception $e) {
$currentUser = null;
$bNeedAuth = true;
}
$dbSites = new Bitrix\Main\DB\ArrayResult(\CSeoUtils::getDomainsList());
$rsData = new CAdminResult($dbSites, $sTableID);
while ($arSite = $dbSites->fetch(Converter::getHtmlConverter())) {
$row =& $lAdmin->AddRow($arSite['DOMAIN'], $arSite);
$siteDomainEnc = Converter::getHtmlConverter()->encode($arSite['DOMAIN']);
$siteDomainEncView = Converter::getHtmlConverter()->encode(\CBXPunycode::ToUnicode($arSite['DOMAIN'], $e = null));
$siteDirEnc = Converter::getHtmlConverter()->encode($arSite['SITE_DIR']);
$row->AddViewField("DOMAIN", '<a href="http://' . Converter::getHtmlConverter()->encode($arSite['DOMAIN'] . CHTTP::urnEncode($arSite['SITE_DIR'])) . '">' . $siteDomainEncView . $siteDirEnc . '</a>');
$row->AddViewField("SITE", '[<a href="site_edit.php?lang=' . LANGUAGE_ID . '&LID=' . urlencode($arSite['LID']) . '">' . $arSite['LID'] . '</a>] ' . $arSite['SITE_NAME']);
$row->AddCheckField("SITE_ACTIVE", false);
$row->AddViewField("BINDED", '<span data-role="site-binded" data-domain="' . $siteDomainEnc . '" data-dir="' . $siteDirEnc . '">' . ($bNeedAuth ? Loc::getMessage('SEO_NEED_AUTH') : Loc::getMessage('SEO_LOADING')) . '</span>');
$row->AddViewField("VERIFIED", '<span data-role="site-verified" data-domain="' . $siteDomainEnc . '" data-dir="' . $siteDirEnc . '">' . ($bNeedAuth ? Loc::getMessage('SEO_NEED_AUTH') : Loc::getMessage('SEO_LOADING')) . '</span>');
}
$lAdmin->CheckListMode();
$APPLICATION->SetTitle(Loc::getMessage("SEO_GOOGLE_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
if ($strError != '') {
CAdminMessage::ShowMessage($strError);
}
?>
<div id="ajax_status"></div>
<script type="text/javascript">
window.lastSeoResult = null;
示例6: array
$dbGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arGroupFilterMy, false, false, array('ID', 'GROUP_ID', 'GROUP_NAME', 'GROUP_SITE_ID'));
while ($arGroups = $dbGroups->GetNext()) {
$arGroupIDCurrentSite[] = $arGroups['GROUP_ID'];
if (in_array($arGroups['GROUP_ID'], $extGroupID)) {
continue;
}
$arSGGroup[] = array($arGroups["GROUP_NAME"], str_replace("#group_id#", $arGroups["GROUP_ID"], $strGroupSubjectLinkTemplate), array(), array("counter_id" => "SG" . $arGroups["GROUP_ID"]), "");
}
foreach ($arExtSGGroupTmp as $groupID => $arGroupItem) {
if (in_array($groupID, $arGroupIDCurrentSite)) {
$arExtSGGroup[] = $arGroupItem;
}
}
}
$CACHE_MANAGER->RegisterTag('sonet_group');
$CACHE_MANAGER->RegisterTag('USER_CARD_' . intval($USER_ID / TAGGED_user_card_size));
$CACHE_MANAGER->RegisterTag('sonet_user2group_U' . $USER_ID);
$CACHE_MANAGER->EndTagCache();
$arResult["GROUP_MENU"] = $arSGGroup;
$arResult["EXTRANET_MENU"] = $arExtSGGroup;
if ($obCache->StartDataCache()) {
$obCache->EndDataCache($arResult);
unset($arSGGroup, $arExtSGGroup);
}
}
if ($arResult["USER"]["AVATAR"]) {
$file = CHTTP::urnEncode($arResult["USER"]["AVATAR"]["src"], "UTF-8");
\Bitrix\Main\Data\AppCacheManifest::getInstance()->addFile($file);
}
unset($obCache);
$this->IncludeComponentTemplate();
示例7: str_replace
$arAcc['~DETAIL_PAGE_URL'] = str_replace(' ', '%20', $arAcc['~DETAIL_PAGE_URL']);
}
$strTmpOff .= "<offer id=\"" . $arAcc["ID"] . "\"" . $str_AVAILABLE . ">\n";
$strTmpOff .= "<url>" . $usedProtocol . $arAcc['SERVER_NAME'] . htmlspecialcharsbx($arAcc["~DETAIL_PAGE_URL"]) . (strstr($arAcc['DETAIL_PAGE_URL'], '?') === false ? '?' : '&') . "r1=<?echo \$strReferer1; ?>&r2=<?echo \$strReferer2; ?></url>\n";
$strTmpOff .= "<price>" . $minPrice . "</price>\n";
$strTmpOff .= "<currencyId>" . $minPriceCurrency . "</currencyId>\n";
$strTmpOff .= $strTmpOff_tmp;
if (intval($arAcc["DETAIL_PICTURE"]) > 0 || intval($arAcc["PREVIEW_PICTURE"]) > 0) {
$pictNo = intval($arAcc["DETAIL_PICTURE"]);
if ($pictNo <= 0) {
$pictNo = intval($arAcc["PREVIEW_PICTURE"]);
}
$arPictInfo = CFile::GetFileArray($pictNo);
if (is_array($arPictInfo)) {
if (substr($arPictInfo["SRC"], 0, 1) == "/") {
$strFile = $usedProtocol . $arAcc['SERVER_NAME'] . CHTTP::urnEncode($arPictInfo["SRC"], 'utf-8');
} else {
$strFile = $arPictInfo["SRC"];
}
$strTmpOff .= "<picture>" . $strFile . "</picture>\n";
}
}
$strTmpOff .= "<name>" . yandex_text2xml($arAcc["~NAME"], true) . "</name>\n";
$strTmpOff .= "<description>" . yandex_text2xml(TruncateText($arAcc["PREVIEW_TEXT_TYPE"] == "html" ? strip_tags(preg_replace_callback("'&[^;]*;'", "yandex_replace_special", $arAcc["~PREVIEW_TEXT"])) : preg_replace_callback("'&[^;]*;'", "yandex_replace_special", $arAcc["~PREVIEW_TEXT"]), 255), true) . "</description>\n";
$strTmpOff .= "</offer>\n";
if (100 <= $cnt) {
$cnt = 0;
CCatalogDiscount::ClearDiscountCache(array('PRODUCT' => true, 'SECTIONS' => true, 'PROPERTIES' => true));
}
}
if ($boolNeedRootSection) {
示例8: yandex_get_value
//.........这里部分代码省略.........
if (isset($intValue))
unset($intValue);
}
if (!empty($arCheckValue))
{
$dbRes = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $arProperty['LINK_IBLOCK_ID'], 'ID' => $arCheckValue), false, array('NAME'));
while ($arRes = $dbRes->Fetch())
{
$value .= ($value ? ', ' : '').$arRes['NAME'];
}
}
}
break;
case 'L':
if (!empty($arProperty['VALUE']))
{
if (is_array($arProperty['VALUE']))
$value .= implode(', ', $arProperty['VALUE']);
else
$value .= $arProperty['VALUE'];
}
break;
case 'F':
if (!empty($arProperty['VALUE']))
{
if (is_array($arProperty['VALUE']))
{
foreach ($arProperty['VALUE'] as &$intValue)
{
$intValue = (int)$intValue;
if ($intValue > 0)
{
if ($ar_file = CFile::GetFileArray($intValue))
{
if(substr($ar_file["SRC"], 0, 1) == "/")
$strFile = "http://".$iblockServerName.CHTTP::urnEncode($ar_file['SRC'], 'utf-8');
else
$strFile = $ar_file["SRC"];
$value .= ($value ? ', ' : '').$strFile;
}
}
}
if (isset($intValue))
unset($intValue);
}
else
{
$arProperty['VALUE'] = (int)$arProperty['VALUE'];
if ($arProperty['VALUE'] > 0)
{
if ($ar_file = CFile::GetFileArray($arProperty['VALUE']))
{
if(substr($ar_file["SRC"], 0, 1) == "/")
$strFile = "http://".$iblockServerName.CHTTP::urnEncode($ar_file['SRC'], 'utf-8');
else
$strFile = $ar_file["SRC"];
$value = $strFile;
}
}
}
}
break;
default:
if ($bParam && $arProperty['WITH_DESCRIPTION'] == 'Y')
{
$description = $arProperty['DESCRIPTION'];
$value = $arProperty['VALUE'];
}
else
{
$value = is_array($arProperty['VALUE']) ? implode(', ', $arProperty['VALUE']) : $arProperty['VALUE'];
}
}
// !!!! check multiple properties and properties like CML2_ATTRIBUTES
if ($bParam)
{
if (is_array($description))
{
foreach ($value as $key => $val)
{
$strProperty .= $strProperty ? "\n" : "";
$strProperty .= '<param name="'.yandex_text2xml($description[$key], true).'">'.yandex_text2xml($val, true).'</param>';
}
}
else
{
$strProperty .= '<param name="'.yandex_text2xml($arProperties[$PROPERTY]['NAME'], true).'">'.yandex_text2xml($value, true).'</param>';
}
}
else
{
$param_h = yandex_text2xml($param, true);
$strProperty .= '<'.$param_h.'>'.yandex_text2xml($value, true).'</'.$param_h.'>';
}
}
return $strProperty;
}
示例9: ViewByUser
//.........这里部分代码省略.........
$filetime = $tmpFile->getModificationTime();
} else {
$filetime = intval(MakeTimeStamp($arFile["TIMESTAMP_X"]));
}
if ($_SERVER["REQUEST_METHOD"] == "HEAD") {
CHTTP::SetStatus("200 OK");
header("Accept-Ranges: bytes");
header("Content-Type: " . $content_type);
header("Content-Length: " . ($size - $cur_pos + 1));
if ($filetime > 0) {
header("Last-Modified: " . date("r", $filetime));
}
} else {
$lastModified = '';
if ($cache_time > 0) {
//Handle ETag
$ETag = md5($filename . $filesize . $filetime);
if (array_key_exists("HTTP_IF_NONE_MATCH", $_SERVER) && $_SERVER['HTTP_IF_NONE_MATCH'] === $ETag) {
CHTTP::SetStatus("304 Not Modified");
header("Cache-Control: private, max-age=" . $cache_time . ", pre-check=" . $cache_time);
die;
}
header("ETag: " . $ETag);
//Handle Last Modified
if ($filetime > 0) {
$lastModified = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';
if (array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] === $lastModified) {
CHTTP::SetStatus("304 Not Modified");
header("Cache-Control: private, max-age=" . $cache_time . ", pre-check=" . $cache_time);
die;
}
}
}
$utfName = CHTTP::urnEncode($attachment_name, "UTF-8");
$translitName = CUtil::translit($attachment_name, LANGUAGE_ID, array("max_len" => 1024, "safe_chars" => ".", "replace_space" => '-'));
if ($force_download) {
//Disable zlib for old versions of php <= 5.3.0
//it has broken Content-Length handling
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}
if ($cur_pos > 0) {
CHTTP::SetStatus("206 Partial Content");
} else {
CHTTP::SetStatus("200 OK");
}
header("Content-Type: " . $content_type);
header("Content-Disposition: attachment; filename=\"" . $translitName . "\"; filename*=utf-8''" . $utfName);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . ($size - $cur_pos + 1));
if (is_resource($src)) {
header("Accept-Ranges: bytes");
header("Content-Range: bytes " . $cur_pos . "-" . $size . "/" . $filesize);
}
} else {
header("Content-Type: " . $content_type);
header("Content-Disposition: inline; filename=\"" . $translitName . "\"; filename*=utf-8''" . $utfName);
}
if ($cache_time > 0) {
header("Cache-Control: private, max-age=" . $cache_time . ", pre-check=" . $cache_time);
if ($filetime > 0) {
header('Last-Modified: ' . $lastModified);
}
} else {
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
}
示例10: DisplayFile
private static function DisplayFile($arFile = array(), $ind = 0)
{
$hintId = self::$jsId . '_file_disp_' . $ind;
$bNotFound = $arFile['FILE_NOT_FOUND'];
// Hint
$hint = '';
if (!$bNotFound) {
$sImagePath = isset($arFile["PATH"]) ? $arFile["PATH"] : $arFile["SRC"];
$descName = isset($arFile['DESC_NAME']) ? $arFile['DESC_NAME'] : self::$descInputName;
if ($arFile['FORMATED_SIZE'] != '') {
$hint .= '<span class="adm-input-file-hint-row">' . GetMessage('ADM_FILE_INFO_SIZE') . ': ' . $arFile['FORMATED_SIZE'] . '</span>';
}
if ($arFile['IS_IMAGE']) {
$hint .= '<span class="adm-input-file-hint-row">' . GetMessage('ADM_FILE_INFO_DIM') . ': ' . $arFile['WIDTH'] . 'x' . $arFile['HEIGHT'] . '</span>';
}
if ($sImagePath != '') {
$hint .= '<span class="adm-input-file-hint-row">' . GetMessage('ADM_FILE_INFO_LINK') . ': <a href="' . CHTTP::urnEncode($sImagePath, "UTF-8") . '">' . $sImagePath . '</a></span>';
}
if (!self::$bShowDescInput && $arFile['DESCRIPTION'] != "") {
$hint .= '<span class="adm-input-file-hint-row">' . GetMessage('ADM_FILE_DESCRIPTION') . ': ' . htmlspecialcharsbx($arFile['DESCRIPTION']) . '</span>';
}
}
?>
<span class="adm-input-file-exist-cont" id="<?php
echo self::$jsId;
?>
_file_cont_<?php
echo $ind;
?>
">
<div class="adm-input-file-ex-wrap<?php
if (self::$bMultiple) {
echo ' adm-input-cont-bordered';
}
?>
">
<?php
if ($bNotFound) {
?>
<span id="<?php
echo self::$jsId . '_file_404_' . $ind;
?>
" class="adm-input-file-not-found">
<?php
echo GetMessage('ADM_FILE_NOT_FOUND');
?>
</span>
<?php
} elseif ($arFile['IS_IMAGE']) {
$file = CFile::ResizeImageGet($arFile['ID'], array('width' => self::$maxPreviewWidth, 'height' => self::$maxPreviewHeight), BX_RESIZE_IMAGE_PROPORTIONAL, true);
?>
<span id="<?php
echo $hintId;
?>
" class="adm-input-file-preview" style="<?php
if (self::$minPreviewWidth > 0) {
echo 'min-width: ' . self::$minPreviewWidth . 'px;';
}
?>
<?php
if (self::$minPreviewHeight > 0) {
echo 'min-height:' . self::$minPreviewHeight . 'px;';
}
?>
">
<?php
echo CFile::Show2Images($file['src'], $arFile['SRC'], self::$maxPreviewWidth, self::$maxPreviewHeight);
?>
<div id="<?php
echo self::$jsId . '_file_del_lbl_' . $ind;
?>
" class="adm-input-file-del-lbl"><?php
echo GetMessage('ADM_FILE_DELETED_TITLE');
?>
</div>
</span>
<?php
} else {
$val = !empty($arFile['FILE_NAME']) ? $arFile['FILE_NAME'] : $sImagePath;
?>
<a id="<?php
echo $hintId;
?>
" href="<?php
echo htmlspecialcharsbx($arFile['SRC']);
?>
" class="adm-input-file-name"><?php
echo htmlspecialcharsbx($val);
?>
</a>
<?php
}
if ($hint != '') {
?>
<script type="text/javascript">
new top.BX.CHint({
parent: top.BX("<?php
echo $hintId;
?>
"),
//.........这里部分代码省略.........
示例11: getDataForXml
function getDataForXml()
{
CModule::IncludeModule("iblock");
CModule::IncludeModule('catalog');
$filter["ACTIVE"] = "Y";
$filter["ACTIVE_DATE"] = "Y";
$filter["IBLOCK_ID"] = 2;//goodies
$rsItems = CIBlockElement::GetList(array(), $filter, false, false, array());
$strOfferGoogle = '';
while ($obItem = $rsItems->GetNextElement()) {
$arItem = $obItem->GetFields();
if (CModule::IncludeModule("catalog") && CCatalog::GetByID($arItem['IBLOCK_ID'])) {
$arItem = $obItem->GetFields();
$productId = $arItem['ID'];
$rsPrices = CPrice::GetByID($productId);
$arItem['PROPERTIES'] = $obItem->GetProperties();
$strFile = '';
$arItem["DETAIL_PICTURE"] = (int)$arItem["DETAIL_PICTURE"];
$arItem["PREVIEW_PICTURE"] = (int)$arItem["PREVIEW_PICTURE"];
if ($arItem["DETAIL_PICTURE"] > 0 || $arItem["PREVIEW_PICTURE"] > 0) {
$pictNo = ($arItem["DETAIL_PICTURE"] > 0 ? $arItem["DETAIL_PICTURE"] : $arItem["PREVIEW_PICTURE"]);
if ($ar_file = CFile::GetFileArray($pictNo)) {
if (substr($ar_file["SRC"], 0, 1) == "/")
$strFile = "http://" . $_SERVER['SERVER_NAME'] . CHTTP::urnEncode($ar_file['SRC'], 'utf-8');
else
$strFile = $ar_file["SRC"];
}
}
$arItem['google_PICT'] = $strFile;
if (!empty($arItem["DETAIL_TEXT"]))
$arItem['google_DESCR'] = google_text2xml(strip_tags(stristr($arItem["DETAIL_TEXT"], '.', true)));
else
$arItem['google_DESCR'] = google_text2xml(strip_tags($arItem["NAME"]));
$strOfferGoogle .= "<item>\n";
$strOfferGoogle .= "<title>";
$strOfferGoogle .= $arItem['NAME'];
$strOfferGoogle .= "</title>\n";
$strOfferGoogle .= "<link>";
$strOfferGoogle .= "http://".$_SERVER['SERVER_NAME'].$arItem['DETAIL_PAGE_URL'];
$strOfferGoogle .= "</link>\n";
$strOfferGoogle .= "<description>";
$strOfferGoogle .= $arItem['google_DESCR'];
$strOfferGoogle .= "</description>\n";
$strOfferGoogle .= "<g:image_link>";
$strOfferGoogle .= $strFile;
$strOfferGoogle .= "</g:image_link>\n";
$strOfferGoogle .= "<g:price>";
$strOfferGoogle .= $rsPrices['PRICE'];
$strOfferGoogle .= "</g:price>\n";
$strOfferGoogle .= "<g:condition>";
$strOfferGoogle .= "новый";
$strOfferGoogle .= "</g:condition>\n";
$strOfferGoogle .= "<g:id>";
$strOfferGoogle .= $arItem['CODE'];
$strOfferGoogle .= "</g:id>\n";
$strOfferGoogle .= "</item>\n";
//etc etc
}
else
{
continue;
}
}
writeData($strOfferGoogle);
}
示例12: WDUFUserFieldView
//.........这里部分代码省略.........
if ($name == GetMessage('SONET_GROUP_PREFIX')) {
$arGroup = CSocNetGroup::GetByID($res["SOCNET_GROUP_ID"]);
$name = GetMessage("SONET_GROUP_PREFIX") . $arGroup['NAME'];
}
}
//drop prefix storage name (1st level in section tree) if user or groups file. If shared docs - don't
if ($i != 0 || !$isSocnet) {
$arUrlSectionsChain[] = $name;
}
if ($name != $DROPPED) {
$arSectionsChain[] = $name;
$i++;
}
if ($name == $DROPPED || $name == $OLD_DROPPED) {
//disable local edit if file id .Dropped
$arWDFile['IN_PERSONAL_LIB'] = false;
}
}
if ($arSectionsChain[$i] == $DROPPED) {
$arWDFile['NAVCHAIN'] = GetMessage('WDUF_ATTACHED_TO_MESSAGE');
} else {
if ($userIBlockID && $groupIBlockID) {
if ($arWDFile['IBLOCK_ID'] != $userIBlockID['id'] && $arWDFile['IBLOCK_ID'] != $groupIBlockID['id']) {
$name = CIBlock::GetArrayByID($arWDFile['IBLOCK_ID'], 'NAME');
array_unshift($arSectionsChain, $name);
}
}
$arWDFile['NAVCHAIN'] = implode("/", $arSectionsChain);
}
$arUrlSectionsChain[] = $arWDFile["NAME"];
$arWDFile['VIEW'] .= implode('/', $arUrlSectionsChain);
//non urnencoded
$arWDFile['RELATIVE_PATH'] = $arWDFile['VIEW'];
$arWDFile['VIEW'] = CHTTP::urnEncode($arWDFile['VIEW']);
// extension
$name = $arWDFile['NAME'];
$ext = '';
$dotpos = strrpos($name, ".");
if ($dotpos !== false && $dotpos + 1 < strlen($name)) {
$ext = substr($name, $dotpos + 1);
}
if (strlen($ext) < 3 || strlen($ext) > 5) {
$ext = '';
}
$arWDFile['EXTENSION'] = $ext;
// size
$arWDFile['SIZE'] = 0;
if ($arWDFile['PROPERTY_WEBDAV_SIZE_VALUE']) {
$arWDFile['SIZE'] = CFile::FormatSize(intval($arWDFile['PROPERTY_WEBDAV_SIZE_VALUE']), 0);
}
// file
$arWDFile['FILE'] = array();
if ($arWDFile['PROPERTY_FILE_VALUE']) {
$arWDFile['FILE'] = CFile::GetFileArray($arWDFile['PROPERTY_FILE_VALUE']);
}
if ($isHistoryDocInComment) {
$arWDFile['PATH'] = $arWDFile['PATH'] . "?toWDController=1&ncc=1&downloadHistory=1&id={$arWDFile['ID']}&v={$versionHistoryDocInComment}&f={$arWDFile['FILE']['ID']}";
$arWDFile['THROUGH_VERSION'] = empty($throughVersionComment) ? -1 : $throughVersionComment;
} else {
$arWDFile['THROUGH_VERSION'] = (int) $arWDFile['PROPERTY_' . CWebDavIblock::PROPERTY_VERSION . '_VALUE'];
}
if (strlen($arWDFile['PATH']) > 0) {
$arWDFile['PATH'] = CHTTP::urnEncode($arWDFile['PATH']);
$result[$id] = $arWDFile;
}
}