Skip to content

Instantly share code, notes, and snippets.

View ilyautkin's full-sized avatar

Ilya Utkin ilyautkin

View GitHub Profile
@ilyautkin
ilyautkin / .php
Last active September 10, 2015 10:49 — forked from core01/.php
modxplugin
<?php
if ($modx->event->name == 'OnDocFormSave') {
if ($mode == 'new') {
$sellUSD = $modx->stripTags($_POST['sellUSD']);
$buyUSD = $modx->stripTags($_POST['buyUSD']);
$exchange = array(
'sellUSD' => $sellUSD,
'buyUSD' => $buyUSD
);
// $prop["exchange"] = $exchange;
<?php
$input = (float) $input;
if ($options == '00') {
return number_format($input, 2, ',', ' ');
} else {
return number_format($input, 0, ',', ' ');
}
<?php
if (!$provider = $modx->getObject('transport.modTransportProvider', array('service_url:LIKE' => '%ilyaut.ru%'))) {
$provider = $modx->newObject('transport.modTransportProvider', array(
'name' => 'ilyaut.ru',
'service_url' => 'https://ilyaut.ru/extras/',
'username' => '',
'api_key' => '',
'description' => '',
'created' => time(),
));
<?php
$url = $_SERVER['REQUEST_URI'];
$sity = substr($url,0,5);
if (in_array($sity, array('/spb/','/msk/'))) {
$file = str_replace($sity,'/',$_SERVER['REQUEST_URI']);
if (file_exists($file)) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$type = finfo_file($finfo, $file);
finfo_close($finfo);
header('Content-Type: '.$type);
<?php
$notifications_email = '[email protected]';
$appid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$oauth_link = 'https://oauth.yandex.ru/verification_code#access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&token_type=bearer&expires_in=15552000';
switch($modx->event->name) {
case 'OnDocFormSave':
case 'OnDocPublished':
<?php
/** @var $modx modX */
if (!$modx = $object->xpdo AND !$object->xpdo instanceof modX) {
return true;
}
/** @var $options */
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
<?php
class SixtyCoder {
public $table = '0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ';
public function to60($number = 0) {
$number = (int) $number;
$output = '';
return $this->divide($number);
}
#!/bin/bash
wget -q https://ilyaut.ru/transfer/json.php -O json.php
to_login="`whoami`"
to_password="false"
status="`php json.php "checkConfigs" $to_login $to_password`"
while [[ "$status" == *check* ]]
do
<?php
@ini_set('display_errors', 1);
define('MODX_API_MODE', true);
require dirname(dirname(dirname(dirname(__FILE__)))) . '/index.php';
$modx->getService('error','error.modError');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
if ($modx->cacheManager->get('running', array('cache_key' => 'coverimport/export'))) {
@ilyautkin
ilyautkin / right.php
Created November 27, 2018 10:31
Calculation of the Hash Key
<?php
$HashKey = 'CC60B1B8445EA0B1759ECFB42E7DE2BF8A280247889F8BF38842045298C57556';
$TranTicket = '4236ece6142b4639925eb6f80217122f';
$PosId = '99999999';
$AcquirerId = '14';
$query= array(
'MerchantReference' => 'Test',
'ApprovalCode' => '389700',
'Parameters' => 'MyParam',