| Server IP : 87.98.154.146 / Your IP : 216.73.216.101 Web Server : Apache System : Linux webm005.cluster126.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : bsiadvisil ( 110003) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/bsiadvisil/new/tmp/install_5c615cabbad61/ |
Upload File : |
<?php
/**
* MS Framework
*
* @package MS Framework Plugin
* @version 1.2.1.573
*
* @author Michael Snoeren
* @link https://snoerendevelopment.nl/
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
// Deny direct access
defined('_JEXEC') or die;
class PlgSystemMSInstallerInstallerScript {
/**
* Minimal Versions
* @var String
* @access Private
*/
private $minJoomlaVersion = '3.5.1';
private $minPHPVersion = '5.5.0';
private $installedSoftware = array();
private $skippedSoftware = array();
/**
* Installer Preflight (Before installation)
* @access Public
* @return Void
*/
public function preflight() {
// Load the installer language
JFactory::getLanguage()->load('plg_msinstaller', __DIR__);
// Check all versions
if (!$this->checkPHPVersion() || !$this->checkJoomlaVersion()) {
// Uninstall the installer
$this->uninstallInstaller();
return false;
}
return true;
}
/**
* Installer Postflight (After installation)
* @param String $route The route the installer takes (install, update)
* @access Public
* @return Boolean
*/
public function postflight($route, $adapter) {
// Only do this on update or installation
if (!in_array($route, array('install', 'update'))) {
return false;
}
// Install the framework
if (!$this->installFramework()) {
JFactory::getApplication()->enqueueMessage(JText::_('PLG_MSFRAMEWORK_ERROR_FAILED_TO_INSTALL_FW'), 'error');
}
// Setup the framework
JLoader::discover('MSFramework', JPATH_LIBRARIES . '/msframework/helpers/');
JLoader::register('MSFramework', JPATH_ROOT . '/plugins/system/msframework/helper/frame.php');
MSFramework::setup();
// Install all packages
if (!$this->installPackages()) {
$this->uninstallInstaller();
return false;
}
// Uninstall the installer
$this->uninstallInstaller();
// Remove the messages
$session = JFactory::getSession();
$session->set('application.queue', null);
$queue = JFactory::getApplication()->getMessageQueue(true);
// Show the installed extension table
$input = JFactory::getApplication()->input;
if ($input->getCmd('option', '') === 'com_installer' && $input->getCmd('view', '') === 'install') {
echo $this->renderExtensionTable();
}
return true;
}
/**
* Check if the PHP version is high enough
* @access Private
* @return Boolean
*/
private function checkPHPVersion() {
if (version_compare(PHP_VERSION, $this->minPHPVersion, '<')) {
JFactory::getApplication()->enqueueMessage(
JText::sprintf('MSI_PHP_NOT_COMPATIBLE', PHP_VERSION, $this->minPHPVersion), 'error'
);
return false;
}
return true;
}
/**
* Check if the Joomla version is high enough
* @access Private
* @return Boolean
*/
private function checkJoomlaVersion() {
if (version_compare(JVERSION, $this->minJoomlaVersion, '<')) {
JFactory::getApplication()->enqueueMessage(
JText::sprintf('MSI_JOOMLA_NOT_COMPATIBLE', JVERSION, $this->minJoomlaVersion), 'error'
);
return false;
}
return true;
}
/**
* Uninstall the installer
* @access Private
* @return Boolean
*/
private function uninstallInstaller() {
// Check if it is installed
if (!JFolder::exists(JPATH_SITE . '/plugins/system/msinstaller')) {
return false;
}
// Remove all folders
$folders = array(JPATH_SITE . '/plugins/system/msinstaller/language', JPATH_SITE . '/plugins/system/msinstaller');
foreach ($folders as $folder) {
if (is_dir($folder)) {
JFolder::delete($folder);
}
}
// Remove the extension from the database
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->delete('#__extensions')
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
->where($db->quoteName('element') . ' = ' . $db->quote('msinstaller'))
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
$db->setQuery($query);
$db->execute();
// Clean the plugin cache
JFactory::getCache()->clean('_system');
return true;
}
/**
* Install a package
* @param String $package The name of folder
* @access Private
* @return Boolean
*/
private function installPackage($package) {
$path = __DIR__ . '/packages/' . $package;
if (empty($path) || !JFolder::exists($path)) { return false; }
// Get the manifest
$manifest = MSFrameworkInstall::getManifest($path);
// If we cannot find a manifest or install it, skip the package
if ($manifest === false || !MSFrameworkInstall::install($path)) {
return array_push($this->skippedSoftware, $package) && false;
}
// Load the language
$lang = JFactory::getLanguage();
$lang->load($manifest['name'], JPATH_ROOT);
// Add it to the software list
array_push($this->installedSoftware, array(
'name' => JText::_($manifest['name']),
'description' => JText::_($manifest['description']),
'type' => ucfirst($manifest['@attributes']['type']),
'version' => $manifest['version']
));
return true;
}
/**
* Install the framework
* @access Private
* @return Boolean
*/
private function installFramework() {
$pathPlg = __DIR__ . '/packages/plg_msframework';
$pathLib = __DIR__ . '/packages/lib_msframework';
$pathFile = __DIR__ . '/packages/file_msframework';
// Check if the installer is already present (prevents installing a lower version)
if (class_exists('MSFrameworkInstall') && method_exists('MSFrameworkInstall', 'getManifest')) {
$statusPlg = $this->installPackage('plg_msframework');
$statusLib = $this->installPackage('lib_msframework');
$statusFile = $this->installPackage('file_msframework');
return $statusPlg && $statusLib && $statusFile;
}
// If not, use the Joomla! installer
$installerPlg = new JInstaller;
$installerLib = new JInstaller;
$installerFile = new JInstaller;
$installPlg = $installerPlg->install($pathPlg);
$installLib = $installerLib->install($pathLib);
$installFile = $installerLib->install($pathFile);
return $installPlg && $installLib && $installFile;
}
/**
* Install all packages that come with this installer
* @access Private
* @return Boolean
*/
private function installPackages() {
// Get all packages
$packages = JFolder::folders(__DIR__ . '/packages');
// Remove the installer and library
$packages = array_diff($packages, array('plg_msframework', 'lib_msframework', 'file_msframework'));
// Install all packages
foreach ($packages as $pack) {
$this->installPackage($pack);
}
return true;
}
/**
* Render a table with the extensions
* @access Private
* @return String
*/
private function renderExtensionTable() {
ob_start();
?><table class="table">
<thead>
<tr>
<th><?php echo JText::_('MSI_TABLE_TITLE'); ?></th>
<th><?php echo JText::_('MSI_TABLE_TYPE'); ?></th>
<th><?php echo JText::_('MSI_TABLE_VERSION'); ?></th>
<th><?php echo JText::_('MSI_TABLE_INSTALLED'); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->installedSoftware as $item) {
echo $this->renderExtensionTableRow($item, true);
}
foreach ($this->skippedSoftware as $item) {
echo $this->renderExtensionTableRow($item, false);
}
?>
</tbody>
</table>
<?php
return ob_get_clean();
}
/**
* Render a table extension row
* @param Mixed $item
* @param Boolean $isInstalled
* @access Private
* @return String
*/
private function renderExtensionTableRow($item, $isInstalled) {
$title = $isInstalled ? $item['name'] : $item;
$description = $isInstalled ? $item['description'] : '';
$type = $isInstalled ? $item['type'] : '';
$version = $isInstalled ? $item['version'] : '';
$icon = $isInstalled ? 'icon-publish' : 'icon-delete';
ob_start();
?><tr>
<td>
<div><?php echo $title; ?></div>
<small style="color:#777;"><?php echo $description; ?></small>
</td>
<td><?php echo $type; ?></td>
<td><?php echo $version; ?></td>
<td><i class="<?php echo $icon; ?>"></i></td>
</tr>
<?php
return ob_get_clean();
}
}
?>