prokat/api/modules/tovar_show/tk-ligat.ru.php
2025-06-16 18:28:08 +05:00

118 lines
3.5 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
//print_r($res['tovar']['cena']);
if ($res['massiv']['partner'] == 'samson' && !$res['tovar']['images']) {
modClass::getImgSamson($_GET['id'], $res['tovar']['code']);
}
$lostupdate=$res['tovar']['uppricetime'];
$srok=time()-$lostupdate;
if ($res['massiv']['partner'] == 'samson' && $srok>259200) {
modClass::updPriceSamson($res['tovar']['code'], $res['tovar']['cena']);
\DBmysql::set("UPDATE `tovar` SET `uppricetime`=? WHERE `id`=? LIMIT 1", [time(), $_GET['id']]);
}
if ($res['massiv']['partner'] == 'deznet' && $res['massiv']['donor']) require_once 'api/modules/tovar_show/parce_diznet.php';
/*
ini_set('display_errors', 0);
/* Проверяем картинки
$massiv= \core::j($res['tovar']['json']);
/* будем считать что это новый товар с самсона
if (!$massiv['partner']){
$massiv['partner']='samson';
\DBmysql::set("UPDATE `tovar` SET `json` = ? WHERE `id`=? LIMIT 1", [\core::j($massiv), $res['tovar']['id']]);
}
if ($res['massiv']['partner'] == 'samson') {
if (!$res['massiv']['barcode'] || !$res['massiv']['brand']) modClass::getInfoSamson($res['tovar']['code']);
//1) проверялка картинок
$imgInBD = \DBmysql::getAll(
"SELECT `filename` FROM `img` WHERE `content_id`=? AND `content_type`=? AND `site`=?",
[
$_GET['id'],
'tovar',
$_SERVER['SERVER_NAME']
]
);
if ($imgInBD) {
$c = count($imgInBD);
for ($i = 0; $i < $c; $i++) {
if (!file_exists('img/tk-ligat.ru/tovar/' . $res['tovar']['id'] . '/' . $imgInBD[$i]['filename'] . '.jpg')) \DBmysql::set("DELETE FROM `img` WHERE `content_id`=? AND `filename`=?", [$res['tovar']['id'], $imgInBD[$i]['filename']]);
}
} else {
require_once 'api/modules/tovar_show/getimgsamson.php';
}
}
if ($res['tovar']['partner'] == 'leader' && $_SESSION['dostup'] == 'a') {
$fm = \DB::getAll(
"SELECT * FROM `img` WHERE `content_id`=? AND `content_type`=? AND `site`=?",
array(
$res['tovar']['id'],
'tovar',
$_SERVER['SERVER_NAME']
)
);
if (!$fm) {
mkdir('img/' . $_SERVER['SERVER_NAME'] . '/tovar/' . $res['tovar']['id'], 0777);
$filename = \core::genpassword(30);
exec("wget " . $res['tovar']['linkimg'] . " -O img/tk-ligat.ru/tovar/" . $res['tovar']['id'] . '/' . $filename . ".jpg");
if (file_exists("img/tk-ligat.ru/tovar/" . $res['tovar']['id'] . '/' . $filename . ".jpg")) {
\DB::add(
"INSERT INTO `img` (`content_id`, `content_type`, `site`, `filename`) VALUES (?, ?, ?, ?)",
array(
$res['tovar']['id'],
'tovar',
$_SERVER['SERVER_NAME'],
$filename
)
);
} else {
\DB::set(
"DELETE FROM `img` WHERE `content_id`=? AND `content_type`=? AND `site`=?",
array(
$res['tovar']['id'],
'tovar',
$_SERVER['SERVER_NAME']
)
);
}
}
}
function ekr($text)
{ // ФУНКЦИЯ очистки кода
$old1 = array(" ");#Ищем вредное ">",, "<"
$new1 = array("");#Меняем на полезное"&gt;", , "&lt;"
$text = str_replace($old1, $new1, $text);#Собсно сама замена =)
return $text;
}
*/
?>