| 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_mobilemenuck/ |
Upload File : |
<?php
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
{
return MobileMenucCK_installer_update($adapter);
}
public function uninstall(InstallerAdapter $adapter): bool
{
return MobileMenucCK_installer_uninstall($adapter);
}
public function preflight(string $type, InstallerAdapter $adapter): bool
{
return MobileMenucCK_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 MobileMenucCK_installer_postflight($type, $adapter);
}
};
} else {
class com_mobilemenuckInstallerScript {
function install($parent) {
// not used
}
function update($parent) {
return MobileMenucCK_installer_update($parent);
}
function uninstall($parent) {
return MobileMenucCK_installer_uninstall($parent);
}
function preflight($type, $parent) {
return MobileMenucCK_installer_preflight($type, $parent);
}
// run on install and update
function postflight($type, $parent) {
jimport('joomla.installer.installer');
return MobileMenucCK_installer_postflight($type, $parent);
}
}
}
function MobileMenucCK_installer_update($parent) {
$db = \Joomla\CMS\Factory::getDbo();
$sql = file_get_contents(dirname(__FILE__).'/administrator/sql/install.mysql.utf8.sql');
$sqls = explode('/* --- */', $sql);
foreach ($sqls as $s) {
if ($s = trim($s)) {
$db->setQuery($s);
$db->execute();
}
}
return true;
}
function MobileMenucCK_installer_uninstall($parent) {
jimport('joomla.installer.installer');
$db = \Joomla\CMS\Factory::getDbo();
// Check first that the plugin exist
$db->setQuery('SELECT `extension_id` FROM #__extensions WHERE `element` = "mobilemenuck" AND `type` = "plugin"');
$id = $db->loadResult();
if($id)
{
$installer = new \Joomla\CMS\Installer\Installer;
$result = $installer->uninstall('plugin', $id);
}
return true;
}
function MobileMenucCK_installer_preflight($type, $parent) {
// disable the install on Joomla 3
if (version_compare(JVERSION, '4', '<')) {
throw new RuntimeException('This version of Mobile Menu CK can not be installed on Joomla 3. Please use the version 1.6.11.');
}
// disable the install on Joomla 4
if (version_compare(JVERSION, '5', '<')) {
Factory::getApplication()->enqueueMessage('This version of Mobile Menu CK CK can not be installed on Joomla 4. Please use the version 1.6.11.', 'error');
return false;
}
return true;
}
// run on install and update
function MobileMenucCK_installer_postflight($type, $parent) {
// install modules and plugins
$db = \Joomla\CMS\Factory::getDbo();
$status = array();
$src_ext = dirname(__FILE__).'/administrator/extensions';
// install the plugin
$result = MobileMenucCK_installer_installExtension($src_ext.'/mobilemenuck');
$status[] = array('name'=>'Mobile Menu CK - Plugin','type'=>'plugin', 'result'=>$result);
// auto enable the plugin
$db->setQuery("UPDATE #__extensions SET enabled = '1' WHERE `element` = 'mobilemenuck' AND `type` = 'plugin'");
$db->execute();
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>';
}
// check if the demo data have already been installed
// $db->clear();
$check = "SELECT id FROM #__mobilemenuck_styles WHERE id = '1'";
$db->setQuery($check);
$exists = $db->loadResult();
// if not, then install it
if (! $exists) {
$sqlInsert = file_get_contents(dirname(__FILE__) . '/administrator/sql/install.style.sql');
// $db->clear();
$db->setQuery($sqlInsert);
$db->execute();
}
return true;
}
function MobileMenucCK_installer_installExtension($path) {
$installer = new Installer();
$installer->setDatabase(Factory::getDbo());
return $installer->install($path);
}