public function getPaths() { $ret = (object) array('cli' => (object) array('supported' => false, 'path' => false), 'altcli' => (object) array('supported' => false, 'path' => false), 'frontend' => (object) array('supported' => false, 'path' => false), 'info' => (object) array('windows' => false, 'php_path' => false, 'root_url' => false, 'secret' => '', 'feenabled' => false)); // Get the profile ID $profileid = 1; // Get the absolute path to the site's root $absolute_root = rtrim(realpath(JPATH_ROOT), DIRECTORY_SEPARATOR); // Is this Windows? $ret->info->windows = DIRECTORY_SEPARATOR == '\\' || substr(strtoupper(PHP_OS), 0, 3) == 'WIN'; // Get the pseudo-path to PHP CLI if ($ret->info->windows) { $ret->info->php_path = 'c:\\path\\to\\php.exe'; } else { $ret->info->php_path = '/path/to/php'; } // Get front-end backup secret key $ret->info->secret = Comconfig::getValue('frontend_secret_word', ''); $ret->info->feenabled = Comconfig::getValue('frontend_enable', false); // Get root URL $ret->info->root_url = rtrim(Comconfig::getValue('siteurl', ''), '/'); // Get information for CLI CRON script $ret->cli->supported = true; $ret->cli->path = $absolute_root . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'admintools-filescanner.php'; // Get information for alternative CLI CRON script $ret->altcli->supported = true; if (trim($ret->info->secret) && $ret->info->feenabled) { $ret->altcli->path = $absolute_root . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'admintools-filescanner-alt.php'; } // Get information for front-end backup $ret->frontend->supported = true; if (trim($ret->info->secret) && $ret->info->feenabled) { $ret->frontend->path = 'index.php?option=com_admintools&view=filescanner&key=' . urlencode($ret->info->secret); } return $ret; }
protected function onAdd($tpl = null) { /** @var AkeebaModelCpanels $model */ $model = $this->getModel(); $aeconfig = Factory::getConfiguration(); // Load the helper classes $this->loadHelper('utils'); $this->loadHelper('status'); $statusHelper = AkeebaHelperStatus::getInstance(); // Load the model if (!class_exists('AkeebaModelStatistics')) { JLoader::import('models.statistics', JPATH_COMPONENT_ADMINISTRATOR); } $statmodel = new AkeebaModelStatistics(); $this->profileid = $model->getProfileID(); // Active profile ID $this->profilelist = $model->getProfilesList(); // List of available profiles $this->statuscell = $statusHelper->getStatusCell(); // Backup status $this->detailscell = $statusHelper->getQuirksCell(); // Details (warnings) $this->statscell = $statmodel->getLatestBackupDetails(); $this->fixedpermissions = $model->fixMediaPermissions(); // Fix media/com_akeeba permissions $this->needsdlid = $model->needsDownloadID(); $this->needscoredlidwarning = $model->mustWarnAboutDownloadIDInCore(); $this->extension_id = $model->getState('extension_id', 0, 'int'); // Should I ask for permission to display desktop notifications? JLoader::import('joomla.application.component.helper'); $this->desktop_notifications = \Akeeba\Engine\Util\Comconfig::getValue('desktop_notifications', '0') ? 1 : 0; $this->statsIframe = F0FModel::getTmpInstance('Stats', 'AkeebaModel')->collectStatistics(true); return $this->onDisplay($tpl); }
/** * Public constructor. Initialises the protected members as well. * * @param array $config */ public function __construct($config = array()) { parent::__construct($config); $isPro = defined('AKEEBA_PRO') ? AKEEBA_PRO : 0; JLoader::import('joomla.application.component.helper'); $dlid = \Akeeba\Engine\Util\Comconfig::getValue('update_dlid', ''); $this->extraQuery = null; // If I have a valid Download ID I will need to use a non-blank extra_query in Joomla! 3.2+ if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) { // Even if the user entered a Download ID in the Core version. Let's switch his update channel to Professional $isPro = true; $this->extraQuery = 'dlid=' . $dlid; } $this->updateSiteName = 'Akeeba Backup ' . ($isPro ? 'Professional' : 'Core'); $this->updateSite = 'http://cdn.akeebabackup.com/updates/ab' . ($isPro ? 'pro' : 'core') . '.xml'; }
<li><?php echo JText::_('AKEEBA_CPANEL_WARN_PERMS_L3B'); ?> </li> </ol> <p><?php echo JText::_('AKEEBA_CPANEL_WARN_PERMS_L4'); ?> </p> </div> <?php } ?> <?php if (!version_compare(PHP_VERSION, '5.3.0', 'ge') && Comconfig::getValue('displayphpwarning', 1)) { ?> <div class="alert"> <a class="close" data-dismiss="alert" href="#">×</a> <p><strong><?php echo JText::_('COM_AKEEBA_CONFIG_LBL_OUTDATEDPHP_HEADER'); ?> </strong><br/> <?php echo JText::_('COM_AKEEBA_CONFIG_LBL_OUTDATEDPHP_BODY'); ?> </p> <p> <a class="btn btn-small btn-primary" href="index.php?option=com_akeeba&view=cpanel&task=disablephpwarning&<?php echo JFactory::getSession()->getFormToken();
$('#backup-start').bind("click", function(e){ akeeba.Backup.start(); }); $('#backup-default').click(akeeba.Backup.restoreDefaultOptions); // Work around Safari which ignores autocomplete=off (FOR CRYING OUT LOUD!) setTimeout('akeeba.Backup.restoreDefaultOptions();', 500); <?php } ?> }); </script> <?php if (!version_compare(PHP_VERSION, '5.4.0', 'ge') && \Akeeba\Engine\Util\Comconfig::getValue('displayphpwarning', 1)) { ?> <div class="alert"> <a class="close" data-dismiss="alert" href="#">×</a> <p><strong><?php echo JText::_('COM_AKEEBA_CONFIG_LBL_OUTDATEDPHP_HEADER'); ?> </strong><br/> <?php echo JText::sprintf('COM_AKEEBA_CONFIG_LBL_OUTDATEDPHP_BODY', PHP_VERSION); ?> </p> <?php if (function_exists('base64_encode')) { $returnurl = '&returnurl=' . base64_encode(JUri::getInstance()->toString());
/** * Does the user need to enter a Download ID in the component's Options page? * * @return bool */ public function needsDownloadID() { // Do I need a Download ID? $ret = true; $isPro = AKEEBA_PRO; if (!$isPro) { $ret = false; } else { JLoader::import('joomla.application.component.helper'); $dlid = \Akeeba\Engine\Util\Comconfig::getValue('update_dlid', ''); if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) { $ret = false; } } return $ret; }
/** * @package AkeebaBackup * @copyright Copyright (c)2009-2014 Nicholas K. Dionysopoulos * @license GNU General Public License version 3, or later * * @since 1.3 */ // Protect from unauthorized access defined('_JEXEC') or die; /** @var AkeebaViewBuadmin $this */ JHtml::_('behavior.calendar'); JHtml::_('behavior.modal'); JHtml::_('bootstrap.popover', '.akeebaCommentPopover', array('animation' => true, 'html' => true, 'title' => JText::_('STATS_LABEL_COMMENT'), 'placement' => 'bottom')); JFactory::getDocument()->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css'); $dateFormat = \Akeeba\Engine\Util\Comconfig::getValue('dateformat', ''); $dateFormat = trim($dateFormat); $dateFormat = !empty($dateFormat) ? $dateFormat : JText::_('DATE_FORMAT_LC4'); // Filesize formatting function by eregon at msn dot com // Published at: http://www.php.net/manual/en/function.number-format.php function format_filesize($number, $decimals = 2, $force_unit = false, $dec_char = '.', $thousands_char = '') { if ($number <= 0) { return '-'; } $units = array('b', 'Kb', 'Mb', 'Gb', 'Tb'); if ($force_unit === false) { $unit = floor(log($number, 2) / 10); } else { $unit = $force_unit; }
/** * This mess of a code is probably not one of my highlights in my code * writing career. It's logically organized, badly architectured but I can * still maintain it - and it works! */ public function onAdd($tpl = null) { AkeebaStrapper::addJSfile('media://com_akeeba/js/backup.js'); /** @var AkeebaModelBackups $model */ $model = $this->getModel(); // Load the Status Helper if (!class_exists('AkeebaHelperStatus')) { JLoader::import('helpers.status', JPATH_COMPONENT_ADMINISTRATOR); } $helper = AkeebaHelperStatus::getInstance(); // Determine default description JLoader::import('joomla.utilities.date'); $jregistry = JFactory::getConfig(); $tzDefault = $jregistry->get('offset'); $user = JFactory::getUser(); $tz = $user->getParam('timezone', $tzDefault); $dateNow = new JDate('now', $tz); $default_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true); $default_description = AkeebaHelperEscape::escapeJS($default_description, "'"); $backup_description = $model->getState('description', $default_description); $comment = $model->getState('comment', ''); // Get a potential return URL $returnurl = $model->getState('returnurl'); if (empty($returnurl)) { $returnurl = ''; } // Only allow internal URLs for the redirection if (!JUri::isInternal($returnurl)) { $returnurl = ''; } // If a return URL is set *and* the profile's name is "Site Transfer // Wizard", we are running the Site Transfer Wizard if (!class_exists('AkeebaModelProfiles')) { JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR); } /** @var AkeebaModelCpanels $cpanelmodel */ $cpanelmodel = F0FModel::getAnInstance('Cpanels', 'AkeebaModel'); $profilemodel = new AkeebaModelProfiles(); $profilemodel->setId($cpanelmodel->getProfileID()); $profile_data = $profilemodel->getProfile(); // Get the domain details from scripting facility $registry = Factory::getConfiguration(); $tag = $model->getState('tag'); $script = $registry->get('akeeba.basic.backup_type', 'full'); $scripting = Factory::getEngineParamsProvider()->loadScripting(); $domains = array(); if (!empty($scripting)) { foreach ($scripting['scripts'][$script]['chain'] as $domain) { $description = JText::_($scripting['domains'][$domain]['text']); $domain_key = $scripting['domains'][$domain]['domain']; $domains[] = array($domain_key, $description); } } $json_domains = AkeebaHelperEscape::escapeJS(json_encode($domains), '"\\'); // Get the maximum execution time and bias $maxexec = $registry->get('akeeba.tuning.max_exec_time', 14) * 1000; $bias = $registry->get('akeeba.tuning.run_time_bias', 75); // Check if the output directory is writable $quirks = Factory::getConfigurationChecks()->getDetailedStatus(); $unwritableOutput = array_key_exists('001', $quirks); // Pass on data $this->haserrors = !$helper->status; $this->hasquirks = $helper->hasQuirks(); $this->quirks = $helper->getQuirksCell(!$helper->status); $this->description = $backup_description; $this->default_descr = $default_description; $this->comment = $comment; $this->domains = $json_domains; $this->maxexec = $maxexec; $this->bias = $bias; $this->useiframe = $registry->get('akeeba.basic.useiframe', 0) ? 'true' : 'false'; $this->returnurl = $returnurl; $this->unwritableoutput = $unwritableOutput; if ($registry->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') { $this->showjpskey = 1; $this->jpskey = $registry->get('engine.archiver.jps.key', ''); } else { $this->showjpskey = 0; } if (AKEEBA_PRO) { $this->showangiekey = 1; $this->angiekey = $registry->get('engine.installer.angie.key', ''); } else { $this->showangiekey = 0; $this->angiekey = ''; } $this->autostart = $model->getState('autostart'); // Pass on profile info $this->profileid = $cpanelmodel->getProfileID(); // Active profile ID $this->profilelist = $cpanelmodel->getProfilesList(); // List of available profiles // Should I ask for permission to display desktop notifications? JLoader::import('joomla.application.component.helper'); $this->desktop_notifications = \Akeeba\Engine\Util\Comconfig::getValue('desktop_notifications', '0') ? 1 : 0; // Set the toolbar title $subtitle = JText::_('BACKUP'); JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . $subtitle . '</small>', 'akeeba'); return true; }
/** * Loads a platform-specific software configuration option * * @param string $key * @param mixed $default * * @return mixed */ public function get_platform_configuration_option($key, $default) { // Get the component configuration option WITHOUT using the ever-changing Joomla! API... return Comconfig::getValue($key, $default); }