Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added some theme installer code.

  • Loading branch information...
commit 299d4b2424bd5c9f38db80ed52c7c7830f23f8e6 1 parent c12a1e5
Taracque authored
24 administrator/com_raidplanner/controller.php
View
@@ -28,6 +28,30 @@ class RaidPlannerController extends JController
*/
function display()
{
+ if ($this->getTask() == 'doInstall') {
+ jimport ( 'joomla.filesystem.folder' );
+ jimport ( 'joomla.filesystem.file' );
+ jimport ( 'joomla.filesystem.archive' );
+
+ $file = JRequest::getVar ( 'install_theme', NULL, 'FILES', 'array' );
+ $app = JFactory::getApplication();
+ $tmp = $app->getCfg('tmp_path');
+ if (!$file || !is_uploaded_file ( $file ['tmp_name'])) {
+ $app->enqueueMessage ( JText::sprintf('COM_RAIDPLANNER_INSTALL_EXTRACT_MISSING', $file ['name']), 'notice' );
+ } else {
+ $success = JFile::upload($file ['tmp_name'], $tmp . DS . $file ['name']);
+ $success = JArchive::extract ( $tmp . DS . $file ['name'], $tmp );
+ if (! $success) {
+ $app->enqueueMessage ( JText::sprintf('COM_RAIDPLANNER_INSTALL_EXTRACT_FAILED', $file ['name']), 'notice' );
+ }
+ // find the manifest file
+ $xmlfiles = JFolder::files($tmp, '.xml$', 1, true);
+ foreach ($xmlfiles as $xmlfile) {
+ // install using the xml
+ }
+ }
+ }
+
parent::display();
if ($this->getTask() == 'service') {
11 administrator/com_raidplanner/views/raidplanner/tmpl/default.php
View
@@ -31,7 +31,16 @@
?>
</ul>
</fieldset>
-
+<fieldset>
+ <legend><?php echo JText::_('COM_RAIDPLANNER_THEME_INSTALL'); ?></legend>
+ <form enctype="multipart/form-data" action="index.php" method="post" name="adminForm">
+ <input type="hidden" name="task" value="doInstall" />
+ <input type="hidden" name="option" value="com_raidplanner" />
+ <input class="input_box" name="install_theme" type="file" size="57" />
+ <input class="button" type="submit" name="submit" value="<?php echo JText::_( 'COM_RAIDPLANNER_UPLOAD_THEME' ); ?>" />
+ <?php echo JHTML::_( 'form.token' ); ?>
+ </form>
+</fieldset>
<fieldset>
<legend><?php echo JText::_('JOPTION_MENUS');?>:</legend>
<div class="rp_icon_button">
Please sign in to comment.
Something went wrong with that request. Please try again.