?
Path : /home/admin/public_html/old/administrator/components/com_jpopup/install/ |
Current File : /home/admin/public_html/old/administrator/components/com_jpopup/install/install.php |
<?php // no direct access defined('_JEXEC') or die('Restricted access'); //$nPaths = $this->_paths; $status = new JObject(); $status->plugins = array(); /*********************************************************************************************** * --------------------------------------------------------------------------------------------- * 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'); $pgroup = $plugin->attributes('group'); $porder = $plugin->attributes('order'); // 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::_('No plugin file specified')); return false; } /** * --------------------------------------------------------------------------------------------- * Filesystem Processing Section * --------------------------------------------------------------------------------------------- */ // If the plugin directory does not exist, lets create it $created = false; if (!file_exists($this->parent->getPath('extension_root'))) { if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_root').'"'); return false; } } /* * If we created the plugin directory and will want to remove it if we * have to roll back the installation, lets add it to the installation * step stack */ if ($created) { $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); } // Copy all necessary files $element = &$plugin->getElementByPath('files'); if ($this->parent->parseFiles($element, -1) === false) { // Install failed, roll back changes $this->parent->abort(); return false; } // Copy all necessary files $element = &$plugin->getElementByPath('languages'); if ($this->parent->parseLanguages($element, 1) === false) { // Install failed, roll back changes $this->parent->abort(); return false; } // Copy media files $element = &$plugin->getElementByPath('media'); if ($this->parent->parseMedia($element, 1) === false) { // Install failed, roll back changes $this->parent->abort(); return false; } /** * --------------------------------------------------------------------------------------------- * Database Processing Section * --------------------------------------------------------------------------------------------- */ $db = &JFactory::getDBO(); // Check to see if a plugin by the same name is already installed $query = 'SELECT `id`' . ' FROM `#__plugins`' . ' WHERE folder = '.$db->Quote($pgroup) . ' AND element = '.$db->Quote($pname); $db->setQuery($query); if (!$db->Query()) { // Install failed, roll back changes $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.$db->stderr(true)); return false; } $id = $db->loadResult(); // Was there a plugin already installed with the same name? if ($id) { if (!$this->parent->getOverwrite()) { // Install failed, roll back changes $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Plugin').' "'.$pname.'" '.JText::_('already exists!')); return false; } } else { $row =& JTable::getInstance('plugin'); $row->name = JText::_(ucfirst($pgroup)).' - '.JText::_(ucfirst($pname)); $row->ordering = $porder; $row->folder = $pgroup; $row->iscore = 0; $row->access = 0; $row->client_id = 0; $row->element = $pname; $row->published = 1; $row->params = 'jpopup_width=240 jpopup_height=200 jpopup_centered=1 jpopup_bgcolor=#FFFFFF jpopup_padding=8 jpopup_top=20 jpopup_left=100 jpopup_borderstyle=solid jpopup_bwidth=1 jpopup_bcolor=#FEF688 jpopup_wfont=Arial, Verdana, Sans-Serif jpopup_wfontsize=11px jpopup_wshadow=#666666 jpopup_wclose=Close! jpopup_wclose_css= jpopup_wdelay=1 jpopup_weffect_start=Appear jpopup_weffect_start_duration=3 jpopup_weffect_close=Fade jpopup_weffect_close_duration=3 jpopup_onclick=no jpopup_onclick_text= jpopup_onclick_text_style='; if (!$row->store()) { // Install failed, roll back changes $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.$db->stderr(true)); return false; } } $status->plugins[] = array('name'=>$pname,'group'=>$pgroup); } } /*********************************************************************************************** * --------------------------------------------------------------------------------------------- * OUTPUT TO SCREEN * --------------------------------------------------------------------------------------------- ***********************************************************************************************/ $rows = 0; ?> <h2>JPopup Installation</h2> <table class="adminlist"> <thead> <tr> <th class="title" 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 'JPopup '.JText::_('Component'); ?></td> <td><strong><?php echo JText::_('Installed'); ?></strong></td> </tr> <?php 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 ucfirst($plugin['name']); ?></td> <td class="key"><?php echo ucfirst($plugin['group']); ?></td> <td><strong><?php echo JText::_('Installed'); ?></strong></td> </tr> <?php endforeach; endif; ?> </tbody> </table>