first commit

This commit is contained in:
2024-11-11 18:46:54 +01:00
commit a630d17338
25634 changed files with 4923715 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
/**
* 2014-2020 Presta-Mod.pl Rafał Zontek
*
* NOTICE OF LICENSE
*
* Poniższy kod jest kodem płatnym, rozpowszechanie bez pisemnej zgody autora zabronione
* Moduł można zakupić na stronie Presta-Mod.pl. Modyfikacja kodu jest zabroniona,
* wszelkie modyfikacje powodują utratę gwarancji
*
* http://presta-mod.pl
*
* DISCLAIMER
*
*
* @author Presta-Mod.pl Rafał Zontek <biuro@presta-mod.pl>
* @copyright 2014-2020 Presta-Mod.pl
* @license Licecnja na jedną domenę
* Presta-Mod.pl Rafał Zontek
*/
include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../images.inc.php');
include_once(dirname(__FILE__).'/regenerateimage.php');
$RI = new RegenerateImage();
$RI->ajaxCall();

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>regenerateimage</name>
<displayName><![CDATA[Generowanie obrazk&oacute;w produkt&oacute;w]]></displayName>
<version><![CDATA[1.1.1]]></version>
<description><![CDATA[Generowanie obrazk&oacute;w produkt&oacute;w]]></description>
<author><![CDATA[Presta-Mod.pl]]></author>
<tab><![CDATA[administration]]></tab>
<confirmUninstall><![CDATA[Are you sure you want to uninstall my module?]]></confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,28 @@
<?php
/**
* 2014-2020 Presta-Mod.pl Rafał Zontek
*
* NOTICE OF LICENSE
*
* Poniższy kod jest kodem płatnym, rozpowszechanie bez pisemnej zgody autora zabronione
* Moduł można zakupić na stronie Presta-Mod.pl. Modyfikacja kodu jest zabroniona,
* wszelkie modyfikacje powodują utratę gwarancji
*
* http://presta-mod.pl
*
* DISCLAIMER
*
*
* @author Presta-Mod.pl Rafał Zontek <biuro@presta-mod.pl>
* @copyright 2014-2020 Presta-Mod.pl
* @license Licecnja na jedną domenę
* Presta-Mod.pl Rafał Zontek
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1 @@
38dc69d7c1249179d9f8f094a4ead375phhfykswf

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -0,0 +1,157 @@
<?php
/**
* 2014-2020 Presta-Mod.pl Rafał Zontek
*
* NOTICE OF LICENSE
*
* Poniższy kod jest kodem płatnym, rozpowszechanie bez pisemnej zgody autora zabronione
* Moduł można zakupić na stronie Presta-Mod.pl. Modyfikacja kodu jest zabroniona,
* wszelkie modyfikacje powodują utratę gwarancji
*
* http://presta-mod.pl
*
* DISCLAIMER
*
*
* @author Presta-Mod.pl Rafał Zontek <biuro@presta-mod.pl>
* @copyright 2014-2020 Presta-Mod.pl
* @license Licecnja na jedną domenę
* Presta-Mod.pl Rafał Zontek
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class regenerateimage extends Module
{
public function __construct()
{
$this->need_instance = 0;
$this->bootstrap = true;
$this->name = 'regenerateimage';
$this->tab = 'administration';
$this->version = '1.1.1';
$this->author = 'Presta-Mod.pl';
$this->module_key = '';
$this->images_types = ImageType::getImagesTypes('products');
$this->legacy_images = Configuration::get('PS_LEGACY_IMAGES');
$this->displayName = $this->l('Generowanie obrazków produktów');
$this->description = $this->l('Generowanie obrazków produktów');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall my module?');
parent::__construct();
}
public function install()
{
parent::install();
return true;
}
public function uninstall()
{
parent::uninstall();
return true;
}
private function getStatus()
{
$s = 0;
if (file_exists(dirname(__FILE__).'/status.txt')) {
$s = (int)file_get_contents(dirname(__FILE__).'/status.txt');
}
return $s;
}
public function getContent()
{
$status = 0;
$status = $this->getStatus();
$useSSL = Configuration::get('PS_SSL_ENABLED');
$protocol_content = ($useSSL) ? 'https://' : 'http://';
$content_dir = $protocol_content.Tools::getHttpHost().__PS_BASE_URI__;
$this->context->smarty->assign('status', $status);
$this->context->smarty->assign('all', $this->getAll());
$this->context->smarty->assign('base_dir', $content_dir);
return $this->context->smarty->fetch(dirname(__FILE__).'/templates/views/admin/config.tpl');
}
public function ajaxCall()
{
if (Tools::isSubmit('get_status')) {
echo $this->getStatus();
die();
} elseif (Tools::isSubmit('reset_status')) {
$this->resetStatus();
die();
} elseif (Tools::isSubmit('progress')) {
$this->progress();
die();
}
}
public function resetStatus()
{
if (file_exists(dirname(__FILE__).'/status.txt')) {
unlink(dirname(__FILE__).'/status.txt');
}
}
public function getAll()
{
$sql = 'SELECT count(*) AS pall FROM '._DB_PREFIX_.'image';
$images_all = Db::getInstance()->getRow($sql);
return $images_all['pall'];
}
public function progress()
{
$status = $this->getStatus();
$sql = 'SELECT * FROM '._DB_PREFIX_.'image limit '.$status.',2';
$sqlcurrent = Db::getInstance()->executeS($sql);
$sql = 'SELECT count(*) AS pall FROM '._DB_PREFIX_.'image';
$images_all = Db::getInstance()->getRow($sql);
foreach ($sqlcurrent as $current) {
$st = ++$status;
if ($status > $images_all['pall']) {
echo '-1aaaaaaaaaaaaaaaaaaaaaaaaaaaa';
file_put_contents(dirname(__FILE__).'/status.txt', 0);
return '-1';
}
file_put_contents(dirname(__FILE__).'/status.txt', $st);
$img = new Image($current['id_image']);
echo $this->l('Generowanie obrazka dla produktu o id: ');
echo $current['id_product'].'[';
echo $current['id_image'].']';
echo ''.PHP_EOL;
$file_name = ($this->legacy_images == 1 ? $product_id.'-'.$img->id.'.jpg' : ($img->createImgFolder() ? $img->getImgPath().'.jpg' : $product_id.'-'.$img->id.'.jpg'));
$file_name = _PS_PROD_IMG_DIR_.$file_name;
if ($new_path = $img->getPathForCreation()) {
foreach ($this->images_types as $image_type) {
ImageManager::resize(
$file_name,
$new_path.'-'.Tools::stripslashes($image_type['name']).'.jpg',
$image_type['width'],
$image_type['height'],
'jpg'
);
}
Hook::exec(
'actionWatermark',
array('id_image' => $current['id_image'], 'id_product' => $current['id_product'])
);
}
}
if ($status >= $images_all['pall']) {
file_put_contents(dirname(__FILE__).'/status.txt', 0);
echo PHP_EOL.'-1';
die();
}
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* 2014-2020 Presta-Mod.pl Rafał Zontek
*
* NOTICE OF LICENSE
*
* Poniższy kod jest kodem płatnym, rozpowszechanie bez pisemnej zgody autora zabronione
* Moduł można zakupić na stronie Presta-Mod.pl. Modyfikacja kodu jest zabroniona,
* wszelkie modyfikacje powodują utratę gwarancji
*
* http://presta-mod.pl
*
* DISCLAIMER
*
*
* @author Presta-Mod.pl Rafał Zontek <biuro@presta-mod.pl>
* @copyright 2014-2020 Presta-Mod.pl
* @license Licecnja na jedną domenę
* Presta-Mod.pl Rafał Zontek
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,93 @@
{**
* 2014-2020 Presta-Mod.pl Rafał Zontek
*
* NOTICE OF LICENSE
*
* Poniższy kod jest kodem płatnym, rozpowszechanie bez pisemnej zgody autora zabronione
* Moduł można zakupić na stronie Presta-Mod.pl. Modyfikacja kodu jest zabroniona,
* wszelkie modyfikacje powodują utratę gwarancji
*
* http://presta-mod.pl
*
* DISCLAIMER
*
*
* @author Presta-Mod.pl Rafał Zontek <biuro@presta-mod.pl>
* @copyright 2014-2020 Presta-Mod.pl
* @license Licecnja na jedną domenę
* Presta-Mod.pl Rafał Zontek
*}
<div class="panel">
<fieldset>
<legend>{l s='Generowanie miniatur' mod='regenerateimage'}</legend>
<form action="" method="post">
<textarea class="dialog" rows="10" disabled="disabled"></textarea>
</form>
{l s='Status: ' mod='regenerateimage'}<strong><div class="status">{$status|escape:'htmlall':'UTF-8'}</div> / {$all}</strong> <br/>
<button class="btn btn-default reset_status">{l s='Resetuj status' mod='exportxml'}</button><br/>
<button class="btn btn-default start_update">{l s='Aktualizacja' mod='exportxml'}</button><br/>
</fieldset>
</div>
<script type="text/javascript">
$(document).ready(function(){
var s = null;
var refreshStatus = null;
function startRefreshStatus() {
refreshStatus = setInterval(function(){
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: '{$base_dir}modules/regenerateimage/ajax.php?get_status&rand=' + new Date().getTime(),
async: true,
cache: false,
data: 'ajax_blockcart_display=expand',
success: function(f) {
$('.status').html(f);
}
});
},500);
}
function resetStatus() {
if (s == null) {
stopUpdate();
}
$.ajax('{$base_dir}modules/regenerateimage/ajax.php?reset_status');
return false;
}
function startUpdate() {
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: '{$base_dir}modules/regenerateimage/ajax.php?progress&rand=' + new Date().getTime(),
async: true,
cache: false,
data: 'ajax_blockcart_display=expand',
success: function(f) {
if (f.indexOf('-1') == -1) {
$('.dialog').prepend(f);
startUpdate();
}
}
});
}
function stopUpdate() {
return false;
}
$('.reset_status').click(resetStatus);
startRefreshStatus();
$('.start_update').click(function(){
$('.dialog').html('');
startUpdate();
});
})
</script>

View File

@@ -0,0 +1,28 @@
<?php
/**
* 2014-2020 Presta-Mod.pl Rafał Zontek
*
* NOTICE OF LICENSE
*
* Poniższy kod jest kodem płatnym, rozpowszechanie bez pisemnej zgody autora zabronione
* Moduł można zakupić na stronie Presta-Mod.pl. Modyfikacja kodu jest zabroniona,
* wszelkie modyfikacje powodują utratę gwarancji
*
* http://presta-mod.pl
*
* DISCLAIMER
*
*
* @author Presta-Mod.pl Rafał Zontek <biuro@presta-mod.pl>
* @copyright 2014-2020 Presta-Mod.pl
* @license Licecnja na jedną domenę
* Presta-Mod.pl Rafał Zontek
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,28 @@
<?php
/**
* 2014-2020 Presta-Mod.pl Rafał Zontek
*
* NOTICE OF LICENSE
*
* Poniższy kod jest kodem płatnym, rozpowszechanie bez pisemnej zgody autora zabronione
* Moduł można zakupić na stronie Presta-Mod.pl. Modyfikacja kodu jest zabroniona,
* wszelkie modyfikacje powodują utratę gwarancji
*
* http://presta-mod.pl
*
* DISCLAIMER
*
*
* @author Presta-Mod.pl Rafał Zontek <biuro@presta-mod.pl>
* @copyright 2014-2020 Presta-Mod.pl
* @license Licecnja na jedną domenę
* Presta-Mod.pl Rafał Zontek
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;