This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/sh | |
#SITEDIR=/domains/cremap.pro/images | |
SITEDIR=/domains/brcrm.brightrich.ru/upload/iblock | |
SITEUSER=www-data | |
BOPTI=`du -L -s ${SITEDIR} | awk '{print $1}'` | |
find -L ${SITEDIR} -type f -iname '*.jpg' \ | |
-exec jpegoptim -q --strip-all {} \; \ | |
-exec chown ${SITEUSER}:www-data {} \; \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$io = CBXVirtualIo::GetInstance(); - класс для работы с файлами публичной части, которые создаются пользователями или лежат в папках, создаваемых пользователями. | |
CTempFile - класс CTempFile для работы с временными файлами. | |
CTempFile ::GetFileName() возвращает имя, которое можно использовать для создания временного файла. | |
CTempFile::GetDirectoryName() возвращает временную папку. | |
CTempFile::GetAbsoluteRoot() - получить абсолютный путь до временной папки |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
foreach ($_POST['NEW_PHOTO_SIZE'] as $index=>$value) { | |
if(is_array($value)) | |
{ | |
$filePath = $value['tmp_name']; | |
} | |
else | |
{ | |
$filePath = $value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
if ($arResult['ARR_NAV']["NavPageNomer"] == 2) { | |
// $APPLICATION->SetPageProperty("robots", "noindex, follow"); | |
Bitrix\Main\Page\Asset::getInstance()->addString("<link rel='prev' href='https://{$_SERVER['SERVER_NAME']}{$arResult['LIST_PAGE_URL']}'>"); | |
} | |
elseif ($arResult['ARR_NAV']["NavPageNomer"] > 2) { | |
// $APPLICATION->SetPageProperty("robots", "noindex, follow"); | |
$prevPage = $arResult['ARR_NAV']["NavPageNomer"] - 1; | |
Bitrix\Main\Page\Asset::getInstance()->addString("<link rel='prev' href='https://{$_SERVER['SERVER_NAME']}{$arResult['LIST_PAGE_URL']}?PAGEN_{$arResult['ARR_NAV']["NavNum"]}={$prevPage}'>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
if ($_GET["PAGEN_" . $arResult['ARR_NAV']["NavNum"]] > 0 && $arResult['ARR_NAV']["NavPageNomer"] != $_GET["PAGEN_" . $arResult['ARR_NAV']["NavNum"]]) { | |
define('ERROR_404', 'Y'); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BinarySearch(t,A) // t - искомый элемент, | |
{ // A - упорядоченный массив, в котором ищем. | |
var i = 0, j = A.length, k; | |
while (i < j) | |
{ k = Math.floor((i+j)/2); | |
if (t <= A[k]) j = k; | |
else i = k+1; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
define("BASE_URL", "http://ws3.morpher.ru/russian/declension"); | |
function morphWord($resource, $method) { | |
$full_url = BASE_URL . "$resource"; | |
$options = array( | |
CURLOPT_URL => $full_url, | |
CURLOPT_HTTPHEADER => array('Content-Type: application/json', | |
'Accept: application/json'), | |
CURLOPT_CUSTOMREQUEST => $method, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$jsonItems = [ | |
'@context' => 'http://schema.org', | |
'@type' => 'BreadcrumbList', | |
'itemListElement' => [] | |
]; | |
$jsonItems['itemListElement'][] = [ | |
'@type' => 'ListItem', | |
'position' => $index + 1, | |
'item' => [ | |
'@id' => $link, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = \Bitrix\Main\Diag\Helper::getBackTrace($limit = 0, $options = null); | |
\Bitrix\Main\Diag\Debug::dumpToFile(array('ID' => $id, 'fields'=>$data ),"", "dumpClean.txt"); | |
Bitrix\Main\Diag\Debug::startTimeLabel("label1"); | |
Bitrix\Main\Diag\Debug::endTimeLabel("label1"); | |
Bitrix\Main\Diag\Debug::dump(Bitrix\Main\Diag\Debug::getTimeLabels()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define("BASE_URL", "http://ws3.morpher.ru/russian/declension"); | |
function api_request($resource, $method) { | |
$full_url = BASE_URL . "$resource"; | |
$options = array( | |
CURLOPT_URL => $full_url, | |
CURLOPT_HTTPHEADER => array('Content-Type: application/json', | |
'Accept: application/json'), | |
CURLOPT_CUSTOMREQUEST => $method, | |
CURLOPT_RETURNTRANSFER => true, |