FundacionLQDVI_WebCongresos/www/administrator/components/com_alpharegistration/install.alpharegistration.php

108 lines
2.9 KiB
PHP

<?php
/**
* @version 2.0.12 alpharegistration $
* @package alpharegistration
* @copyright Copyright © 2009-2010 - Bernard Gilly - All rights reserved.
* @license GNU/GPL
* @author Bernard Gilly
* @author mail contact@alphaplug.com
* @website www.alphaplug.com
*/
defined('_JEXEC') or die('Restricted access');
$install = "";
$db =& JFactory::getDBO();
$uninstall_status = array();
class Status {
var $STATUS_FAIL = 'Failed';
var $STATUS_SUCCESS = 'Success';
var $infomsg = array();
var $errmsg = array();
var $status;
}
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
// include
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_alpharegistration'.DS.'helper.php');
// Uninstall plugin system
$query = "SELECT id FROM #__plugins WHERE element='alpharegistration' AND folder='system' LIMIT 1";
$db->setQuery($query);
$argplugin = $db->loadObject();
if ( $argplugin ) {
$plugin_installer = new JInstaller;
$status = new Status();
$status->status = $status->STATUS_FAIL;
if(@$plugin_installer->uninstall('plugin', $argplugin->id))
{
$status->status = $status->STATUS_SUCCESS;
}
$install_status['AlphaRegistration'] = $status;
}
// delete all older plugins
$query = "DELETE FROM #__plugins WHERE element='alpharegistration'";
$db->setQuery( $query );
$db->query();
// Install system plugin
$plugin_installer = new JInstaller;
if($plugin_installer->install(dirname(__FILE__).DS.'install'.DS.'system') )
{
$install .= '<img src="images/tick.png" alt="" /> Installing AlphaRegistration System Plugin<br/>';
}
// Enable plugin
$query = "UPDATE #__plugins SET published=1 WHERE element='alpharegistration'";
$db->setQuery( $query );
$db->query();
// Unlink plugin
@unlink( dirname(__FILE__).DS.'install'.DS.'system'.DS.'alpharegistration.php' );
@unlink( dirname(__FILE__).DS.'install'.DS.'system'.DS.'alpharegistration.xml' );
// Modify the admin icons
$query = "SELECT id FROM #__components WHERE `name`='AlphaRegistration'";
$db->setQuery( $query );
$id = $db->loadResult();
//add new admin menu images
$query = "UPDATE #__components SET `name`='AlphaRegistration', admin_menu_img = '../administrator/components/com_alpharegistration/assets/images/alpharegistration_icon.png' WHERE id='$id'";
$db->setQuery( $query );
$db->query();
$install .= '<img src="images/tick.png" alt="" /> Icon menu updated<br />';
$install .= '<img src="images/tick.png" alt="" /> Installation finished<br />';
?>
<table width="100%" border="0">
<tr>
<td><img src="components/com_alpharegistration/assets/images/alpharegistration.png" alt="" /></td>
</tr>
<tr>
<td>
<code>
<?php echo $install; ?>
</code><br />
</td>
</tr>
<tr>
<td>
<div style="width:148px;">
<div class="button1">
<div class="next">
<a href="index.php?option=com_alpharegistration">AlphaRegistration</a><br />
</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<br /><?php arg_CopySite ('left'); ?><br />
</td>
</tr>
</table>