This commit is contained in:
2025-07-03 20:56:08 +02:00
parent c5c208aa43
commit cc0c9e86b8
190 changed files with 21992 additions and 61 deletions

View File

View File

@@ -0,0 +1,27 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_0_11($object, $install = false)
{
$ret = (bool)Db::getInstance()->execute('
ALTER TABLE `' . _DB_PREFIX_ . 'anblog_blog`
ADD (`products` text);
');
return $ret;
}

View File

@@ -0,0 +1,27 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_0_2($object, $install = false)
{
$ret = (bool)Db::getInstance()->execute('
ALTER TABLE `' . _DB_PREFIX_ . 'anblogcat`
ADD (`groups` text);
');
return $ret;
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_0_5($object, $install = false)
{
$ret = (bool)Db::getInstance()->execute('
ALTER TABLE `' . _DB_PREFIX_ . 'anblogcat_lang`
ADD (`meta_title` text);
');
$ret &= (bool)Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'anblog_blog_categories` (
`id_anblog_blog` int(11) NOT NULL DEFAULT \'0\',
`id_anblogcat` int(11) NOT NULL DEFAULT \'0\',
`position` int(11) NOT NULL DEFAULT \'0\',
PRIMARY KEY (`id_anblog_blog`,`id_anblogcat`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
');
return $ret;
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_2_0($object)
{
$tabs = [
[
'class_name' => 'AdminAnblogSettings',
'parent' => 'AdminAnblogManagement',
'name' => 'Settings',
'active' => 1
],
];
$languages = Language::getLanguages();
foreach ($tabs as $tab) {
$_tab = new Tab();
$_tab->active = $tab['active'];
$_tab->class_name = $tab['class_name'];
$_tab->id_parent = Tab::getIdFromClassName($tab['parent']);
if (empty($_tab->id_parent)) {
$_tab->id_parent = 0;
}
$_tab->module = 'anblog';
foreach ($languages as $language) {
$_tab->name[$language['id_lang']] = $tab['name'];
}
$_tab->add();
}
$id_tab = Tab::getIdFromClassName('AdminAnblogDashboard');
if ($id_tab != 0) {
$tab = new Tab($id_tab);
$tab->delete();
}
return true;
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_3_0($object)
{
$object->registerHook('gSitemapAppendUrls');
return true;
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_3_9($object)
{
$tabs = [
[
'class_name' => 'AdminAnblogWidgets',
'parent' => 'AdminAnblogManagement',
'name' => 'Widgets',
'active' => 1
],
];
$languages = Language::getLanguages();
foreach ($tabs as $tab) {
$_tab = new Tab();
$_tab->active = $tab['active'];
$_tab->class_name = $tab['class_name'];
$_tab->id_parent = Tab::getIdFromClassName($tab['parent']);
if (empty($_tab->id_parent)) {
$_tab->id_parent = 0;
}
$_tab->module = 'anblog';
foreach ($languages as $language) {
$_tab->name[$language['id_lang']] = $tab['name'];
}
$_tab->add();
}
$sql = [];
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'anblog_blog_widgets` (
`id_anblog_blog_widgets` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_anblogcat` int(11) NOT NULL,
`snow_on` int(11) NOT NULL,
`sort` varchar(150) NOT NULL,
`slider` tinyint(1) unsigned NOT NULL DEFAULT 1,
`limit` int(11) NOT NULL,
PRIMARY KEY(`id_anblog_blog_widgets`)
) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET = utf8;';
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'anblog_blog_widgets_lang` (
`id_anblog_blog_widgets` int(10) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
`id_lang` varchar(255) NOT NULL,
PRIMARY KEY(`id_anblog_blog_widgets`, `id_lang`)
) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET = utf8;';
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'anblog_blog_widgets_shop` (
`id_anblog_blog_widgets` int(11) NOT NULL DEFAULT 0,
`id_shop` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id_anblog_blog_widgets`,`id_shop`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
$return = true;
foreach ($sql as $_sql) {
$return = Db::getInstance()->Execute($_sql);
if (!$return){
return false;
}
}
return true;
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_0($object)
{
$sql[] = '
ALTER TABLE `'._DB_PREFIX_.'anblog_blog` ADD COLUMN `likes` int(11) NOT NULL;
';
$sql[] = '
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'anblog_likes` (
`id_like` int(11) NOT NULL AUTO_INCREMENT,
`id_customer_guest` int(11) NOT NULL,
`id_post` int(11) NOT NULL,
`id_shop` int(11) NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_like`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
';
$return = true;
foreach ($sql as $_sql) {
$return = Db::getInstance()->Execute($_sql);
if (!$return){
return false;
}
}
return true;
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_1($object)
{
$sql[] = '
ALTER TABLE `'._DB_PREFIX_.'anblog_blog_widgets` ADD COLUMN `relation` int(10) NOT NULL;
';
$sql[] = '
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'anblog_blog_widgets_relations` (
`id_relation` int(11) NOT NULL AUTO_INCREMENT,
`type` tinyint(1) unsigned NOT NULL DEFAULT 0,
`id_anblog_blog_widgets` int(11) NOT NULL,
`id_type` int(11) NOT NULL,
PRIMARY KEY (`id_relation`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;
';
$return = true;
foreach ($sql as $_sql) {
$return = Db::getInstance()->Execute($_sql);
if (!$return){
return false;
}
}
return true;
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_10($object)
{
@unlink(_PS_MODULE_DIR_ . 'anblog/views/templates/admin/anblog_blogs/helpers/form/prerender.tpl');
@unlink(_PS_MODULE_DIR_ . 'anblog/views/templates/admin/prerender/megamenu.tpl');
@unlink(_PS_MODULE_DIR_ . 'anblog/classes/AnblogOwlCarousel.php');
@unlink(_PS_MODULE_DIR_ . 'anblog/controllers/admin/AdminAnblogDashboard.php');
return true;
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_11($object)
{
@unlink(_PS_MODULE_DIR_ . 'anblog/views/templates/admin/list_action_view.tpl');
@unlink(_PS_MODULE_DIR_ . 'anblog/views/templates/admin/list-img.tpl');
@unlink(_PS_MODULE_DIR_ . 'anblog/views/templates/admin/anblog_settings/panel.tpl');
@unlink(_PS_MODULE_DIR_ . 'anblog/views/templates/admin/anblog_settings/helpers/sitemap.tpl');
@unlink(_PS_MODULE_DIR_ . 'anblog/controllers/admin/AdminAnblogModule.php');
return true;
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_12($object)
{
Tools::deleteDirectory(_PS_MODULE_DIR_ . 'anblog/views/img/admin/');
return true;
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_13($object)
{
if (
Configuration::get('an_bl_show_in_DisplayHome') && (
$object->isRegisteredInHook('displayHomeAfter') ||
$object->isRegisteredInHook('displayBlogWidget') ||
$object->isRegisteredInHook('displayHome')
)){
$widgetObj = new anBlogWidgets();
$widgetObj->id_anblogcat = (int) Configuration::get('an_bl_categories_DisplayHome_blog');
$widgetObj->sort = 'new';
$widgetObj->slider = 0;
$widgetObj->limit = (int) Configuration::get('an_bl_limit_DisplayHome_blog');
$widgetObj->relation = 0;
if ($object->isRegisteredInHook('displayHomeAfter')){
$widgetObj->snow_on = 4;
} elseif ($object->isRegisteredInHook('displayBlogWidget')){
$widgetObj->snow_on = 5;
} else {
$widgetObj->snow_on = 1;
}
$languages = Language::getLanguages();
foreach ($languages as $language) {
$widgetObj->title[$language['id_lang']] = 'Blog';
}
$widgetObj->save();
Db::getInstance()->insert('anblog_blog_widgets_shop', [
'id_anblog_blog_widgets' => (int) $widgetObj->id,
'id_shop' => (int) Context::getContext()->shop->id
]);
anBlogWidgets::exportJsonWidgets(new anBlogContentTheme());
}
return true;
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_14($object)
{
$object->registerHook('displayHome');
$object->registerHook('displayHomeAfter');
$object->registerHook('displayBlogWidget');
@unlink(_PS_MODULE_DIR_ . 'anblog/logo.gif');
return true;
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_2($object)
{
$object->registerHook('displayFooterProduct');
$object->registerHook('displayContentWrapperBottom');
return true;
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_3($object)
{
$tabs = [
[
'class_name' => 'AdminAnblogAjax',
'parent' => 'AdminAnblogManagement',
'name' => 'Ajax',
'active' => 0
],
];
$languages = Language::getLanguages();
foreach ($tabs as $tab) {
$_tab = new Tab();
$_tab->active = $tab['active'];
$_tab->class_name = $tab['class_name'];
$_tab->id_parent = Tab::getIdFromClassName($tab['parent']);
if (empty($_tab->id_parent)) {
$_tab->id_parent = 0;
}
$_tab->module = 'anblog';
foreach ($languages as $language) {
$_tab->name[$language['id_lang']] = $tab['name'];
}
$_tab->add();
}
return true;
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_4($object)
{
$sql[] = '
ALTER TABLE `'._DB_PREFIX_.'anblog_blog_lang` CHANGE `content` `content` LONGTEXT NOT NULL;
';
$return = true;
foreach ($sql as $_sql) {
$return = Db::getInstance()->Execute($_sql);
if (!$return){
return false;
}
}
return true;
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_5($object)
{
$position = Tab::getIdFromClassName('AdminAnblogManagement');
$id_tab = Tab::getIdFromClassName('AdminAnblogAjax');
$tab = new Tab($id_tab);
$tab->id_parent = (int) $position;
$tab->save();
return true;
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_6($object)
{
$position = Tab::getIdFromClassName('AdminAnblogManagement');
$id_tab = Tab::getIdFromClassName('AdminAnblogAjax');
$tab = new Tab($id_tab);
$tab->id_parent = (int) $position;
$tab->save();
return true;
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* 2024 Anvanto
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
*
* @author Anvanto <anvantoco@gmail.com>
* @copyright 2024 Anvanto
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_3_4_7($object)
{
$id_tab = Tab::getIdFromClassName('AdminAnblogAjax');
$tab = new Tab($id_tab);
$tab->active = 0;
$tab->save();
return true;
}