Ejemplo n.º 1
0
 /**
  * Executes the action associated with an item
  *
  * @return  void
  *
  * @since   3.2
  */
 public function action()
 {
     // CSRF prevention
     if ($this->csrfProtection) {
         $this->_csrfProtection();
     }
     $model = $this->getThisModel();
     if (!$model->getId()) {
         $model->setIDsFromRequest();
     }
     $item = $model->getItem();
     switch ($item->type) {
         case 'link':
             $this->setRedirect($item->action);
             return;
             break;
         case 'action':
             jimport('joomla.filesystem.file');
             $file = FOFTemplateUtils::parsePath($item->action_file, true);
             if (JFile::exists($file)) {
                 require_once $file;
                 call_user_func($item->action);
             }
             break;
         case 'message':
         default:
             break;
     }
     $this->setRedirect('index.php?option=com_postinstall');
 }
Ejemplo n.º 2
0
 /**
  * Create objects for the options
  *
  * @return  array  The array of option objects
  */
 protected function getOptions()
 {
     $options = array();
     // Do we have a class and method source for our options?
     $source_file = empty($this->element['source_file']) ? '' : (string) $this->element['source_file'];
     $source_class = empty($this->element['source_class']) ? '' : (string) $this->element['source_class'];
     $source_method = empty($this->element['source_method']) ? '' : (string) $this->element['source_method'];
     $source_key = empty($this->element['source_key']) ? '*' : (string) $this->element['source_key'];
     $source_value = empty($this->element['source_value']) ? '*' : (string) $this->element['source_value'];
     $source_translate = empty($this->element['source_translate']) ? 'true' : (string) $this->element['source_translate'];
     $source_translate = in_array(strtolower($source_translate), array('true', 'yes', '1', 'on')) ? true : false;
     $source_format = empty($this->element['source_format']) ? '' : (string) $this->element['source_format'];
     if ($source_class && $source_method) {
         // Maybe we have to load a file?
         if (!empty($source_file)) {
             $source_file = FOFTemplateUtils::parsePath($source_file, true);
             JLoader::import('joomla.filesystem.file');
             if (JFile::exists($source_file)) {
                 include_once $source_file;
             }
         }
         // Make sure the class exists
         if (class_exists($source_class, true)) {
             // ...and so does the option
             if (in_array($source_method, get_class_methods($source_class))) {
                 // Get the data from the class
                 if ($source_format == 'optionsobject') {
                     $options = $source_class::$source_method();
                 } else {
                     $source_data = $source_class::$source_method();
                     // Loop through the data and prime the $options array
                     foreach ($source_data as $k => $v) {
                         $key = empty($source_key) || $source_key == '*' ? $k : $v[$source_key];
                         $value = empty($source_value) || $source_value == '*' ? $v : $v[$source_value];
                         if ($source_translate) {
                             $value = JText::_($value);
                         }
                         $options[] = JHtml::_('select.option', $key, $value, 'value', 'text');
                     }
                 }
             }
         }
     }
     // Get the field $options
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $options[] = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true');
     }
     reset($options);
     return $options;
 }
Ejemplo n.º 3
0
 public function onBeforeDispatch()
 {
     $result = parent::onBeforeDispatch();
     if ($result) {
         // Load Akeeba Strapper
         include_once JPATH_ROOT . '/media/akeeba_strapper/strapper.php';
         AkeebaStrapper::$tag = AKEEBAMEDIATAG;
         AkeebaStrapper::bootstrap();
         AkeebaStrapper::jQueryUI();
         AkeebaStrapper::addJSfile('media://com_akeeba/js/gui-helpers.js');
         AkeebaStrapper::addJSfile('media://com_akeeba/js/akeebaui.js');
         jimport('joomla.filesystem.file');
         if (JFile::exists(FOFTemplateUtils::parsePath('media://com_akeeba/plugins/js/akeebaui.js', true))) {
             AkeebaStrapper::addJSfile('media://com_akeeba/plugins/js/akeebaui.js');
         }
         AkeebaStrapper::addCSSfile('media://com_akeeba/theme/akeebaui.css');
     }
     return $result;
 }
 /**
  * Method to get the field options.
  *
  * Ordering is disabled by default. You can enable ordering by setting the
  * 'order' element in your form field. The other order values are optional.
  *
  * - order					What to order.			Possible values: 'name' or 'value' (default = false)
  * - order_dir				Order direction.		Possible values: 'asc' = Ascending or 'desc' = Descending (default = 'asc')
  * - order_case_sensitive	Order case sensitive.	Possible values: 'true' or 'false' (default = false)
  *
  * @return  array  The field option objects.
  *
  * @since	Ordering is available since FOF 2.1.b2.
  */
 protected function getOptions()
 {
     // Ordering is disabled by default for backward compatibility
     $order = false;
     // Set default order direction
     $order_dir = 'asc';
     // Set default value for case sensitive sorting
     $order_case_sensitive = false;
     if ($this->element['order'] && $this->element['order'] !== 'false') {
         $order = $this->element['order'];
     }
     if ($this->element['order_dir']) {
         $order_dir = $this->element['order_dir'];
     }
     if ($this->element['order_case_sensitive']) {
         // Override default setting when the form element value is 'true'
         if ($this->element['order_case_sensitive'] == 'true') {
             $order_case_sensitive = true;
         }
     }
     // Create a $sortOptions array in order to apply sorting
     $i = 0;
     $sortOptions = array();
     foreach ($this->element->children() as $option) {
         $name = JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname));
         $sortOptions[$i] = new stdClass();
         $sortOptions[$i]->option = $option;
         $sortOptions[$i]->value = $option['value'];
         $sortOptions[$i]->name = $name;
         $i++;
     }
     // Only order if it's set
     if ($order) {
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::sortObjects($sortOptions, $order, $order_dir == 'asc' ? 1 : -1, $order_case_sensitive, false);
     }
     // Initialise the options
     $options = array();
     // Do we have a class and method source for our options?
     $source_file = empty($this->element['source_file']) ? '' : (string) $this->element['source_file'];
     $source_class = empty($this->element['source_class']) ? '' : (string) $this->element['source_class'];
     $source_method = empty($this->element['source_method']) ? '' : (string) $this->element['source_method'];
     $source_key = empty($this->element['source_key']) ? '*' : (string) $this->element['source_key'];
     $source_value = empty($this->element['source_value']) ? '*' : (string) $this->element['source_value'];
     $source_translate = empty($this->element['source_translate']) ? 'true' : (string) $this->element['source_translate'];
     $source_translate = in_array(strtolower($source_translate), array('true', 'yes', '1', 'on')) ? true : false;
     if ($source_class && $source_method) {
         // Maybe we have to load a file?
         if (!empty($source_file)) {
             $source_file = FOFTemplateUtils::parsePath($source_file, true);
             if (FOFPlatform::getInstance()->getFilesystem()->fileExists($source_file)) {
                 include_once $source_file;
             }
         }
         // Make sure the class exists
         if (class_exists($source_class, true)) {
             // ...and so does the option
             if (in_array($source_method, get_class_methods($source_class))) {
                 // Get the data from the class
                 $source_data = $source_class::$source_method();
                 // Loop through the data and prime the $options array
                 foreach ($source_data as $k => $v) {
                     $key = empty($source_key) || $source_key == '*' ? $k : $v[$source_key];
                     $value = empty($source_value) || $source_value == '*' ? $v : $v[$source_value];
                     if ($source_translate) {
                         $value = JText::_($value);
                     }
                     $options[] = JHtml::_('select.option', $key, $value, 'value', 'text');
                 }
             }
         }
     }
     // Get the field $options
     foreach ($sortOptions as $sortOption) {
         $option = $sortOption->option;
         $name = $sortOption->name;
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         $tmp = JHtml::_('select.option', (string) $option['value'], $name, 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     reset($options);
     return $options;
 }
Ejemplo n.º 5
0
 /**
  * Loads the Javascript files defined in the form, based on its jsfiles attribute
  *
  * @since 2.0
  */
 public function loadJSFiles()
 {
     $jsfiles = $this->getAttribute('jsfiles');
     if (empty($jsfiles)) {
         return;
     }
     $jsfiles = explode(',', $jsfiles);
     foreach ($jsfiles as $jsfile) {
         FOFTemplateUtils::addJS(trim($jsfile));
     }
 }
Ejemplo n.º 6
0
// Protect from unauthorized access
defined('_JEXEC') or die;
// version
JLoader::import('joomla.version');
$version = new JVersion();
if (!$version->isCompatible('3.0')) {
    FOFTemplateUtils::addJS('media://zoo/libraries/jquery/jquery.js');
    // workaround for jQuery 1.9 transition
    FOFTemplateUtils::addJS('media://com_zlmanager/js/jquery.migrate.min.js');
} else {
    JHTML::_('jquery.framework');
}
FOFTemplateUtils::addCSS('media://com_zlmanager/css/backend.css');
FOFTemplateUtils::addJS('media://com_zlmanager/js/bootstrap.modal.min.js');
FOFTemplateUtils::addJS('media://com_zlmanager/js/download.js');
JHTML::_('behavior.tooltip');
?>

<div class="btn-group">
  	<a class="btn" href="#" id="hide_not_installed"><?php 
echo JText::_('COM_ZLMANAGER_HIDENOTINSTALLED');
?>
</a>
	<a class="btn" href="#" id="hide_uptodate"><?php 
echo JText::_('COM_ZLMANAGER_HIDEUPTODATE');
?>
</a>
	<a class="btn" href="#" id="show_update"><?php 
echo JText::_('COM_ZLMANAGER_SHOWTOUPDATE');
?>
Ejemplo n.º 7
0
 /**
  * Adds or updates a post-installation message (PIM) definition. You can use this in your post-installation script using this code:
  *
  * require_once JPATH_LIBRARIES . '/fof/include.php';
  * FOFModel::getTmpInstance('Messages', 'PostinstallModel')->addPostInstallationMessage($options);
  *
  * The $options array contains the following mandatory keys:
  *
  * extension_id        The numeric ID of the extension this message is for (see the #__extensions table)
  *
  * type                One of message, link or action. Their meaning is:
  *                         message  Informative message. The user can dismiss it.
  *                         link     The action button links to a URL. The URL is defined in the action parameter.
  *                         action   A PHP action takes place when the action button is clicked. You need to specify the action_file
  *                                  (RAD path to the PHP file) and action (PHP function name) keys. See below for more information.
  *
  * title_key           The JText language key for the title of this PIM.
  *                     Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_TITLE
  *
  * description_key     The JText language key for the main body (description) of this PIM
  *                     Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_DESCRIPTION
  *
  * action_key		   The JText language key for the action button. Ignored and not required when type=message
  * 					   Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_ACTION
  *
  * language_extension  The extension name which holds the language keys used above.
  *                     For example, com_foobar, mod_something, plg_system_whatever, tpl_mytemplate
  *
  * language_client_id  Should we load the front-end (0) or back-end (1) language keys?
  *
  * version_introduced  Which was the version of your extension where this message appeared for the first time?
  *                     Example: 3.2.1
  *
  * enabled             Must be 1 for this message to be enabled. If you omit it, it defaults to 1.
  *
  * condition_file      The RAD path to a PHP file containing a PHP function which determines whether this message should be shown to
  *                     the user. @see FOFTemplateUtils::parsePath() for RAD path format. Joomla! will include this file before calling
  *                     the condition_method.
  *                     Example:   admin://components/com_foobar/helpers/postinstall.php
  *
  * condition_method    The name of a PHP function which will be used to determine whether to show this message to the user. This must be
  *                     a simple PHP user function (not a class method, static method etc) which returns true to show the message and false
  *                     to hide it. This function is defined in the condition_file.
  *                     Example: com_foobar_postinstall_messageone_condition
  *
  * When type=message no additional keys are required.
  *
  * When type=link the following additional keys are required:
  *
  * action  The URL which will open when the user clicks on the PIM's action button
  *         Example:    index.php?option=com_foobar&view=tools&task=installSampleData
  *
  * When type=action the following additional keys are required:
  *
  * action_file  The RAD path to a PHP file containing a PHP function which performs the action of this PIM. @see FOFTemplateUtils::parsePath()
  *              for RAD path format. Joomla! will include this file before calling the function defined in the action key below.
  *              Example:   admin://components/com_foobar/helpers/postinstall.php
  *
  * action       The name of a PHP function which will be used to run the action of this PIM. This must be a simple PHP user function
  *              (not a class method, static method etc) which returns no result.
  *              Example: com_foobar_postinstall_messageone_action
  *
  * @param   array  $options  See description
  *
  * @return  $this
  *
  * @throws  Exception
  */
 public function addPostInstallationMessage(array $options)
 {
     // Make sure there are options set
     if (!is_array($options)) {
         throw new Exception('Post-installation message definitions must be of type array', 500);
     }
     // Initialise array keys
     $defaultOptions = array('extension_id' => '', 'type' => '', 'title_key' => '', 'description_key' => '', 'action_key' => '', 'language_extension' => '', 'language_client_id' => '', 'action_file' => '', 'action' => '', 'condition_file' => '', 'condition_method' => '', 'version_introduced' => '', 'enabled' => '1');
     $options = array_merge($defaultOptions, $options);
     // Array normalisation. Removes array keys not belonging to a definition.
     $defaultKeys = array_keys($defaultOptions);
     $allKeys = array_keys($options);
     $extraKeys = array_diff($allKeys, $defaultKeys);
     if (!empty($extraKeys)) {
         foreach ($extraKeys as $key) {
             unset($options[$key]);
         }
     }
     // Normalisation of integer values
     $options['extension_id'] = (int) $options['extension_id'];
     $options['language_client_id'] = (int) $options['language_client_id'];
     $options['enabled'] = (int) $options['enabled'];
     // Normalisation of 0/1 values
     foreach (array('language_client_id', 'enabled') as $key) {
         $options[$key] = $options[$key] ? 1 : 0;
     }
     // Make sure there's an extension_id
     if (!(int) $options['extension_id']) {
         throw new Exception('Post-installation message definitions need an extension_id', 500);
     }
     // Make sure there's a valid type
     if (!in_array($options['type'], array('message', 'link', 'action'))) {
         throw new Exception('Post-installation message definitions need to declare a type of message, link or action', 500);
     }
     // Make sure there's a title key
     if (empty($options['title_key'])) {
         throw new Exception('Post-installation message definitions need a title key', 500);
     }
     // Make sure there's a description key
     if (empty($options['description_key'])) {
         throw new Exception('Post-installation message definitions need a description key', 500);
     }
     // If the type is anything other than message you need an action key
     if ($options['type'] != 'message' && empty($options['action_key'])) {
         throw new Exception('Post-installation message definitions need an action key when they are of type "' . $options['type'] . '"', 500);
     }
     // You must specify the language extension
     if (empty($options['language_extension'])) {
         throw new Exception('Post-installation message definitions need to specify which extension contains their language keys', 500);
     }
     // The action file and method are only required for the "action" type
     if ($options['type'] == 'action') {
         if (empty($options['action_file'])) {
             throw new Exception('Post-installation message definitions need an action file when they are of type "action"', 500);
         }
         $file_path = FOFTemplateUtils::parsePath($options['action_file'], true);
         if (!@is_file($file_path)) {
             throw new Exception('The action file ' . $options['action_file'] . ' of your post-installation message definition does not exist', 500);
         }
         if (empty($options['action'])) {
             throw new Exception('Post-installation message definitions need an action (function name) when they are of type "action"', 500);
         }
     }
     if ($options['type'] == 'link') {
         if (empty($options['link'])) {
             throw new Exception('Post-installation message definitions need an action (URL) when they are of type "link"', 500);
         }
     }
     // The condition file and method are only required when the type is not "message"
     if ($options['type'] != 'message') {
         if (empty($options['condition_file'])) {
             throw new Exception('Post-installation message definitions need a condition file when they are of type "' . $options['type'] . '"', 500);
         }
         $file_path = FOFTemplateUtils::parsePath($options['condition_file'], true);
         if (!@is_file($file_path)) {
             throw new Exception('The condition file ' . $options['condition_file'] . ' of your post-installation message definition does not exist', 500);
         }
         if (empty($options['condition_method'])) {
             throw new Exception('Post-installation message definitions need a condition method (function name) when they are of type "' . $options['type'] . '"', 500);
         }
     }
     // Check if the definition exists
     $table = $this->getTable();
     $tableName = $table->getTableName();
     $db = $this->getDbo();
     $query = $db->getQuery(true)->select('*')->from($db->qn($tableName))->where($db->qn('extension_id') . ' = ' . $db->q($options['extension_id']))->where($db->qn('type') . ' = ' . $db->q($options['type']))->where($db->qn('title_key') . ' = ' . $db->q($options['title_key']));
     $existingRow = $db->setQuery($query)->loadAssoc();
     // Is the existing definition the same as the one we're trying to save?
     if (!empty($existingRow)) {
         $same = true;
         foreach ($options as $k => $v) {
             if ($existingRow[$k] != $v) {
                 $same = false;
                 break;
             }
         }
         // Trying to add the same row as the existing one; quit
         if ($same) {
             return $this;
         }
         // Otherwise it's not the same row. Remove the old row before insert a new one.
         $query = $db->getQuery(true)->delete($db->qn($tableName))->where($db->q('extension_id') . ' = ' . $db->q($options['extension_id']))->where($db->q('type') . ' = ' . $db->q($options['type']))->where($db->q('title_key') . ' = ' . $db->q($options['title_key']));
         $db->setQuery($query)->execute();
     }
     // Insert the new row
     $options = (object) $options;
     $db->insertObject($tableName, $options);
     return $this;
 }
Ejemplo n.º 8
0
<?php

/**
 * @package AkeebaBackup
 * @copyright Copyright (c)2009-2014 Nicholas K. Dionysopoulos
 * @license GNU General Public License version 3, or later
 *
 * @since 3.3
 */
defined('_JEXEC') or die('');
JLoader::import('joomla.application.component.model');
JLoader::import('joomla.installer.installer');
JLoader::import('joomla.installer.helper');
require_once FOFTemplateUtils::parsePath('admin://components/com_installer/models/install.php', true);
/**
 * Class AkeebaModelInstaller extends the core com_installer InstallerModelInstall model,
 * adding the brains which decide how to perform the SRP backup in each case.
 */
class AkeebaModelInstaller extends InstallerModelInstall
{
    /**
     * Fetches a package from the upload form and saves it to the temporary directory
     *
     * @return  boolean  True if the upload is successful
     */
    public function upload()
    {
        // Get the uploaded file information
        $userfile = JRequest::getVar('install_package', null, 'files', 'array');
        // Make sure that file uploads are enabled in php
        if (!(bool) ini_get('file_uploads')) {
Ejemplo n.º 9
0
 /**
  * List post-processing. This is used to run the programmatic display
  * conditions against each list item and decide if we have to show it or
  * not.
  *
  * Do note that this a core method of the RAD Layer which operates directly
  * on the list it's being fed. A little touch of modern magic.
  *
  * @param   array  $resultArray  A list of items to process
  *
  * @return  void
  *
  * @since   3.2
  */
 protected function onProcessList(&$resultArray)
 {
     $unset_keys = array();
     $language_extensions = array();
     foreach ($resultArray as $key => $item) {
         // Filter out messages based on dynamically loaded programmatic conditions
         if (!empty($item->condition_file) && !empty($item->condition_method)) {
             jimport('joomla.filesystem.file');
             $file = FOFTemplateUtils::parsePath($item->condition_file, true);
             if (JFile::exists($file)) {
                 require_once $file;
                 $result = call_user_func($item->condition_method);
                 if ($result === false) {
                     $unset_keys[] = $key;
                 }
             }
         }
         // Load the necessary language files
         if (!empty($item->language_extension)) {
             $hash = $item->language_client_id . '-' . $item->language_extension;
             if (!in_array($hash, $language_extensions)) {
                 $language_extensions[] = $hash;
                 JFactory::getLanguage()->load($item->language_extension, $item->language_client_id == 0 ? JPATH_SITE : JPATH_ADMINISTRATOR);
             }
         }
     }
     if (!empty($unset_keys)) {
         foreach ($unset_keys as $key) {
             unset($resultArray[$key]);
         }
     }
 }
Ejemplo n.º 10
0
 public function onAfterInitialise()
 {
     // Make sure this is the back-end
     $app = JFactory::getApplication();
     if (!in_array($app->getName(), array('administrator', 'admin'))) {
         return;
     }
     // If the user tried to access Joomla!'s com_installer, hijack his
     // request and forward him to our private, improved implementation!
     $input = JFactory::getApplication()->input;
     $component = $input->getCmd('option', '');
     $task = $input->getCmd('task', '');
     $skipsrp = $input->getInt('skipsrp', 0);
     $view = $input->getCmd('view', '');
     $installtype = $input->getCmd('installtype', 'upload');
     // In case we are told not to enable SRP
     if ($skipsrp && (!empty($view) && ($view != 'update' && empty($task)))) {
         return;
     } elseif ($skipsrp && (empty($view) || ($view = 'update') && empty($task))) {
         $extraMessageFile = FOFTemplateUtils::parsePath('site://plugins/system/srp/tmpl/skipsrp.php', true);
         @ob_start();
         include_once $extraMessageFile;
         $extraMessage = @ob_get_clean();
         return;
     }
     // Only catch requests to the extensions installer
     if ($component != 'com_installer') {
         return;
     }
     // Only catch requests to com_installer's install and update views
     if (!in_array($view, array('install', 'update', 'akeeba', ''))) {
         return;
     }
     $lang = JFactory::getLanguage();
     $lang->load('com_akeeba', JPATH_ADMINISTRATOR, 'en-GB', true, false);
     $lang->load('com_akeeba', JPATH_ADMINISTRATOR, null, true, true);
     $lang->load('com_installer', JPATH_ADMINISTRATOR, 'en-GB', true, false);
     $lang->load('com_installer', JPATH_ADMINISTRATOR, null, true, true);
     require_once FOFTemplateUtils::parsePath('admin://components/com_akeeba/plugins/models/installer.php', true);
     $model = new AkeebaModelInstaller();
     if ($view == '' || $view == 'install' && empty($task)) {
         // Append an Akeeba Backup SRP notification message to the installer's cached message
         $message = $app->getUserState('com_installer.message', '');
         if (!empty($message)) {
             $message .= "<hr />";
         }
         // Load and add our custom message
         $extraMessageFile = FOFTemplateUtils::parsePath('site://plugins/system/srp/tmpl/message.php', true);
         @ob_start();
         include_once $extraMessageFile;
         $extraMessage = @ob_get_clean();
         $message .= $extraMessage;
         $app->setUserState('com_installer.message', $message);
     } elseif ($view == 'update' && empty($task)) {
         // Show an Akeeba Backup SRP notification message
         $lang = JFactory::getLanguage();
         $lang->load('com_akeeba', JPATH_ADMINISTRATOR, 'en-GB', true, false);
         $lang->load('com_akeeba', JPATH_ADMINISTRATOR, null, true, true);
         $extraMessageFile = FOFTemplateUtils::parsePath('site://plugins/system/srp/tmpl/update_message.php', true);
         @ob_start();
         include_once $extraMessageFile;
         self::$extraMessage = @ob_get_clean();
     } elseif ($task == 'install.install') {
         $context = 'com_installer.install';
         // Set FTP credentials, if given, saving them to the session for later use
         JClientHelper::setCredentialsFromRequest('ftp');
         $ftpCredentials = JClientHelper::getCredentials('ftp');
         $session = JFactory::getSession();
         $session->set('ftp', $ftpCredentials, 'akeeba');
         switch ($installtype) {
             case 'upload':
                 if ($model->upload()) {
                     // Go to extraction step
                     $url = JRoute::_('index.php?option=com_installer&view=install&task=install.akextract', false);
                     JFactory::getApplication()->redirect($url);
                 } else {
                     // We failed :(
                     $this->_cleanUpSession();
                     $url = JRoute::_('index.php?option=com_installer&view=install', false);
                     JFactory::getApplication()->redirect($url);
                 }
                 break;
             case 'url':
                 if ($model->download()) {
                     // Go to extraction step
                     $url = JRoute::_('index.php?option=com_installer&view=install&task=install.akextract', false);
                     JFactory::getApplication()->redirect($url);
                 } else {
                     // We failed :(
                     $this->_cleanUpSession();
                     $url = JRoute::_('index.php?option=com_installer&view=install', false);
                     JFactory::getApplication()->redirect($url);
                 }
                 break;
             default:
             case 'folder':
                 // Save the package information to the session and go to the install.akpreinstall step
                 $model->fromDirectory();
                 $url = JRoute::_('index.php?option=com_installer&view=install&task=install.akpreinstall', false);
                 JFactory::getApplication()->redirect($url);
                 break;
         }
     } elseif ($task == 'install.akextract') {
         // Apply any saved FTP credentials
         $this->_applyFTPCredentials();
         // Extract the package and go to the install.akpreinstall step
         if ($model->extract()) {
             $url = JRoute::_('index.php?option=com_installer&view=install&task=install.akpreinstall', false);
             JFactory::getApplication()->redirect($url);
         } else {
             // We failed :(
             $this->_cleanUpSession();
             $url = JRoute::_('index.php?option=com_installer&view=install', false);
             JFactory::getApplication()->redirect($url);
         }
     } elseif ($task == 'install.akpreinstall') {
         // Apply any saved FTP credentials
         $this->_applyFTPCredentials();
         // Perform the pre-installation inspection. This is where we decide if we will take an SRP backup.
         // If an SRP backup is to be taken we redirect to Akeeba Backup, else to the install.akrealinstall
         // task of the controller.
         $srpURL = $model->getSrpUrl();
         if ($srpURL !== false) {
             JFactory::getApplication()->redirect($srpURL);
         } else {
             $url = JRoute::_('index.php?option=com_installer&view=install&task=install.akrealinstall', false);
             JFactory::getApplication()->redirect($url);
         }
     } elseif ($task == 'install.akrealinstall') {
         // Apply any saved FTP credentials
         $this->_applyFTPCredentials();
         // Manipulate the input object, faking an install from directory
         $session = JFactory::getSession();
         $package = $session->get('package', null, 'akeeba');
         $input = JFactory::getApplication()->input;
         $input->set('task', 'install.install');
         $input->set('installtype', 'folder');
         $input->set('install_directory', $package['dir']);
         // Run the real installation
         $model->install();
         // Clean up
         $model->cleanUp();
         // If we have any more UIDs we are updating. In this case go to update.akupdatedl
         $uid = $session->get('uid', array(), 'akeeba');
         if (!empty($uid)) {
             $session->set('package', null, 'akeeba');
             $session->set('compressed_package', null, 'akeeba');
             $redirect_url = JRoute::_('index.php?option=com_installer&view=update&task=update.akupdatedl', false);
             JFactory::getApplication()->redirect($redirect_url);
             return;
         }
         $this->_cleanUpSession();
         // Post installation redirection
         $app = JFactory::getApplication();
         $redirect_url = $app->getUserState('com_installer.redirect_url');
         if (empty($redirect_url)) {
             $redirect_url = JRoute::_('index.php?option=com_installer&view=install', false);
         } else {
             // Wipe out the user state when we're going to redirect
             $app->setUserState('com_installer.redirect_url', '');
             $app->setUserState('com_installer.message', '');
             $app->setUserState('com_installer.extension_message', '');
         }
         JFactory::getApplication()->redirect($redirect_url);
     } elseif ($task == 'update.update') {
         // Set FTP credentials, if given, saving them to the session for later use
         JClientHelper::setCredentialsFromRequest('ftp');
         $ftpCredentials = JClientHelper::getCredentials('ftp');
         $session = JFactory::getSession();
         $session->set('ftp', $ftpCredentials, 'akeeba');
         // Get the list of update record IDs (uids)
         $uid = $input->get('cid', array(), 'array');
         JArrayHelper::toInteger($uid, array());
         // Save uids in the session
         $session->set('uid', $uid, 'akeeba');
         // Go to update.akupdatedl step
         $url = JRoute::_('index.php?option=com_installer&view=update&task=update.akupdatedl', false);
         JFactory::getApplication()->redirect($url);
     } elseif ($task == 'update.akupdatedl') {
         // Apply any saved FTP credentials
         $this->_applyFTPCredentials();
         // Pop the next update ID and save the stack back to the session
         $session = JFactory::getSession();
         $uid = $session->get('uid', array(), 'akeeba');
         $currentUID = array_shift($uid);
         $session->set('uid', $uid, 'akeeba');
         // Download the update package
         if ($model->downloadUpdate($currentUID)) {
             $url = JRoute::_('index.php?option=com_installer&view=install&task=install.akextract', false);
             JFactory::getApplication()->redirect($url);
         } else {
             // We failed :(
             $this->_cleanUpSession();
             $url = JRoute::_('index.php?option=com_installer&view=install', false);
             JFactory::getApplication()->redirect($url);
         }
     } else {
         return;
     }
 }
Ejemplo n.º 11
0
 /**
  * Adds an arbitraty CSS file.
  *
  * @param $path string The path to the file, in the format media://path/to/file
  */
 public static function addCSSfile($path)
 {
     if (self::isCli()) {
         return;
     }
     self::$cssURLs[] = FOFTemplateUtils::parsePath($path);
 }
Ejemplo n.º 12
0
 /**
  * Adds an arbitrary CSS file.
  *
  * @param $path 		string 	The path to the file, in the format media://path/to/file
  * @param $overrideTag	string	If defined this version tag overrides AkeebaStrapper::$tag
  */
 public static function addCSSfile($path, $overrideTag = null)
 {
     if (self::isCli()) {
         return;
     }
     $tag = self::getTag($overrideTag);
     self::$cssURLs[] = array(FOFTemplateUtils::parsePath($path), $tag);
 }
			<?php 
    echo JHTML::_('select.genericlist', $this->logs, 'log', '', 'value', 'text', $this->log, 'log');
    ?>

			<button class="btn btn-primary" id="analyze-log" style="display:none">
				<i class="icon-download-alt icon-white"></i>
				<?php 
    echo JText::_('AKEEBA_ALICE_ANALYZE');
    ?>
			</button>
		</fieldset>

		<div id="stepper-holder" style="margin-top: 15px">
			<div id="stepper-loading" style="text-align: center;display: none">
				<img src="<?php 
    echo FOFTemplateUtils::parsePath('media://com_akeeba/icons/loading.gif');
    ?>
" />
			</div>
			<div id="stepper-progress-pane" style="display: none">
				<div class="alert">
					<i class="icon-warning-sign"></i>
					<?php 
    echo JText::_('BACKUP_TEXT_BACKINGUP');
    ?>
				</div>
				<fieldset>
					<legend><?php 
    echo JText::_('ALICE_ANALYZE_LABEL_PROGRESS');
    ?>
</legend>