first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
<?php
class stBackendActions extends stActions
{
public function executePreviewMode()
{
$token = stSecureToken::createDBToken();
return $this->redirect(stRoutingHelper::generateApplicationUrl('@homepage', 'frontend', null, [
'preview_mode' => $token,
]));
}
public function executeAdditionalApplicationsList()
{
$applications = array();
$routing = sfRouting::getInstance();
foreach (stConfiguration::getInstance()->getDesktopModules() as $modules)
{
foreach ($modules as $module)
{
// if (preg_match('/^app|sm/', $module->getName()))
{
$applications[$module->getRoute()] = $module;
}
}
}
foreach (stApplication::getDefaultDesktopApps() as $app => $name)
{
// if (preg_match('/^app|sm/', $app))
{
$module = new stBackendDesktopModule($routing, $app);
$applications[$module->getRoute()] = $module;
}
}
// Usuń powtarzajace sie aplikacje, zostaw w pierwszej kolejnosci odwolania do config
// np. jesli jest odwolania do Zamowień: order/list i order/config - to zostaw order/config
$app_config = array();
$applications_config = array();
foreach ($applications as $app_route => $app_object)
{
preg_match("/action=([a-zA-Z0-9]+)/", $app_route, $matches);
if (isset($matches[1]))
{
$app_action = $matches[1];
}
else
{
$app_action = "index";
}
$app_name = $app_object->getName();
// dopisz aplikację, jesli nie byla dodana lub jeśli byla dodana ale dodana akcja jst inna niz config
if ((empty($app_config[$app_name])) || ((!empty($app_config[$app_name])) && ($app_config[$app_name] != "config")))
{
if (empty($app_config[$app_name]))
{
// pomiń system punktowy (stary modul, ktory nie zostal usuniety i jest w kodzie, jest ukrywany tylko)
// opcja do poprawienia, wstawiona tymczasowo
if ($app_name != "stPointsBackend") $applications_config[$app_route] = $app_object;
}
$app_config[$app_name] = $app_action;
}
}
// $this->app_config=$app_config;
// end
$this->applications = $applications_config;;
uasort($this->applications, function ($m1, $m2)
{
return strnatcmp(strtolower($m1->getLabel()), strtolower($m2->getLabel()));
});
}
public function executeLicense()
{
$block = stCommunication::blockSite(10);
if (!$block)
{
stCommunication::refreshLicenseInformation();
stPartialCache::clear('stBackend', '_updateInfo', array('app' => 'backend'));
return $this->redirect($this->getRequest()->getReferer());
}
}
public function executeCheckService()
{
stCommunication::refreshLicenseInformation();
sfLoader::loadHelpers(array('Helper', 'stBackend'));
return $this->renderText(get_service_information());
}
public function executeUpdateInfoRefresh()
{
stCommunication::refreshLicenseInformation();
stPartialCache::clear('stBackend', '_updateInfo', array('app' => 'backend'));
return $this->renderText($this->getRenderComponent('stBackend', 'updateInfo'));
}
public function executeLicenseInfoRefresh()
{
stCommunication::refreshLicenseInformation();
stPartialCache::clear('stBackend', '_licenseInfo', array('app' => 'backend'));
return $this->renderText($this->getRenderComponent('stBackend', 'licenseInfo'));
}
public function executeChangeLeftMenuVisibility()
{
$config = stAdminGeneratorUserConfiguration::getDefault(sfContext::getInstance());
$config->setParameter('left_menu.hidden', $this->getRequestParameter('hidden', false));
$config->save();
}
public function executeChangeContentViewport()
{
$config = stAdminGeneratorUserConfiguration::getDefault(sfContext::getInstance());
$config->setParameter('viewport.expanded', $this->getRequestParameter('expanded', false));
$config->save();
return sfView::HEADER_ONLY;
}
}

View File

@@ -0,0 +1,78 @@
<?php
class stBackendComponents extends sfComponents {
public function executeMenu()
{
$this->inverted = false;
$navigationBarItems = sfConfig::get('app_navigation_bar_items');
$menu = new stNavigationMenu();
foreach (sfConfig::get('app_navigation_bar_display') as $id => $items)
{
if (!isset($navigationBarItems[$id]))
{
throw new Exception(sprintf('Item "%s" does not exist in navigation_bar.items', $id));
}
$navigationBarItem = $navigationBarItems[$id];
$item = $menu->addItem($id, $navigationBarItem['label'], isset($navigationBarItem['route']) ? $navigationBarItem['route'] : null, $navigationBarItem);
if ($items)
{
foreach (array_keys($items) as $childId)
{
if (!isset($navigationBarItems[$childId]))
{
throw new Exception(sprintf('Item "%s" does not exist in navigation_bar.items', $id));
}
$navigationBarItem = $navigationBarItems[$childId];
$item->addItem($childId, $navigationBarItem['label'], isset($navigationBarItem['route']) ? $navigationBarItem['route'] : null, $navigationBarItem);
}
}
}
$configItem = $menu->getItem('configuration');
foreach (stConfiguration::getGroups() as $name => $title)
{
if (stConfiguration::getInstance()->hasDesktopModules($name))
{
$configItem->addItem($name, $title, '@stConfigurationPlugin?group='.$name.'#'.$name, array(
'i18n' => 'stConfigurationBackend',
));
}
}
$this->items = $menu->getItems();
}
public function executeAbuseInformation() {
}
public function executeUpdateInfo()
{
$version = stCommunication::getCurrentVersion();
stLicenseAbuse::checkLicenseAbuseStatus();
$this->has_valid_license = stCommunication::hasValidLicense();
$this->update = version_compare(stRegisterSync::getPackageVersion('soteshop'), $version, '<');
}
public function executeLicenseInfo()
{
$info = stCommunication::getLicenseInfo();
$config = stConfig::getInstance('stRegister');
$this->change_subscription_url = stSoteHelper::getChangeSubscriptionUrl($this->getUser()->getCulture());
$this->config = $config;
$this->license_valid_until = $info['guarantee'];
}
}

View File

@@ -0,0 +1,12 @@
_updateInfo:
enabled: on
lifetime: 43200
_licenseInfo:
enabled: on
lifetime: 43200
additionalApplicationsList:
enabled: off
clientLifeTime: 0
lifeTime: 0

View File

@@ -0,0 +1,2 @@
license:
is_secure: off

View File

@@ -0,0 +1,18 @@
<?php if(stLicenseAbuse::isBlocked()):?>
<div id="abuse_information">
<span>
<?php echo __('Wystąpił błąd podczas weryfikacji licencji. Proszę o pilny kontakt z SOTE. Sklep może zostać zablokowany.');?>
<a href="<?php echo __('http://www.sote.pl/page/block');?>" target="_blank">
<?php echo __('Więcej informacji...');?>
</a>
</span>
</div>
<?php endif;?>
<script type="text/javascript">
jQuery(function($) {
$(document).ready(function() {
$.post('/update.php/communication/check');
});
});
</script>

View File

@@ -0,0 +1,41 @@
<?php
use_helper('stBackend');
/**
* @var stBackendDesktopModule[] $applications
*/
?>
<div class="application_shortcuts" style="position: relative;z-index: 10;">
<ul>
<?php
$check_file = sfConfig::get('sf_plugins_dir'). DIRECTORY_SEPARATOR. 'stIfirmaPlugin';
foreach ($applications as $application):
if (!$application->isValid())
{
continue;
}
if (in_array($application->getName(), array('stPointsBackend', 'stAddThisBackend')) && stTheme::hideOldConfiguration())
{
continue;
}
if ($application->getRoute()=='stInvoiceBackend/ifirmaConfig' && !file_exists($check_file))
{
continue;
}
$url = st_url_for($application->getRoute());
?>
<li>
<div class="icon" style="float: left;">
<a target="_parent" href="<?php echo $url ?>" style="background-image: url(<?php echo get_app_icon($application->getIcon()) ?>);"></a>
</div>
<div class="name">
<a target="_parent" href="<?php echo $url ?>"><?php echo $application->getLabel() ?></a>
</div>
</li>
<?php endforeach ?>
</ul>
<div class="clr"></div>
</div>

View File

@@ -0,0 +1,40 @@
<a class="with-icon" href="#">
<?php echo st_backend_get_icon('info', array('size' => 22)) ?>
<span><?php echo __('Informacje o licencji') ?></span>
</a>
<ul>
<li class="update-info-refresh"><div class="static"><a href="<?php echo st_url_for('stBackend/licenseInfoRefresh') ?>"><?php echo st_backend_get_icon('refresh', array('size' => 18)) ?></a></div></li>
<li class="preloader_26x26"></li>
<li>
<span class="static text-nowrap">
<?php echo __('Usługa', null, 'stBackendMain') ?>: <?php echo stCommunication::getSubscriptionLabel() ?><br>
<?php echo __("Usługa ważna do", null, 'stBackendMain') ?>: <b><?php echo $license_valid_until ?></b><br>
<?php echo __('Limit produktów', null, 'stBackendMain') ?>: <?php echo stLimits::getInstance()->getLimit() ?><br>
<?php echo __('Limit aktywnych importów', null, 'stBackendMain') ?>: <?php echo stTaskSchedulerImportLimit::getLimit() ?><br>
</span>
</li>
<li><a href="<?php echo $change_subscription_url ?>" target="_blank"><?php echo __($config->get('demo') ? 'Zamów pełną wersję sklepu' : 'Zmień usługę', null, 'stBackendMain') ?></a></li>
<li>
<span class="static text-nowrap"><?php echo __('Licencja', null, 'stBackendMain') ?>: <?php echo $config->get('license') ?></span>
</li>
</ul>
<script>
jQuery(function($) {
$(document).ready(function() {
$('#license-menu .update-info-refresh a').click(function() {
var link = $(this);
$('#license-menu .preloader_26x26').show();
$.get(link.attr('href'), function(response) {
$('#license-menu').html(response);
$('#license-menu .preloader_26x26').hide();
});
return false;
});
});
});
</script>

View File

@@ -0,0 +1,23 @@
<?php
use_helper('stBackend');
/**
* @var stNavigationMenuItem[] $items
*/
?>
<ul<?php if ($inverted): ?> class="inverted"<?php endif ?>>
<?php foreach ($items as $item): $children = $item->getItems() ?>
<li<?php if ($children): ?> class="expandable"<?php endif; ?>>
<?php if ($item->getUrl()): ?>
<a href="<?php echo st_url_for($item->getUrl()) ?>">
<?php if($item->getIcon()): ?><img src="<?php echo get_app_icon($item->getIcon()); ?>" alt="" /><?php endif; ?>
<span><?php echo __($item->getTitle(), null, $item->getI18n()) ?></span>
</a>
<?php else: ?>
<span><?php echo __($item->getTitle(), null, $item->getI18n()) ?></span>
<?php endif; ?>
<?php if ($children): ?>
<?php echo st_get_fast_partial('stBackend/menu', array('items' => $children, 'inverted' => !$inverted), true) ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>

View File

@@ -0,0 +1,72 @@
<div id="popup-info">
<div class="cd-popup" role="alert">
<div class="cd-popup-container">
<a href="#0" class="cd-popup-close"></a>
<img class="open-image-popup" src="/images/backend/icons/open-block.png" />
<h5 id="popup-info-title"></h5>
<p id="popup-info-desc"></p>
<div class="admin_actions" style="float: none;">
<input id="popup-info-button" type="button" value="" style="background-image: url(/images/backend/icons/open_add_to_cart.png)">
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(function($) {
$(document).ready(function() {
<?php if($isOpen):?>
$(document).on("click", "a", function(event) {
if($(this).attr('href').match(/.*product\/(import|export)/i)) {
event.preventDefault();
$('#popup-info-title').text('<?php echo __('Funkcja niedostępna dla wersji Open');?>');
$('#popup-info-desc').text('');
$('#popup-info-button').attr('onclick', "window.open('<?php echo __('http://www.sote.pl/licencja-soteshop.html');?>')");
$('#popup-info-button').attr('value', "<?php echo __('Zamów wersję komercyjną');?>");
$('.cd-popup-container').css('width', '450px');
$('.cd-popup').addClass('is-visible');
}
});
<?php endif;?>
<?php if($showProductAddInfo):?>
$("input[name='duplicate']").attr('onclick','').unbind('click');
$(document).on("click", "input[type='button'], input[type='submit']", function(event) {
if($(this).attr('name') == 'duplicate'<?php if (!$hasId):?> || $(this).attr('name') == 'save' || $(this).attr('name') == 'save_and_add' <?php endif;?>) {
event.preventDefault();
$('#popup-info-title').text('<?php echo __('Nie można dodać nowego produktu.');?>');
<?php if($isOpen):?>
$('#popup-info-desc').html('<?php echo __('Wykorzystano dostępny limit').' '.$sProductsLimit.' '.__('produktów dla wersji Open.<br/>Zamów wersję komercyjną i zwiększ automatycznie limit produktów do 10 000.');?>');
$('#popup-info-button').attr('onclick', "window.open('<?php echo __('http://www.sote.pl/licencja-soteshop.html');?>')");
$('#popup-info-button').attr('value', "<?php echo __('Zamów wersję komercyjną');?>");
<?php elseif($productsLimit == 100):?>
$('#popup-info-desc').html('<?php echo __('Wykorzystano dostępny limit').' '.$sProductsLimit.' '.__('produktów.<br/>Zwiększ liczbę produtków do 10 000.');?>');
$('#popup-info-button').attr('onclick', "window.open('<?php echo __('http://www.sote.pl/wynajem-aplikacji.html');?>')");
$('#popup-info-button').attr('value', "<?php echo __('Zmień wersję wynajmu programu');?>");
$('.cd-popup-container').css('width', '450px');
<?php else:?>
$('#popup-info-desc').html('<?php echo __('Wykorzystano dostępny limit').' '.$sProductsLimit.' '.__('produktów.<br/>Zwiększ liczbę produktów nawet do 30 000.');?>');
$('#popup-info-button').attr('onclick', "window.open('<?php echo __('http://www.sote.pl/zwiekszenie-ilosc-produktow.html');?>')");
$('#popup-info-button').attr('value', "<?php echo __('Zamów zwiększenie ilości produktów');?>");
$('.cd-popup-container').css('width', '450px');
<?php endif;?>
$('.cd-popup').addClass('is-visible');
}
});
<?php endif;?>
$('.cd-popup').on('click', function(event) {
if($(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup')) {
event.preventDefault();
$(this).removeClass('is-visible');
}
});
$(document).keyup(function(event) {
if(event.which == '27') {
$('.cd-popup').removeClass('is-visible');
}
});
});
});
</script>

View File

@@ -0,0 +1,56 @@
<a class="with-icon" href="#">
<?php echo st_backend_get_icon('refresh', array('size' => 22)) ?>
<span><?php echo __('Aktualizacja') ?></span>
<?php if ($update || !$has_valid_license || stLicenseAbuse::isBlocked()): ?>
<?php echo st_backend_get_icon('info') ?>
<?php endif ?>
</a>
<?php if ($update): ?>
<ul>
<li class="update-info-refresh"><div class="static"><a href="<?php echo st_url_for('stBackend/updateInfoRefresh') ?>"><?php echo st_backend_get_icon('refresh', array('size' => 18)) ?></a></div></li>
<li class="preloader_26x26"></li>
<li><span class="static"><?php echo __('Twój sklep jest nieaktualny') ?></span></li>
<li><span class="static update-info"><?php echo get_service_information() ?></span></li>
<?php if ($has_valid_license): ?>
<li><a href="/update.php" target="_blank"><?php echo __('Przejdź do aktualizacji') ?></a></li>
<?php endif ?>
<li>
<span class="static version"><?php echo get_backend_version_information() ?></span>
</li>
</ul>
<?php else: ?>
<ul>
<li class="update-info-refresh"><div class="static"><a href="<?php echo st_url_for('stBackend/updateInfoRefresh') ?>"><?php echo st_backend_get_icon('refresh', array('size' => 18)) ?></a></div></li>
<li class="preloader_26x26"></li>
<li><span class="static update-info"><?php echo get_service_information() ?></span></li>
<?php if ($has_valid_license): ?>
<li>
<a href="/update.php" target="_blank">
<span><?php echo __('Przejdź do aktualizacji') ?></span>
</a>
</li>
<?php endif ?>
<li>
<span class="static version"><?php echo get_backend_version_information() ?></span>
</li>
</ul>
<?php endif ?>
<script>
jQuery(function($) {
$(document).ready(function() {
$('#update-menu .update-info-refresh a').click(function() {
var link = $(this);
$('#update-menu .preloader_26x26').show();
$.get(link.attr('href'), function(response) {
$('#update-menu').html(response);
$('#update-menu .preloader_26x26').hide();
});
return false;
});
});
});
</script>

View File

@@ -0,0 +1,71 @@
<?php use_helper('stAdminGenerator') ?>
<?php use_helper('stBackend') ?>
<div id="list-all-apps" class="application_shortcuts bs-mt-4">
<div class="nav-all-apps">
<?php //strtoupper($firstLetter); ?>
<?php foreach ($applications as $application):
if (!$application->isValid())
{
continue;
}
$url = st_url_for($application->getRoute());
?>
<?php if($application->getName() != 'appProductAttributeBackend' && $application->getName() != 'appAdditionalDescBackend'): ?>
<?php
if (!isset($firstLetter) || strtolower($application->getLabel()) [0] != strtolower($firstLetter)){
echo '<a href="#letter'.$application->getLabel()[0].'">' . strtoupper($application->getLabel()[0]) . '</a>';
$firstLetter = strtolower($application->getLabel()[0]);
}
?>
<?php endif; ?>
<?php endforeach ?>
</div>
<?php $firstLetter = null; ?>
<ul class="list-all-icons clearfix">
<?php foreach ($applications as $application):
if (!$application->isValid())
{
continue;
}
$url = st_url_for($application->getRoute());
?>
<?php
if (!isset($firstLetter) || strtolower($application->getLabel()[0]) != strtolower($firstLetter)) {
echo '<li class="line" id="letter' . $application->getLabel()[0] . '"><span>' . strtoupper($application->getLabel()[0]) . '</span></li>';
$firstLetter = strtolower($application->getLabel()[0]);
}
?>
<li>
<div class="icon" style="float: left;">
<a target="_parent" href="<?php echo $url ?>" style="background-image: url(<?php echo get_app_icon($application->getIcon()) ?>);"></a>
</div>
<div class="name">
<a target="_parent" href="<?php echo $url ?>"><?php echo $application->getLabel() ?></a>
</div>
</li>
<?php endforeach ?>
</ul>
<?php if(count($applications) == 2): ?>
<div style="margin: 10px; min-height: 50px; border: 1px solid #ccc; padding: 10px;">
<p style="font-family: Helvetica,Arial,sans-serif; font-size: 12px; padding-top: 15px;"><?php echo __('Brak zainstalowanych dodatkowych aplikacji', null, 'stBackend') ?></p>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php echo st_get_admin_foot() ?>
<script type="text/javascript">
jQuery(function($) {
$(document).on('click', 'a[href^="#"]', function (event) {
event.preventDefault();
positionTop = $($.attr(this, 'href')).offset().top;
$('html, body').animate({
scrollTop: positionTop - 140
}, 500);
});
});
</script>

View File

@@ -0,0 +1 @@
<div id="block-site-info"><?php echo get_service_information() ?></div>