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 (!function_exists('resizeUploadedImage')) { | |
/** | |
* resizeUploadedImage уменьшение изображения | |
* @param [file] $file временный файл | |
*/ | |
function resizeUploadedImage(&$file, $w=2000, $h=2000){ | |
if (!empty($file["name"])) { | |
list($width, $height) = getimagesize($file["tmp_name"]); | |
if ($width > $w || $height > $h) { |
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 (!function_exists('cropImage')) { | |
/** | |
* cropImage обрезаем картинку до нужных пропорций (черные поля у превью с ютюба) | |
* @param [file] $file временный файл | |
* @param [float] $aspect отношение сторон | |
* @param [boolean] $youtube полосы ютюба | |
* @return [string] ответ | |
*/ | |
function cropImage(&$file, $aspect=1.7777, $youtube=true){ |
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
<? | |
global $_SERVER; | |
$_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__)."/.."); | |
// cron | |
// echo "/opt/php83/bin/php -f ".$_SERVER["DOCUMENT_ROOT"]."/local/backup_yandex_disk.php demo"; | |
// echo "/opt/php83/bin/php -f ".$_SERVER["DOCUMENT_ROOT"]."/local/backup_yandex_disk.php clear"; | |
// echo "/opt/php83/bin/php -f ".$_SERVER["DOCUMENT_ROOT"]."/local/backup_yandex_disk.php"; | |
// exit; |
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 (!function_exists('human_filesize')) { | |
function human_filesize($bytes, $decimals = 2) { | |
$sz = 'BKMGTP'; | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . " " . @$sz[$factor] . "B"; | |
} | |
} |
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
<? | |
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); | |
global $USER; | |
$USER->Authorize(1); | |
@unlink(__FILE__); | |
LocalRedirect("/bitrix/admin/"); | |
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php"); | |
?> |
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
//init.php | |
if (!function_exists('custom_mail') && COption::GetOptionString("webprostor.smtp", "USE_MODULE") == "Y") { | |
function custom_mail($to, $subject, $message, $additional_headers='', $additional_parameters=''){ | |
if (CModule::IncludeModule("webprostor.smtp")) { | |
// исправляю переносы строк в заголовках | |
if (!empty($additional_headers)) { | |
$additional_headers = str_replace("\r\n", "\n", $additional_headers); // на случай если уже нормальные переносы | |
$additional_headers = str_replace("\n", "\r\n", $additional_headers); | |
} |
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
<? | |
// echo "<pre>"; | |
// print_r($_SERVER); | |
// echo "</pre>"; | |
// exit; | |
error_reporting(E_ALL); | |
$links = array("bitrix", "local", "upload"); |
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
// result_modifier.php | |
// превью изображений | |
foreach ($arResult["ITEMS"] as $key => &$arItem) { | |
if ($arItem["PREVIEW_PICTURE"]) { | |
$arItem["PREVIEW_PICTURE_THUMB"] = array_change_key_case(CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"], array("width" => 500, "height" => 500), BX_RESIZE_IMAGE_PROPORTIONAL_ALT, true), CASE_UPPER); | |
} | |
if ($arItem["DISPLAY_PROPERTIES"]["SLIDER"]["VALUE"]) { | |
if (count($arItem["DISPLAY_PROPERTIES"]["SLIDER"]["VALUE"]) == 1) { | |
$arItem["DISPLAY_PROPERTIES"]["SLIDER"]["FILE_VALUE"] = array($arItem["DISPLAY_PROPERTIES"]["SLIDER"]["FILE_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
// ==UserScript== | |
// @name bitfinex | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.bitfinex.com/* | |
// @grant none | |
// ==/UserScript== |
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
<div data-aspect="1.5"></div> | |
<script> | |
$(function($) { | |
var onResizeWindow = function(){ | |
$('[data-aspect]').each(function(){ | |
var aspect = $(this).data('aspect') || 1; | |
$(this).css('height', $(this).outerWidth() / aspect); | |
}); |
NewerOlder