/** * Executes before displaying the control panel page */ public function onBeforeMain() { /** @var ControlPanel $model */ $model = $this->getModel(); $statusHelper = Status::getInstance(); $this->statsIframe = ''; try { /** @var UsageStatistics $usageStatsModel */ $usageStatsModel = $this->container->factory->model('UsageStatistics')->tmpInstance(); if (is_object($usageStatsModel) && class_exists('Akeeba\\Backup\\Admin\\Model\\UsageStatistics') && $usageStatsModel instanceof UsageStatistics && method_exists($usageStatsModel, 'collectStatistics')) { $this->statsIframe = $usageStatsModel->collectStatistics(true); } } catch (\Exception $e) { // Don't give a crap if usage stats ain't loaded } $this->getProfileList(); $this->getProfileIdAndName(); $this->quickIconProfiles = $model->getQuickIconProfiles(); $this->statusCell = $statusHelper->getStatusCell(); $this->detailsCell = $statusHelper->getQuirksCell(); $this->latestBackupCell = $statusHelper->getLatestBackupDetails(); $this->areMediaPermissionsFixed = $model->fixMediaPermissions(); $this->checkMbstring = $model->checkMbstring(); $this->needsDownloadID = $model->needsDownloadID() ? 1 : 0; $this->coreWarningForDownloadID = $model->mustWarnAboutDownloadIDInCore(); $this->extension_id = $model->getState('extension_id', 0, 'int'); $this->frontEndSecretWordIssue = $model->getFrontendSecretWordError(); $this->newSecretWord = $this->container->session->get('newSecretWord', null, 'akeeba.cpanel'); $this->desktopNotifications = $this->container->params->get('desktop_notifications', '0') ? 1 : 0; $this->formattedChangelog = $this->formatChangelog(); $this->promptForConfigurationWizard = Factory::getConfiguration()->get('akeeba.flag.confwiz', 0) == 0; $this->countWarnings = count(Factory::getConfigurationChecks()->getDetailedStatus()); // Load the version constants Platform::getInstance()->load_version_defines(); // Set up the GUI behaviours JHtml::_('behavior.modal'); JHtml::_('formbehavior.chosen'); // Add the Javascript to the document $this->addJavascriptFile('media://com_akeeba/js/ControlPanel.min.js'); $this->inlineJavascript(); }
/** * Runs before displaying the backup page */ public function onBeforeMain() { // Load the view-specific Javascript $this->addJavascriptFile('media://com_akeeba/js/Backup.min.js'); // Preload Joomla! behaviours JLoader::import('joomla.utilities.date'); JHtml::_('formbehavior.chosen'); // Load the models /** @var Backup $model */ $model = $this->getModel(); /** @var ControlPanel $cpanelmodel */ $cpanelmodel = $this->container->factory->model('ControlPanel')->tmpInstance(); // Load the Status Helper $helper = Status::getInstance(); // Determine default description $default_description = $this->getDefaultDescription(); // Load data from the model state $backup_description = $model->getState('description', $default_description); $comment = $model->getState('comment', ''); $returnurl = $model->getState('returnurl'); // Only allow non-empty, internal URLs for the redirection if (empty($returnurl)) { $returnurl = ''; } if (!JUri::isInternal($returnurl)) { $returnurl = ''; } // Get the maximum execution time and bias $engineConfiguration = Factory::getConfiguration(); $maxexec = $engineConfiguration->get('akeeba.tuning.max_exec_time', 14) * 1000; $bias = $engineConfiguration->get('akeeba.tuning.run_time_bias', 75); // Check if the output directory is writable $warnings = Factory::getConfigurationChecks()->getDetailedStatus(); $unwritableOutput = array_key_exists('001', $warnings); // Pass on data $this->getProfileList(); $this->getProfileIdAndName(); $this->hasErrors = !$helper->status; $this->hasWarnings = $helper->hasQuirks(); $this->warningsCell = $helper->getQuirksCell(!$helper->status); $this->description = $backup_description; $this->defaultDescription = $default_description; $this->comment = $comment; $this->domains = json_encode($this->getDomains()); $this->maxExecutionTime = $maxexec; $this->runtimeBias = $bias; $this->useIFRAME = $engineConfiguration->get('akeeba.basic.useiframe', 0) == 1; $this->returnURL = $returnurl; $this->unwriteableOutput = $unwritableOutput; $this->autoStart = $model->getState('autostart'); $this->desktopNotifications = $this->container->params->get('desktop_notifications', '0') ? 1 : 0; $this->autoResume = $engineConfiguration->get('akeeba.advanced.autoresume', 1); $this->autoResumeTimeout = $engineConfiguration->get('akeeba.advanced.autoresume_timeout', 10); $this->autoResumeRetries = $engineConfiguration->get('akeeba.advanced.autoresume_maxretries', 3); $this->promptForConfigurationWizard = $engineConfiguration->get('akeeba.flag.confwiz', 0) == 0; if ($engineConfiguration->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') { $this->showJPSPassword = 1; $this->jpsPassword = $engineConfiguration->get('engine.archiver.jps.key', ''); } if (AKEEBA_PRO) { $this->showANGIEPassword = 1; $this->ANGIEPassword = $engineConfiguration->get('engine.installer.angie.key', ''); } // Push language strings to Javascript JText::script('COM_AKEEBA_BACKUP_TEXT_LASTRESPONSE'); JText::script('COM_AKEEBA_BACKUP_TEXT_BACKUPSTARTED'); JText::script('COM_AKEEBA_BACKUP_TEXT_BACKUPFINISHED'); JText::script('COM_AKEEBA_BACKUP_TEXT_BACKUPHALT'); JText::script('COM_AKEEBA_BACKUP_TEXT_BACKUPRESUME'); JText::script('COM_AKEEBA_BACKUP_TEXT_BACKUPHALT_DESC'); JText::script('COM_AKEEBA_BACKUP_TEXT_BACKUPFAILED'); JText::script('COM_AKEEBA_BACKUP_TEXT_BACKUPWARNING'); JText::script('COM_AKEEBA_BACKUP_TEXT_AVGWARNING'); }