public function appendIndexEntry($file) { if ($this->isExists()) { $fileUrlEnc = Converter::getXmlConverter()->encode($this->settings['PROTOCOL'] . '://' . \CBXPunycode::toASCII($this->settings['DOMAIN'], $e = null) . $this->getFileUrl($file)); $contents = $this->getContents(); $reg = "/" . sprintf(preg_quote(self::ENTRY_TPL, "/"), preg_quote($fileUrlEnc, "/"), "[^<]*") . "/"; $newEntry = sprintf(self::ENTRY_TPL, $fileUrlEnc, date(c, $file->getModificationTime($file))); $count = 0; $contents = preg_replace($reg, $newEntry, $contents, 1, $count); if ($count <= 0) { $contents = substr($contents, 0, -strlen(self::FILE_FOOTER)) . $newEntry . self::FILE_FOOTER; } $this->putContents($contents); } else { $this->createIndex(array($file)); } }
/** * Fetches one row of the query result and returns it in the associative array or false on empty data * * @param \Freetrix\Main\Text\Converter $converter Optional converter to encode data on fetching * @return array|bool */ public function fetch(\Freetrix\Main\Text\Converter $converter = null) { if ($this->trackerQuery != null) { $this->trackerQuery->restartQuery(); } $dataTmp = $this->fetchRowInternal(); if ($this->trackerQuery != null) { $this->trackerQuery->refinishQuery(); } if (!$dataTmp) { return false; } $resultFields = $this->getResultFields(); if ($resultFields !== null) { $data = array(); foreach ($dataTmp as $key => $value) { $data[$resultFields[$key]["name"]] = $this->convertDataFromDb($value, $resultFields[$key]["type"]); } } else { $data = $dataTmp; } if (!empty($this->arSerializedFields)) { foreach ($this->arSerializedFields as $field) { if (isset($data[$field])) { $data[$field] = unserialize($data[$field]); } } } if (!empty($this->arReplacedAliases)) { foreach ($this->arReplacedAliases as $tech => $human) { $data[$human] = $data[$tech]; unset($data[$tech]); } } if ($this->fetchDataModifier != null) { $c = $this->fetchDataModifier; $data = $c($data); } if ($converter != null) { foreach ($data as $key => $val) { $data[$key] = $converter->encode($val, isset($data[$key . "_TYPE"]) ? $data[$key . "_TYPE"] : \Freetrix\Main\Text\Converter::TEXT); } } return $data; }
echo Loc::getMessage('SEO_GOOGLE_GEOLOCATION'); ?> :</td> <td id="geolocation_row"> <div class="seo-view-field"> <span id="geolocation_view"><?php echo Converter::getHtmlConverter()->encode($arSiteInfo[$domain]['geolocation']); ?> </span> <span class="seo-edit-link" onclick="BX.addClass(this.parentNode.parentNode, 'seo-edit');"><?php echo Loc::getMessage('SEO_EDIT_FIELD_VALUE'); ?> </span> </div> <div class="seo-edit-field"><input type="text" style="width: 22px" value="<?php echo Converter::getHtmlConverter()->encode($arSiteInfo[$domain]['geolocation']); ?> " maxlength="2" id="geolocation_edit"><span class="seo-save-link"onclick="saveParam('geolocation')"><?php echo Loc::getMessage('SEO_EDIT_FIELD_VALUE_SAVE'); ?> </span><span class="seo-cancel-link" onclick="BX.removeClass(this.parentNode.parentNode, 'seo-edit')"><?php echo Loc::getMessage('SEO_EDIT_FIELD_VALUE_CANCEL'); ?> </span><span class="seo-loading-message"><?php echo Loc::getMessage('SEO_EDIT_FIELD_VALUE_LOADING'); ?> </span></div> </td> </tr> <tr> <td><?php
$adminList->AddHeaders($arHeaders); $adminList->NavText($data->GetNavPrint(Loc::getMessage("PAGES"))); while($sitemap = $data->NavNext()) { $id = intval($sitemap['ID']); $row = &$adminList->AddRow($sitemap["ID"], $sitemap, "seo_sitemap_edit.php?ID=".$sitemap["ID"]."&lang=".LANGUAGE_ID, Loc::getMessage("SITEMAP_EDIT_TITLE")); $row->AddViewField("ID", $sitemap['ID']); $row->AddViewField('TIMESTAMP_X', $sitemap['TIMESTAMP_X']); $row->AddViewField('DATE_RUN', $sitemap['DATE_RUN'] ? $sitemap['DATE_RUN'] : Loc::getMessage('SITEMAP_DATE_RUN_NEVER')); $row->AddViewField('SITE_ID', '<a href="site_edit.php?lang='.LANGUAGE_ID.'&LID='.$sitemap['SITE_ID'].'">['.$sitemap['SITE_ID'].'] '.$arSites[$sitemap['SITE_ID']]['NAME'].'</a>'); $row->AddField("NAME", '<a href="seo_sitemap_edit.php?ID='.$sitemap["ID"].'&lang='.LANGUAGE_ID.'" title="'.Loc::getMessage("SITEMAP_EDIT_TITLE").'">'.Converter::getHtmlConverter()->encode($sitemap['NAME']).'</a>'); $row->AddField("RUN", '<input type="button" class="adm-btn-save" value="'.Converter::getHtmlConverter()->encode(Loc::getMessage('SITEMAP_RUN')).'" onclick="generateSitemap('.$sitemap['ID'].')" name="save" id="sitemap_run_button_'.$sitemap['ID'].'" />'); //$row->AddInputField("NAME"); //$row->AddCheckField("ACTIVE"); $row->AddActions(array( array( "ICON" => "edit", "TEXT" => Loc::getMessage("SITEMAP_EDIT"), "ACTION" => $adminList->ActionRedirect("seo_sitemap_edit.php?ID=".$sitemap["ID"]."&lang=".LANGUAGE_ID), "DEFAULT" => true, ), array( "ICON" => "move", "TEXT" => Loc::getMessage("SITEMAP_RUN"), "ACTION" => 'generateSitemap('.$sitemap['ID'].');',
function seo_getIblock($iblockId, $sectionId, $sectionChecked, $elementChecked, $arSectionChecked = array(), $arElementChecked = array()) { $dbIblock = \CIBlock::GetByID($iblockId); $arIBlock = $dbIblock->Fetch(); if(is_array($arIBlock)) { $bSection = strlen($arIBlock['SECTION_PAGE_URL']) > 0; $bElement = strlen($arIBlock['DETAIL_PAGE_URL']) > 0; $dbRes = \CIBlockSection::GetList( array('SORT' => 'ASC', 'NAME' => 'ASC'), array( 'IBLOCK_ID' => $iblockId, 'SECTION_ID' => $sectionId, 'ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'Y' ) ); $bFound = false; while ($arRes = $dbRes->Fetch()) { $r = RandString(8); $d = $arRes['ID']; $bSectionChecked = $bSection && ($arSectionChecked[$d] === 'Y' || $sectionChecked && $arSectionChecked[$d] !== 'N'); $bElementChecked = $bElement && ($arElementChecked[$d] === 'Y' || $elementChecked && $arElementChecked[$d] !== 'N'); if(!$bFound) { $bFound = true; ?> <table class="internal" style="width: 100%;"> <tr class="heading"> <td colspan="2"><?php echo Loc::getMessage('SEO_SITEMAP_IBLOCK_SECTION_NAME'); ?> </td> <td width="100"><?php echo Loc::getMessage('SEO_SITEMAP_IBLOCK_SECTION_SECTION'); ?> </td> <td width="100"><?php echo Loc::getMessage('SEO_SITEMAP_IBLOCK_SECTION_ELEMENTS'); ?> </td> </tr> <? } ?> <tr> <td width="20"><span onclick="loadIblock(this, '<?php echo $arRes['IBLOCK_ID']; ?> ', '<?php echo $d; ?> ', '<?php echo $r; ?> ', BX('IBLOCK_SECTION_SECTION_<?php echo $d; ?> ').checked, BX('IBLOCK_SECTION_ELEMENT_<?php echo $d; ?> ').checked);" class="sitemap-tree-icon-iblock"></span></td> <td><a href="iblock_list_admin.php?lang=<?php echo LANGUAGE_ID; ?> &IBLOCK_ID=<?php echo $arRes['IBLOCK_ID']; ?> &find_section_section=<?php echo $d; ?> "><?php echo Converter::getHtmlConverter()->encode($arRes['NAME']); ?> </a></td> <td align="center"><input type="hidden" name="IBLOCK_SECTION_SECTION[<?php echo $iblockId; ?> ][<?php echo $d; ?> ]" value="N" /><input type="checkbox" name="IBLOCK_SECTION_SECTION[<?php echo $iblockId; ?> ][<?php echo $d; ?> ]" id="IBLOCK_SECTION_SECTION_<?php echo $d; ?> " value="Y"<?php echo $bSection ? '' : ' disabled="disabled"'; echo $bSectionChecked ? ' checked="checked"' : ''; ?> data-type="section" onclick="checkAllSection('<?php echo $r; ?> ', this.checked);" /> <label for="IBLOCK_SECTION_SECTION_<?php echo $d; ?> "><?php echo Loc::getMessage('MAIN_YES'); ?> </label></td> <td align="center"><input type="hidden" name="IBLOCK_SECTION_ELEMENT[<?php echo $iblockId; ?> ][<?php echo $d; ?> ]" value="N" /><input type="checkbox" name="IBLOCK_SECTION_ELEMENT[<?php echo $iblockId; ?> ][<?php echo $d; ?> ]" id="IBLOCK_SECTION_ELEMENT_<?php echo $d; ?> " value="Y"<?php echo $bElement ? '' : ' disabled="disabled"'; echo $bElementChecked ? ' checked="checked"' : ''; ?> data-type="element" onclick="checkAllElement('<?php echo $r; ?> ', this.checked);" /> <label for="IBLOCK_SECTION_ELEMENT_<?php echo $d; ?> "><?php echo Loc::getMessage('MAIN_YES'); ?> </label></td> </tr> <tr style="display: none" id="subdirs_row_<?php echo $r; ?> "> <td colspan="4" id="subdirs_<?php echo $r; ?> " align="center"></td> </tr> <? } if(!$bFound) { echo Loc::getMessage('SEO_SITEMAP_NO_DIRS_FOUND'); } } }
<? if($currentUser['picture']) { ?> <img src="<?php echo Converter::getHtmlConverter()->encode($currentUser['picture']); ?> " style="float: left; margin: 0 13px 0 0; max-width: 55px;" /> <? } ?> <a href="<?php echo Converter::getHtmlConverter()->encode($currentUser['profile']); ?> " target="_blank"><?php echo Converter::getHtmlConverter()->encode($currentUser['name']); ?> </a><br /><br /> <a href="javascript:void(0)" onclick="makeNewAuth()"><?php echo Loc::getMessage('SEO_AUTH_CANCEL'); ?> </a> <div style="clear: both;"></div> </div> </div> <? } ?> <script type="text/javascript">updateInfo();</script> <? }
public static function showProgress($text, $title, $v) { $v = $v >= 0 ? $v : 0; if ($v < 100) { $msg = new \CAdminMessage(array("TYPE" => "PROGRESS", "HTML" => true, "MESSAGE" => $title, "DETAILS" => "#PROGRESS_BAR#<div style=\"width: " . self::PROGRESS_WIDTH . "px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 20px;\">" . Converter::getHtmlConverter()->encode($text) . "</div>", "PROGRESS_TOTAL" => 100, "PROGRESS_VALUE" => $v, "PROGRESS_TEMPLATE" => '#PROGRESS_PERCENT#', "PROGRESS_WIDTH" => self::PROGRESS_WIDTH)); } else { $msg = new \CAdminMessage(array("TYPE" => "OK", "MESSAGE" => $title, "DETAILS" => $text)); } return $msg->show(); }
)); echo $msg->Show(); } else { ?> <div id="seo_original_text_form_form"> <form name="seo_original_text_form" style="padding:0;margin: 0;"> <b><?php echo Loc::getMessage('SEO_YANDEX_DOMAIN'); ?> : </b><select name="domain"> <? foreach($arDomains as $domain) { $domainEnc = Converter::getHtmlConverter()->encode($domain['DOMAIN']); ?> <option value="<?php echo $domainEnc; ?> "><?php echo $domainEnc; ?> </option> <? } ?> </select><br /><br /> <textarea style="width: 700px; height: 450px;" name="original_text"></textarea> </form> </div><div id="seo_original_text_form_ok" style="display: none;">
public function removeEntry($url) { $url = $this->settings['PROTOCOL'] . '://' . \CBXPunycode::toASCII($this->settings['DOMAIN'], $e = null) . $url; $pattern = sprintf(self::ENTRY_TPL_SEARCH, $url); while ($this->isExists()) { $c = $this->getContents(); $p = strpos($c, $pattern); if ($p !== false) { $fd = $this->open('r+'); fseek($fd, intval($p)); fwrite($fd, str_repeat(" ", strlen(sprintf(self::ENTRY_TPL, Converter::getXmlConverter()->encode($url), Converter::getXmlConverter()->encode(date('c')))))); fclose($fd); break; } if (!$this->isSplitNeeded()) { break; } else { $this->part++; $fileName = $this->partFile; $fileName = substr($fileName, 0, -strlen(self::FILE_EXT)) . self::FILE_PART_SUFFIX . $this->part . substr($fileName, -strlen(self::FILE_EXT)); $this->reInit($fileName); } } }
$aMenu = array(); $aMenu[] = array( "TEXT" => Loc::getMessage("SEO_DOMAIN_LIST"), "LINK" => "/freetrix/admin/seo_search_yandex.php?lang=".LANGUAGE_ID, "ICON" => "btn_list", ); $context = new CAdminContextMenu($aMenu); $context->Show(); $tabControl->Begin(); $tabControl->BeginNextTab(); $siteIdEnc = Converter::getHtmlConverter()->encode($arDomain['LID']); $siteNameEnc = Converter::getHtmlConverter()->encode($arDomain['SITE_NAME']); ?> <tr class="adm-detail-required-field"> <td width="40%"><?php echo Loc::getMessage('SEO_DOMAIN'); ?> :</td> <td width="60%"><?php echo $siteDomainEncView; ?> </td> </tr> <tr> <td><?php echo Loc::getMessage('SEO_SITE'); ?>
?></td> </tr> <? } $tabControl->BeginNextTab(); ?> <tr> <td colspan="2"> <b><?php echo $robotsFile->getPath(); ?> </b><br /><br /> <textarea style="width: 100%" rows="30" id="robots_text" name="ROBOTS[TEXT]"><?php echo Converter::getHtmlConverter()->encode($fileContent); ?> </textarea> </td> </tr> <tr> <td colspan="2"><?echo BeginNote().Loc::getMessage('SEO_ROBOTS_HINT'.(!$bVendor ? '' : '_1C')).EndNote(); ?></td> </tr> <? $tabControl->Buttons(array('btnApply' => false)); ?> <?php echo freetrix_sessid_post(); ?>
public function addSite($domain, $dir = '/') { $domain = ToLower($domain); if(!isset($this->arServiceList[self::HOSTS_SERVICE])) { $this->getServiceDocument(); } if(isset($this->arServiceList[self::HOSTS_SERVICE])) { $str = <<<EOT <host><name>%s</name></host> EOT; $queryResult = $this->query( $this->arServiceList[self::HOSTS_SERVICE], "POST", sprintf($str, Converter::getXmlConverter()->encode($domain)) ); if($queryResult->status == self::HTTP_STATUS_CREATED && strlen($queryResult->result) > 0) { return array($domain => true); } else { throw new Engine\YandexException($queryResult); } } }
public function addSite($domain, $dir = '/') { $str = <<<EOT <atom:entry xmlns:atom='http://www.w3.org/2005/Atom'><atom:content src="%s" /></atom:entry> EOT; $queryResult = $this->queryXml( self::SCOPE_BASE.self::SCOPE_FEED_SITES, "POST", sprintf($str, Converter::getXmlConverter()->encode(self::SCOPE_DOMAIN_PROTOCOL.$domain.$dir)) ); if($queryResult->status == self::HTTP_STATUS_CREATED && strlen($queryResult->result) > 0) { return $this->processResult($queryResult->result); } else { throw new \Exception('Query error! '.$queryResult->status.': '.$queryResult->result); } }