| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/ees_request/administrator/components/com_printme/install/ |
Upload File : |
<?php
/**
* @version 1.5
* @package Printme
* @author Dioscouri Design
* @link http://www.dioscouri.com
* @copyright Copyright (C) 2007 Dioscouri Design. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
/** ensure this file is being included by a parent file */
defined( '_JEXEC' ) or die( 'Restricted access' );
$thisextension = strtolower( "com_printme" );
$thisextensionname = substr ( $thisextension, 4 );
JLoader::import( 'com_printme.library.dscinstaller', JPATH_ADMINISTRATOR.DS.'components' );
// load the component language file
$language = &JFactory::getLanguage();
$language->load( $thisextension );
$status = new JObject();
$status->modules = array();
$status->plugins = array();
$status->templates = array();
/***********************************************************************************************
* ---------------------------------------------------------------------------------------------
* // TEMPLATES INSTALLATION SECTION
* ---------------------------------------------------------------------------------------------
***********************************************************************************************/
$templates = &$this->manifest->getElementByPath('templates');
if (is_a($templates, 'JSimpleXMLElement') && count($templates->children())) {
foreach ($templates->children() as $template)
{
$mname = $template->attributes('template');
$mpublish = $template->attributes('publish');
$mclient = JApplicationHelper::getClientInfo($template->attributes('client'), true);
// Set the installation path
if (!empty ($mname)) {
$this->parent->setPath('extension_root', $mclient->path.DS.'templates'.DS.$mname);
} else {
$this->parent->abort(JText::_('Template').' '.JText::_('Install').': '.JText::_('Install Template File Missing'));
return false;
}
/*
* fire the dioscouriInstaller with the foldername and folder entryType
*/
$pathToFolder = $this->parent->getPath('source').DS.$mname;
$dscInstaller = new dscInstaller();
if ($mpublish) {
$dscInstaller->set( '_publishExtension', true );
}
$result = $dscInstaller->installExtension($pathToFolder, 'folder');
// track the message and status of installation from dscInstaller
if ($result)
{
$alt = JText::_( "Installed" );
$mstatus = "<img src='images/tick.png' border='0' alt='{$alt}' />";
} else {
$alt = JText::_( "Failed" );
$error = $dscInstaller->getError();
$mstatus = "<img src='images/publish_x.png' border='0' alt='{$alt}' />";
$mstatus .= " - ".$error;
}
$status->templates[] = array('name'=>$mname,'client'=>$mclient->name, 'status'=>$mstatus );
}
}
/***********************************************************************************************
* ---------------------------------------------------------------------------------------------
* MODULE INSTALLATION SECTION
* ---------------------------------------------------------------------------------------------
***********************************************************************************************/
$modules = &$this->manifest->getElementByPath('modules');
if (is_a($modules, 'JSimpleXMLElement') && count($modules->children())) {
foreach ($modules->children() as $module)
{
$mname = $module->attributes('module');
$mpublish = $module->attributes('publish');
$mposition = $module->attributes('position');
$mclient = JApplicationHelper::getClientInfo($module->attributes('client'), true);
// Set the installation path
if (!empty ($mname)) {
$this->parent->setPath('extension_root', $mclient->path.DS.'modules'.DS.$mname);
} else {
$this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Install Module File Missing'));
return false;
}
/*
* fire the dioscouriInstaller with the foldername and folder entryType
*/
$pathToFolder = $this->parent->getPath('source').DS.$mname;
$dscInstaller = new dscInstaller();
if ($mpublish) {
$dscInstaller->set( '_publishExtension', true );
}
$result = $dscInstaller->installExtension($pathToFolder, 'folder');
// track the message and status of installation from dscInstaller
if ($result)
{
// update the module record if the position != left
if (isset($mposition) && $mposition != 'left')
{
// set the position of the module
$database = JFactory::getDBO();
$query = "UPDATE #__modules SET `position` = '{$mposition}' WHERE `module` = '{$mname}';";
$database->setQuery($query);
$database->query();
}
$alt = JText::_( "Installed" );
$mstatus = "<img src='images/tick.png' border='0' alt='{$alt}' />";
} else {
$alt = JText::_( "Failed" );
$error = $dscInstaller->getError();
$mstatus = "<img src='images/publish_x.png' border='0' alt='{$alt}' />";
$mstatus .= " - ".$error;
}
$status->modules[] = array('name'=>$mname,'client'=>$mclient->name, 'status'=>$mstatus );
}
}
/***********************************************************************************************
* ---------------------------------------------------------------------------------------------
* PLUGIN INSTALLATION SECTION
* ---------------------------------------------------------------------------------------------
***********************************************************************************************/
$plugins = &$this->manifest->getElementByPath('plugins');
if (is_a($plugins, 'JSimpleXMLElement') && count($plugins->children())) {
foreach ($plugins->children() as $plugin)
{
$pname = $plugin->attributes('plugin');
$ppublish = $plugin->attributes('publish');
$pgroup = $plugin->attributes('group');
// Set the installation path
if (!empty($pname) && !empty($pgroup)) {
$this->parent->setPath('extension_root', JPATH_ROOT.DS.'plugins'.DS.$pgroup);
} else {
$this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Install Plugin File Missing'));
return false;
}
/*
* fire the dioscouriInstaller with the foldername and folder entryType
*/
$pathToFolder = $this->parent->getPath('source').DS.$pname;
$dscInstaller = new dscInstaller();
if ($ppublish) {
$dscInstaller->set( '_publishExtension', true );
}
$result = $dscInstaller->installExtension($pathToFolder, 'folder');
// track the message and status of installation from dscInstaller
if ($result) {
$alt = JText::_( "Installed" );
$pstatus = "<img src='images/tick.png' border='0' alt='{$alt}' />";
} else {
$alt = JText::_( "Failed" );
$error = $dscInstaller->getError();
$pstatus = "<img src='images/publish_x.png' border='0' alt='{$alt}' /> ";
$pstatus .= " - ".$error;
}
$status->plugins[] = array('name'=>$pname,'group'=>$pgroup, 'status'=>$pstatus);
}
}
/***********************************************************************************************
* ---------------------------------------------------------------------------------------------
* SETUP DEFAULTS
* ---------------------------------------------------------------------------------------------
***********************************************************************************************/
// None
/***********************************************************************************************
* ---------------------------------------------------------------------------------------------
* OUTPUT TO SCREEN
* ---------------------------------------------------------------------------------------------
***********************************************************************************************/
$rows = 0;
?>
<h2><?php echo JText::_('Installation Results'); ?></h2>
<table class="adminlist">
<thead>
<tr>
<th colspan="2"><?php echo JText::_('Extension'); ?></th>
<th width="30%"><?php echo JText::_('Status'); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3"></td>
</tr>
</tfoot>
<tbody>
<tr class="row0">
<td class="key" colspan="2"><?php echo JText::_( $thisextension ); ?></td>
<td class="key"><center><?php $alt = JText::_('Installed'); echo "<img src='images/tick.png' border='0' alt='{$alt}' />"; ?></center></td>
</tr>
<?php if (count($status->modules)) : ?>
<tr>
<th><?php echo JText::_('Module'); ?></th>
<th><?php echo JText::_('Client'); ?></th>
<th></th>
</tr>
<?php foreach ($status->modules as $module) : ?>
<tr class="row<?php echo (++ $rows % 2); ?>">
<td class="key"><?php echo $module['name']; ?></td>
<td class="key"><?php echo ucfirst($module['client']); ?></td>
<td class="key"><center><?php echo $module['status']; ?></center></td>
</tr>
<?php endforeach;
endif;
if (count($status->plugins)) : ?>
<tr>
<th><?php echo JText::_('Plugin'); ?></th>
<th><?php echo JText::_('Group'); ?></th>
<th></th>
</tr>
<?php foreach ($status->plugins as $plugin) : ?>
<tr class="row<?php echo (++ $rows % 2); ?>">
<td class="key"><?php echo $plugin['name']; ?></td>
<td class="key"><?php echo $plugin['group']; ?></td>
<td class="key"><center><?php echo $plugin['status']; ?></center></td>
</tr>
<?php endforeach;
endif;
if (count($status->templates)) : ?>
<tr>
<th><?php echo JText::_('Template'); ?></th>
<th><?php echo JText::_('Client'); ?></th>
<th></th>
</tr>
<?php foreach ($status->templates as $template) : ?>
<tr class="row<?php echo (++ $rows % 2); ?>">
<td class="key"><?php echo $template['name']; ?></td>
<td class="key"><?php echo $template['client']; ?></td>
<td class="key"><center><?php echo $template['status']; ?></center></td>
</tr>
<?php endforeach;
endif; ?>
</tbody>
</table>