34
0
plg_extension_componentbuil.../script.php

524 lines
18 KiB
PHP
Raw Normal View History

2021-12-03 02:46:29 +00:00
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
2022-08-20 16:38:51 +00:00
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
2021-12-03 02:46:29 +00:00
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Extension - Componentbuilder Powers Autoloader Compiler script file.
*
* @package PlgExtensionComponentbuilderPowersAutoloaderCompiler
*/
class plgExtensionComponentbuilderPowersAutoloaderCompilerInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install|update)
2022-08-20 16:38:51 +00:00
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script
2021-12-03 02:46:29 +00:00
*
* @return boolean True on success
*/
2022-08-20 16:38:51 +00:00
public function preflight($route, $adapter)
2021-12-03 02:46:29 +00:00
{
// get application
$app = JFactory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
return false;
}
if ('install' === $route)
{
2022-09-20 11:36:38 +00:00
// needs fix
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.0 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 0) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 2.10.13 or higher installed
if (count($jcbVersion) == 3 && (($jcbVersion[0] == 2 && $jcbVersion[1] >= 10 && (($jcbVersion[1] == 10 && $jcbVersion[2] >= 13) || ($jcbVersion[1] > 10))) || $jcbVersion[0] >= 3))
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB 2.10.13 or higher before installing this plugin.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.0 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 0) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.0 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 0) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.1.18 or higher installed
2022-09-20 11:36:38 +00:00
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 1 && $jcbVersion[2] >= 18) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 1) ||
2022-09-20 11:36:38 +00:00
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.1.18 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.14 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 14) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.14 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.1.18 or higher installed
2022-09-20 11:36:38 +00:00
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 1 && $jcbVersion[2] >= 18) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 1) ||
2022-09-20 11:36:38 +00:00
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.1.18 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.14 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 14) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.14 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.14 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 14) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.14 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
return false;
}
2022-09-20 11:36:38 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2022-09-20 11:36:38 +00:00
// block install
$blockInstall = true;
2022-09-20 11:36:38 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.14 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 14) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
2022-09-20 11:36:38 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.14 or higher before installing this plugin.', 'error');
2022-09-20 11:36:38 +00:00
return false;
}
2022-09-20 11:36:38 +00:00
2021-12-16 13:15:47 +00:00
2021-12-03 02:46:29 +00:00
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
2022-08-20 16:38:51 +00:00
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
2021-12-16 13:15:47 +00:00
return false;
}
2021-12-16 13:15:47 +00:00
// load the helper class
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
2021-12-16 13:15:47 +00:00
// block install
$blockInstall = true;
2021-12-16 13:15:47 +00:00
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) && strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
2022-05-09 12:26:07 +00:00
// check that we have JCB 3.0.10 or higher installed
2022-01-10 14:13:41 +00:00
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3 &&
(
2022-05-09 12:26:07 +00:00
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 && $jcbVersion[2] >= 10) ||
2022-01-10 14:13:41 +00:00
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
2021-12-16 13:15:47 +00:00
{
$blockInstall = false;
}
}
2021-12-16 13:15:47 +00:00
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.10 or higher before installing this plugin.', 'error');
2021-12-03 02:46:29 +00:00
return false;
}
2021-12-03 02:46:29 +00:00
}
return true;
}
}