| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/new-saint-martin/administrator/components/com_pagebuilderck/ |
Upload File : |
<?php
/**
* @name Page Builder CK
* @package com_pagebuilderck
* @copyright Copyright (C) 2015. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr
*/
defined('_JEXEC') or die('Restricted access');
/*
preflight which is executed before install and update
install
update
uninstall
postflight which is executed after install and update
*/
class com_pagebuilderckInstallerScript {
function install($parent) {
}
function update($parent) {
}
/*
* get a variable from the manifest file (actually, from the manifest cache).
*/
function getParam( $name ) {
$db = \Joomla\CMS\Factory::getDbo();
$db->setQuery('SELECT manifest_cache FROM #__extensions WHERE element = "com_pagebuilderck"');
$manifest = json_decode( $db->loadResult(), true );
return $manifest[ $name ];
}
/*
* update the table
*/
function updateTable($version) {
$sqlsrc = dirname(__FILE__).'/administrator/sql/updates/' . $version . '.sql';
$query = file_get_contents($sqlsrc);
$db = \Joomla\CMS\Factory::getDbo();
$db->setQuery($query);
if (!$db->execute()) {
echo '<p class="alert alert-danger">Error during table update for version ' . $version . '</p>';
} else {
echo '<p class="alert alert-success">Table successfully updated for version ' . $version . '</p>';
}
}
/*
* update the table
*/
function updateTableFieldCategory() {
$db = \Joomla\CMS\Factory::getDbo();
// test for order column title depending on virtuemart version
// test if the columns not exists
$query = "SHOW COLUMNS FROM #__pagebuilderck_pages LIKE 'categories'";
$db->setQuery($query);
try {
if ($db->execute()) {
if ( $db->loadResult()) {
//echo 'existe deja!';return;
} else {
// add the SQL field to the main table
$db->setQuery('ALTER TABLE `#__pagebuilderck_pages` ADD `categories` varchar(255) NOT NULL;');
if (!$db->execute()) {
echo '<p class="alert alert-danger">Error during table pagebuilderck_pages/categories update process !</p>';
} else {
echo '<p class="alert alert-success">Table pagebuilderck_pages/categories updated !</p>';
}
}
} else {
echo 'Erreur de données SQL - Test si champ pagebuilderck_pages/categories existe';
return false;
}
} catch (Exception $e) {
echo 'Problem during sql update : ', $e->getMessage(), "\n";
}
}
function uninstall($parent) {
// jimport('joomla.installer.installer');
// Latest Module
// Check first that the module exist
/*$db->setQuery('SELECT `extension_id` FROM #__extensions WHERE `element` = "mod_test" AND `type` = "module"');
$id = $db->loadResult();
if($id)
{
$installer = new \Joomla\CMS\Installer\Installer;
$result = $installer->uninstall('module',$id,1);
}*/
// disable all plugins and modules
// module
$db = \Joomla\CMS\Factory::getDbo();
$db->setQuery("UPDATE `#__modules` SET `published` = 0 WHERE `module` LIKE '%pagebuilderck%'");
$db->execute();
// system, editor button, search plugins
$db->setQuery("UPDATE `#__extensions` SET `enabled` = 0 WHERE `type` = 'plugin' AND `element` LIKE '%pagebuilderck%' AND `folder` NOT LIKE '%pagebuilderck%'");
$db->execute();
return true;
}
function preflight($type, $parent) {
// disable the install on Joomla 3 after 3.1.0
if (version_compare(JVERSION, '4') === -1) {
throw new RuntimeException('This version of Page Builder CK can not be installed on Joomla 3. Please use the version 3.1.0.');
}
return true;
}
// run on install and update
function postflight($type, $parent) {
$db = \Joomla\CMS\Factory::getDbo();
$tablesList = $db->getTableList();
// test if the table not exists
$tableExists = in_array($db->getPrefix() . 'pagebuilderck_elements', $tablesList);
if (! $tableExists) {
$this->updateTable('2.2.0');
}
$tableCategoriesExists = in_array($db->getPrefix() . 'pagebuilderck_categories', $tablesList);
if (! $tableCategoriesExists) {
$this->updateTable('2.14.0');
}
$tableStylesExists = in_array($db->getPrefix() . 'pagebuilderck_styles', $tablesList);
if (! $tableStylesExists) {
$this->updateTable('2.16.0');
}
$tableFontsExists = in_array($db->getPrefix() . 'pagebuilderck_fonts', $tablesList);
if (! $tableFontsExists) {
$this->updateTable('3.0.0');
}
// only update if it has already been installed
$tableExists = in_array($db->getPrefix() . 'pagebuilderck_pages', $tablesList);
if ($tableExists) {
$this->updateTableFieldCategory();
}
// install modules and plugins
jimport('joomla.installer.installer');
$status = array();
$src_ext = dirname(__FILE__).'/administrator/extensions';
$installer = new \Joomla\CMS\Installer\Installer;
// extensions to install
// system plugin
$result = $installer->install($src_ext.'/system_pagebuilderck');
$status[] = array('name'=>'System - Pagebuilder CK','type'=>'plugin', 'result'=>$result);
// system plugin must be enabled for user group limits and private areas
$db->setQuery("UPDATE #__extensions SET enabled = '1' WHERE `element` = 'pagebuilderck' AND `type` = 'plugin'");
$db->execute();
// editor button plugin
$result = $installer->install($src_ext.'/pagebuilderckbutton');
$status[] = array('name'=>'Button - Pagebuilder CK','type'=>'plugin', 'result'=>$result);
// auto enable the plugin
$db->setQuery("UPDATE #__extensions SET enabled = '1' WHERE `element` = 'pagebuilderckbutton' AND `type` = 'plugin'");
$db->execute();
// editor plugin (editor button type)
$result = $installer->install($src_ext.'/pagebuilderckeditor');
$status[] = array('name'=>'Editor - Pagebuilder CK','type'=>'plugin', 'result'=>$result);
// auto enable the plugin
$db->setQuery("UPDATE #__extensions SET enabled = '1' WHERE `element` = 'pagebuilderckeditor' AND `type` = 'plugin'");
$db->execute();
// search plugin
/*$result = $installer->install($src_ext.'/pagebuildercksearch');
$status[] = array('name'=>'Search - Pagebuilder CK','type'=>'plugin', 'result'=>$result);*/
// auto enable the plugin
$db->setQuery("UPDATE #__extensions SET enabled = '0' WHERE `element` = 'pagebuildercksearch' AND `type` = 'plugin'");
$db->execute();
// module
$result = $installer->install($src_ext.'/mod_pagebuilderck');
$status[] = array('name'=>'Page Builder CK - Module','type'=>'module', 'result'=>$result);
// auto enable the plugin
// $db->setQuery("UPDATE #__extensions SET enabled = '1' WHERE `element` = 'mod_pagebuilderck' AND `type` = 'module'");
// $db->execute();
// pagebuilderck plugin
// $plugins = array('text', 'icon', 'icontext', 'image', 'separator', 'message', 'tabs', 'accordion', 'module', 'video', 'audio');
$plugins = \Joomla\CMS\Filesystem\Folder::folders($src_ext.'/addons');
$ordering = 1;
foreach ($plugins as $plugin) {
$alreadyInstalled = file_exists(JPATH_SITE . '/plugins/pagebuilderck/' . $plugin);
$result = $installer->install($src_ext . '/addons/' . $plugin);
$status[] = array('name'=>'Pagebuilder CK - ' . $plugin,'type'=>'plugin', 'result' => $result);
if ($type !== 'update' || ! $alreadyInstalled) {
// if update, then do nothing. Else it will install and enable the plugins/module
// auto enable the plugin
$db->setQuery("UPDATE #__extensions SET enabled = '1', ordering = '" . $ordering . "' WHERE `element` = '" . $plugin . "' AND `type` = 'plugin' AND `folder` = 'pagebuilderck'");
$db->execute();
$ordering++;
}
}
foreach ($status as $statu) {
if ($statu['result'] == true) {
$alert = 'success';
$icon = 'icon-ok';
$text = 'Successful';
} else {
$alert = 'warning';
$icon = 'icon-cancel';
$text = 'Failed';
}
echo '<div class="alert alert-' . $alert . '"><i class="icon ' . $icon . '"></i>Installation and activation of the <b>' . $statu['type'] . ' ' . $statu['name'] . '</b> : ' . $text . '</div>';
}
// disable the old params plugin
$db->setQuery("UPDATE #__extensions SET enabled = '0' WHERE `element` = 'pagebuilderckparams' AND `type` = 'plugin'");
$result3 = $db->execute();
// disable the old update site
$db->setQuery("UPDATE #__update_sites SET enabled = '0' WHERE `location` = 'https://update.joomlack.fr/pagebuilderck_light_update.xml'");
$result4 = $db->execute();
// disable the old update site
$db->setQuery("UPDATE #__update_sites SET enabled = '0' WHERE `location` = 'https://update.joomlack.fr/com_pagebuilderck_update.xml'");
$result5 = $db->execute();
// remove obsolete file
$menufile = JPATH_ROOT . '/components/com_pagebuilderck/views/page/tmpl/default.xml';
if (file_exists($menufile)) {
unlink($menufile);
// echo 'MENU ITEM FILE REMOVED';
}
return true;
}
}