Sindbad~EG File Manager
<?php
/**
* @package RSDirectory!
* @copyright (C) 2013-2021 www.rsjoomla.com
* @license GPL, http://www.gnu.org/licenses/gpl-3.0.html
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
class plgRsdirectoryImportSobiProInstallerScript
{
/**
* @param $type
* @param $parent
*
* @return bool
*/
public function preflight($type, $parent) {
if ($type == 'uninstall') {
return true;
}
try {
if (!file_exists(JPATH_ADMINISTRATOR.'/components/com_rsdirectory/helpers/version.php')) {
throw new Exception('Please install RSDirectory! first before you attempt to install this plugin.');
}
require_once JPATH_ADMINISTRATOR.'/components/com_rsdirectory/helpers/version.php';
if (version_compare(RSDirectoryVersion::$version, '2.0.0', '<')) {
throw new Exception('Please update RSDirectory! to version <strong>2.0.0 or newer</strong> before you attempt to install this plugin.');
}
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
return false;
}
return true;
}
protected function escape($string) {
return htmlentities($string, ENT_COMPAT, 'utf-8');
}
/**
* The postflight hook.
*
* @access public
*
* @param string $type
* @param object $parent
*
* @return mixed
*/
public function postflight($type, $parent)
{
if ($type == 'uninstall') {
return true;
}
// Get the database object.
$db = JFactory::getDbo();
$messages = array();
// remove the old rsdirectoryimportsobipro from the "system" group
// Get the database object.
$db = JFactory::getDbo();
// remove the old rsdirectoryimportsobipro from the "system" group
if ($type == 'install')
{
$query = $db->getQuery(true)
->select( $db->qn('extension_id') )
->from( $db->qn('#__extensions') )
->where( $db->qn('element') . '=' . $db->q('rsdirectoryimportsobipro') )
->where( $db->qn('folder') . '=' . $db->q('system') )
->where( $db->qn('type') . '=' . $db->q('plugin') );
$db->setQuery($query);
if ( $extension_id = $db->loadResult() ) {
// keep the current status
$query = $db->getQuery(true)
->select( $db->qn('enabled') )
->from( $db->qn('#__extensions') )
->where( $db->qn('extension_id') . '=' . $db->q($extension_id) );
$db->setQuery($query);
$enabled = $db->loadResult();
if ($enabled)
{
$query = $db->getQuery(true)
->update('#__extensions')
->set( $db->qn('enabled') . '=' . $db->q(1) )
->where( $db->qn('element') . '=' . $db->q('importsobipro') )
->where( $db->qn('folder') . '=' . $db->q('rsdirectory') )
->where( $db->qn('type') . '=' . $db->q('plugin') );
$db->setQuery($query);
$db->execute();
}
// Initialize JInstaller.
$installer = new JInstaller();
if ($installer->uninstall('plugin', $extension_id))
{
$messages['uninstalled'][] = (object)array(
'name' => 'RSDirectory! SobiPro Import Plugin',
'status' => 'ok',
'text' => 'Uninstalled old "system" plugin.',
);
}
}
}
$query = $db->getQuery(true);
$query->select('extension_id')
->from($db->qn('#__extensions'))
->where($db->qn('type').' = '.$db->q('plugin'))
->where($db->qn('folder').' = '.$db->q('rsdirectory'))
->where($db->qn('element').' = '.$db->q('importsobipro'));
$pluginId = $db->setQuery($query)->loadResult();
?>
<style type="text/css">
.version-history {
margin: 0 0 2em 0;
padding: 0;
list-style-type: none;
}
.version-history > li {
margin: 0 0 0.5em 0;
padding: 0 0 0 4em;
text-align:left;
font-weight:normal;
}
.version-new,
.version-fixed,
.version-upgraded {
float: left;
font-size: 0.8em;
margin-left: -4.9em;
width: 4.5em;
color: white;
text-align: center;
font-weight: bold;
text-transform: uppercase;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.version-new {
background: #7dc35b;
}
.version-fixed {
background: #e9a130;
}
.version-upgraded {
background: #61b3de;
}
.uninstall-ok {
background: #c38306;
color: #fff;
padding: 3px;
}
.uninstall-not-ok {
background: #E9452F;
color: #fff;
padding: 3px;
}
</style>
<h3>RSDirectory! SobiPro Import Plugin</h3>
<ul class="version-history">
<li><span class="version-upgraded">Upg</span> Joomla 4 Compatibility.</li>
</ul>
<?php if ( !empty($messages['uninstalled']) ) { ?>
<?php foreach ($messages['uninstalled'] as $item) { ?>
<p><?php echo $this->escape($item->name); ?> ...
<b class="uninstall-<?php echo $item->status; ?>"><?php echo $item->text; ?></b>
</p>
<?php } ?>
<?php } ?>
<?php if ($pluginId) { ?>
<a class="btn btn-primary" href="<?php echo JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id='.$pluginId); ?>">Start using the RSDirectory! SobiPro Import Plugin.</a>
<?php } ?>
<a class="btn btn-outline-secondary" href="https://www.rsjoomla.com/support/documentation/rsdirectory/plugins-and-modules/sobipro-import-plugin.html" target="_blank">Read the documentation</a>
<a class="btn btn-outline-secondary" href="https://www.rsjoomla.com/support.html" target="_blank">Get Support!</a>
<div style="clear: both; margin-bottom:10px"></div>
<?php
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists