This code allows you make preview-pictures for input without uploading this pictures on server. Detail info on english
This file contains hidden or 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
// Initialize | |
$context = Bitrix\Main\Context::getCurrent(); | |
$server = $context->getServer(); | |
$server_array = $server->toArray(); | |
// Скармливаем URL. Установить GET-параметры | |
$server_array['REQUEST_URI'] = $_SERVER['REQUEST_URI'] . $type . implode('&', $str); | |
$server->set($server_array); | |
$context->initialize(new Bitrix\Main\HttpRequest($server, array(), array(), array(), $_COOKIE), $context->getResponse(), $server); |
This file contains hidden or 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 (scandir(_FOLDER) as $xmlFile) { | |
if (!is_dir(_FOLDER . $xmlFile)) { | |
$xml = simplexml_load_file(_FOLDER . $xmlFile); | |
$array = json_decode(json_encode($xml), true); | |
} | |
} |
This file contains hidden or 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
$R = 6371; // Earth radius in km | |
$dLat = (($q[0] - $p[0]) * pi() / 180); | |
$dLon = (($q[1] - $p[1]) * pi() / 180); | |
$a = sin($dLat / 2) * sin($dLat / 2) + | |
cos($p[0] * pi() / 180) * cos($q[0] * pi() / 180) * | |
sin($dLon / 2) * sin($dLon / 2); | |
$c = 2 * atan2(sqrt($a), sqrt(1 - $a)); | |
return $R * $c; |
This file contains hidden or 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
<?php | |
// функция для безопасности строк | |
function safestr($str){ | |
$str = trim($str); | |
$str = stripslashes($str); | |
$str = htmlspecialchars($str); | |
return $str; | |
} | |
// проверка корректности полученных данных | |
function testFields($fields){ |
This file contains hidden or 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 prgrsbr($oneStep, $maxSteps){ | |
$percent = $oneStep / $maxSteps * 100; | |
$width = $percent * 10; // CSS property. 1% = 10px / 100% = 1000px | |
echo '<div style="width:1000px;height:40px;border:1px solid black;"><div style="width:'.$width.'px;height:40px;line-height:40px;background-color:green;text-align:center">'.$percent.'%</div></div>'; | |
} | |
$iMax = 10000; | |
for ($i = 1; $i <= $iMax; $i++) { | |
prgrsbr($i, $iMax); | |
} |
OlderNewer