示例#1
0
 public function __construct(array $config)
 {
     parent::__construct($config);
     // Load the Akeeba Engine autoloader
     define('AKEEBAENGINE', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_admintools/engine/Autoloader.php';
     // Load the platform
     \Akeeba\Engine\Platform::addPlatform('filescan', JPATH_ADMINISTRATOR . '/components/com_admintools/platform/Filescan');
 }
示例#2
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Load the Akeeba Engine autoloader
     define('AKEEBAENGINE', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_admintools/engine/Autoloader.php';
     // Load the platform
     \Akeeba\Engine\Platform::addPlatform('filescan', JPATH_ADMINISTRATOR . '/components/com_admintools/platform/Filescan');
     // Load the engine configuration
     \Akeeba\Engine\Platform::getInstance()->load_configuration(1);
     $this->aeconfig = \Akeeba\Engine\Factory::getConfiguration();
 }
示例#3
0
 /**
  * Executes before dispatching the request to the appropriate controller
  */
 public function onBeforeDispatch()
 {
     $this->onBeforeDispatchViewAliases();
     // Load the FOF language
     $lang = $this->container->platform->getLanguage();
     $lang->load('lib_fof30', JPATH_SITE, 'en-GB', true, true);
     $lang->load('lib_fof30', JPATH_SITE, null, true, false);
     // Necessary defines for Akeeba Engine
     if (!defined('AKEEBAENGINE')) {
         define('AKEEBAENGINE', 1);
         define('AKEEBAROOT', $this->container->backEndPath . '/BackupEngine');
         define('ALICEROOT', $this->container->backEndPath . '/AliceEngine');
     }
     // Make sure we have a profile set throughout the component's lifetime
     $session = $this->container->session;
     $profile_id = $session->get('profile', null, 'akeeba');
     if (is_null($profile_id)) {
         $session->set('profile', 1, 'akeeba');
     }
     // Load Akeeba Engine
     $basePath = $this->container->backEndPath;
     require_once $basePath . '/BackupEngine/Factory.php';
     // Load the Akeeba Engine configuration
     Platform::addPlatform('joomla3x', JPATH_COMPONENT_ADMINISTRATOR . '/BackupPlatform/Joomla3x');
     $akeebaEngineConfig = Factory::getConfiguration();
     Platform::getInstance()->load_configuration();
     unset($akeebaEngineConfig);
     // Prevents the "SQLSTATE[HY000]: General error: 2014" due to resource sharing with Akeeba Engine
     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     // !!!!! WARNING: ALWAYS GO THROUGH JFactory; DO NOT GO THROUGH $this->container->db !!!!!
     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     $jDbo = JFactory::getDbo();
     if ($jDbo->name == 'pdomysql') {
         @JFactory::getDbo()->disconnect();
     }
     // Load the utils helper library
     Platform::getInstance()->load_version_defines();
     // Make sure we have a version loaded
     @(include_once $this->container->backEndPath . '/components/com_akeeba/version.php');
     if (!defined('AKEEBA_VERSION')) {
         define('AKEEBA_VERSION', 'dev');
         define('AKEEBA_DATE', date('Y-m-d'));
     }
     // Create a media file versioning tag
     $this->container->mediaVersion = md5(AKEEBA_VERSION . AKEEBA_DATE);
 }
示例#4
0
/**
 * Apply the ANGIE upgrade
 */
function com_akeeba_postinstall_angie_action()
{
    // Necessary defines for Akeeba Engine
    if (!defined('AKEEBAENGINE')) {
        define('AKEEBAENGINE', 1);
        // Required for accessing Akeeba Engine's factory class
        define('AKEEBAROOT', dirname(__FILE__) . '/../akeeba');
        define('ALICEROOT', dirname(__FILE__) . '/../alice');
    }
    // Load the factory
    require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/engine/Factory.php';
    \Akeeba\Engine\Platform::addPlatform('joomla25', JPATH_ADMINISTRATOR . '/components/com_akeeba/platform/joomla25');
    if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/alice/factory.php')) {
        @(require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/alice/factory.php');
    }
    // Get all profiles
    include_once JPATH_SITE . '/libraries/f0f/include.php';
    if (!defined('F0F_INCLUDED') || !class_exists('F0FForm', true)) {
        JError::raiseError('500', 'Your Akeeba Backup installation is broken; please re-install. Alternatively, extract the installation archive and copy the fof directory inside your site\'s libraries directory.');
        return;
    }
    $model = F0FModel::getTmpInstance('Cpanels', 'AkeebaModel');
    $db = JFactory::getDbo();
    $query = $db->getQuery(true)->select(array($db->qn('id')))->from($db->qn('#__ak_profiles'))->order($db->qn('id') . " ASC");
    $db->setQuery($query);
    $profiles = $db->loadColumn();
    // Save the current profile number
    $session = JFactory::getSession();
    $oldProfile = $session->get('profile', 1, 'akeeba');
    // Upgrade all profiles
    foreach ($profiles as $profile_id) {
        \Akeeba\Engine\Factory::nuke();
        \Akeeba\Engine\Platform::getInstance()->load_configuration($profile_id);
        $config = \Akeeba\Engine\Factory::getConfiguration();
        $config->set('akeeba.advanced.embedded_installer', 'angie');
        \Akeeba\Engine\Platform::getInstance()->save_configuration($profile_id);
    }
    // Restore the old profile
    \Akeeba\Engine\Factory::nuke();
    \Akeeba\Engine\Platform::getInstance()->load_configuration($oldProfile);
    com_akeeba_postinstall_common_savesettings(1);
}
示例#5
0
 public function dispatch()
 {
     if (!class_exists('AkeebaControllerDefault')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/controllers/default.php';
     }
     // Merge the language overrides
     $paths = array(JPATH_ROOT, JPATH_ADMINISTRATOR);
     $jlang = JFactory::getLanguage();
     $jlang->load($this->component, $paths[0], 'en-GB', true);
     $jlang->load($this->component, $paths[0], null, true);
     $jlang->load($this->component, $paths[1], 'en-GB', true);
     $jlang->load($this->component, $paths[1], null, true);
     $jlang->load($this->component . '.override', $paths[0], 'en-GB', true);
     $jlang->load($this->component . '.override', $paths[0], null, true);
     $jlang->load($this->component . '.override', $paths[1], 'en-GB', true);
     $jlang->load($this->component . '.override', $paths[1], null, true);
     F0FInflector::addWord('alice', 'alices');
     // Timezone fix; avoids errors printed out by PHP 5.3.3+ (thanks Yannick!)
     if (function_exists('date_default_timezone_get') && function_exists('date_default_timezone_set')) {
         if (function_exists('error_reporting')) {
             $oldLevel = error_reporting(0);
         }
         $serverTimezone = @date_default_timezone_get();
         if (empty($serverTimezone) || !is_string($serverTimezone)) {
             $serverTimezone = 'UTC';
         }
         if (function_exists('error_reporting')) {
             error_reporting($oldLevel);
         }
         @date_default_timezone_set($serverTimezone);
     }
     // Necessary defines for Akeeba Engine
     if (!defined('AKEEBAENGINE')) {
         define('AKEEBAENGINE', 1);
         // Required for accessing Akeeba Engine's factory class
         define('AKEEBAROOT', dirname(__FILE__) . '/akeeba');
         define('ALICEROOT', dirname(__FILE__) . '/alice');
     }
     // Setup Akeeba's ACLs, honoring laxed permissions in component's parameters, if set
     // Access check, Joomla! 1.6 style.
     $user = JFactory::getUser();
     if (!$user->authorise('core.manage', 'com_akeeba')) {
         return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     // Make sure we have a profile set throughout the component's lifetime
     $session = JFactory::getSession();
     $profile_id = $session->get('profile', null, 'akeeba');
     if (is_null($profile_id)) {
         // No profile is set in the session; use default profile
         $session->set('profile', 1, 'akeeba');
     }
     // Load Akeeba Engine and ALICE
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/engine/Factory.php';
     if (@file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/alice/factory.php')) {
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/alice/factory.php';
     }
     // Load the Akeeba Engine configuration
     Platform::addPlatform('joomla25', JPATH_COMPONENT_ADMINISTRATOR . '/platform/joomla25');
     $akeebaEngineConfig = Factory::getConfiguration();
     Platform::getInstance()->load_configuration();
     $jDbo = JFactory::getDbo();
     if ($jDbo->name == 'pdomysql') {
         // Prevents the "SQLSTATE[HY000]: General error: 2014" due to resource sharing with Akeeba Engine
         @JFactory::getDbo()->disconnect();
     }
     unset($akeebaEngineConfig);
     // Preload helpers
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/escape.php';
     // Load the utils helper library
     Platform::getInstance()->load_version_defines();
     // Create a versioning tag for our static files
     $staticFilesVersioningTag = md5(AKEEBA_VERSION . AKEEBA_DATE);
     define('AKEEBAMEDIATAG', $staticFilesVersioningTag);
     $this->input->set('view', $this->view);
     // Load JHtml behaviours as needed
     $this->loadJHtmlBehaviors();
     parent::dispatch();
 }
示例#6
0
    /**
     * This method is called when the Quick Icons module is constructing its set
     * of icons. You can return an array which defines a single icon and it will
     * be rendered right after the stock Quick Icons.
     *
     * @param  $context  The calling context
     *
     * @return array A list of icon definition associative arrays, consisting of the
     *                 keys link, image, text and access.
     *
     * @since       2.5
     */
    public function onGetIcons($context)
    {
        $user = JFactory::getUser();
        if (!$user->authorise('akeeba.backup', 'com_akeeba')) {
            return;
        }
        if ($context != $this->params->get('context', 'mod_quickicon') || !JFactory::getUser()->authorise('core.manage', 'com_installer')) {
            return;
        }
        Platform::addPlatform('joomla25', JPATH_ADMINISTRATOR . '/components/com_akeeba/platform/joomla25');
        $url = JUri::base();
        $url = rtrim($url, '/');
        $profileId = (int) $this->params->get('profileid', 1);
        $token = JFactory::getSession()->getToken();
        if ($profileId <= 0) {
            $profileId = 1;
        }
        $ret = array('link' => 'index.php?option=com_akeeba&view=backup&autostart=1&returnurl=' . urlencode($url) . '&profileid=' . $profileId . "&{$token}=1", 'image' => 'akeeba-black', 'text' => JText::_('PLG_QUICKICON_AKEEBABACKUP_OK'), 'id' => 'plg_quickicon_akeebabackup', 'group' => 'MOD_QUICKICON_MAINTENANCE');
        if (version_compare(JVERSION, '3.0', 'lt')) {
            $ret['image'] = $url . '/../media/com_akeeba/icons/akeeba-48.png';
        }
        if ($this->params->get('enablewarning', 0) == 0) {
            // Process warnings
            $warning = false;
            $aeconfig = Factory::getConfiguration();
            Platform::getInstance()->load_configuration();
            // Get latest non-SRP backup ID
            $filters = array(array('field' => 'tag', 'operand' => '<>', 'value' => 'restorepoint'));
            $ordering = array('by' => 'backupstart', 'order' => 'DESC');
            require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/models/statistics.php';
            $model = new AkeebaModelStatistics();
            $list = $model->getStatisticsListWithMeta(false, $filters, $ordering);
            if (!empty($list)) {
                $record = (object) array_shift($list);
            } else {
                $record = null;
            }
            // Process "failed backup" warnings, if specified
            if ($this->params->get('warnfailed', 0) == 0) {
                if (!is_null($record)) {
                    $warning = $record->status == 'fail' || $record->status == 'run';
                }
            }
            // Process "stale backup" warnings, if specified
            if (is_null($record)) {
                $warning = true;
            } else {
                $maxperiod = $this->params->get('maxbackupperiod', 24);
                JLoader::import('joomla.utilities.date');
                $lastBackupRaw = $record->backupstart;
                $lastBackupObject = new JDate($lastBackupRaw);
                $lastBackup = $lastBackupObject->toUnix(false);
                $maxBackup = time() - $maxperiod * 3600;
                if (!$warning) {
                    $warning = $lastBackup < $maxBackup;
                }
            }
            if ($warning) {
                $ret['image'] = 'akeeba-red';
                $ret['text'] = JText::_('PLG_QUICKICON_AKEEBABACKUP_BACKUPREQUIRED');
                if (version_compare(JVERSION, '3.0', 'lt')) {
                    $ret['image'] = $url . '/../media/com_akeeba/icons/akeeba-warning-48.png';
                } else {
                    $ret['text'] = '<span class="badge badge-important">' . $ret['text'] . '</span>';
                }
            }
        }
        if (version_compare(JVERSION, '3.0', 'gt')) {
            $inlineCSS = <<<CSS
.icon-akeeba-black {
\tbackground-image: url("../media/com_akeeba/icons/akeebabackup-16-black.png");
\twidth: 16px;
\theight: 16px;
}

.icon-akeeba-red {
\tbackground-image: url("../media/com_akeeba/icons/akeebabackup-16-red.png");
\twidth: 16px;
\theight: 16px;
}

.quick-icons .nav-list [class^="icon-akeeba-"], .quick-icons .nav-list [class*=" icon-akeeba-"] {
\tmargin-right: 7px;
}

.quick-icons .nav-list [class^="icon-akeeba-red"], .quick-icons .nav-list [class*=" icon-akeeba-red"] {
\tmargin-bottom: -4px;
}
CSS;
            JFactory::getApplication()->getDocument()->addStyleDeclaration($inlineCSS);
        }
        // Re-enable self
        $db = JFactory::getDbo();
        $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('1'))->where($db->qn('element') . ' = ' . $db->q('akeebabackup'))->where($db->qn('folder') . ' = ' . $db->q('quickicon'));
        $db->setQuery($query);
        $db->execute();
        F0FUtilsCacheCleaner::clearPluginsCache();
        return array($ret);
    }
示例#7
0
 /**
  * Loads the Akeeba Engine if it's not already loaded
  */
 private function loadAkeebaEngine()
 {
     if (class_exists('\\Akeeba\\Engine\\Platform')) {
         return;
     }
     // Load the language files
     $paths = array(JPATH_ADMINISTRATOR, JPATH_ROOT);
     $jlang = JFactory::getLanguage();
     $jlang->load('com_akeeba', $paths[0], 'en-GB', true);
     $jlang->load('com_akeeba', $paths[1], 'en-GB', true);
     $jlang->load('com_akeeba' . '.override', $paths[0], 'en-GB', true);
     $jlang->load('com_akeeba' . '.override', $paths[1], 'en-GB', true);
     // Load the version file
     @(include_once JPATH_ADMINISTRATOR . '/components/com_akeeba/version.php');
     if (!defined('AKEEBA_PRO')) {
         define('AKEEBA_PRO', '0');
     }
     // Enable Akeeba Engine
     if (!defined('AKEEBAENGINE')) {
         define('AKEEBAENGINE', 1);
     }
     // Load the engine
     $factoryPath = JPATH_ADMINISTRATOR . '/components/com_akeeba/engine/Factory.php';
     define('AKEEBAROOT', JPATH_ADMINISTRATOR . '/components/com_akeeba/engine');
     require_once $factoryPath;
     // Assign the correct platform
     \Akeeba\Engine\Platform::addPlatform('joomla25', JPATH_ADMINISTRATOR . '/components/com_akeeba/platform/joomla25');
 }
示例#8
0
 public function onBeforeDispatch()
 {
     $result = parent::onBeforeDispatch();
     if ($result) {
         // Merge the language overrides
         $paths = array(JPATH_ADMINISTRATOR, JPATH_ROOT);
         $jlang = JFactory::getLanguage();
         $jlang->load($this->component, $paths[0], 'en-GB', true);
         $jlang->load($this->component, $paths[0], null, true);
         $jlang->load($this->component, $paths[1], 'en-GB', true);
         $jlang->load($this->component, $paths[1], null, true);
         $jlang->load($this->component . '.override', $paths[0], 'en-GB', true);
         $jlang->load($this->component . '.override', $paths[0], null, true);
         $jlang->load($this->component . '.override', $paths[1], 'en-GB', true);
         $jlang->load($this->component . '.override', $paths[1], null, true);
         // Timezone fix; avoids errors printed out by PHP 5.3.3+ (thanks Yannick!)
         if (function_exists('date_default_timezone_get') && function_exists('date_default_timezone_set')) {
             if (function_exists('error_reporting')) {
                 $oldLevel = error_reporting(0);
             }
             $serverTimezone = @date_default_timezone_get();
             if (empty($serverTimezone) || !is_string($serverTimezone)) {
                 $serverTimezone = 'UTC';
             }
             if (function_exists('error_reporting')) {
                 error_reporting($oldLevel);
             }
             @date_default_timezone_set($serverTimezone);
         }
         // Necessary defines for Akeeba Engine
         if (!defined('AKEEBAENGINE')) {
             define('AKEEBAENGINE', 1);
             // Required for accessing Akeeba Engine's factory class
             define('AKEEBAROOT', JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba');
         }
         // I think I still use that stuff somewhere
         if (!defined('JPATH_COMPONENT_ADMINISTRATOR')) {
             define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_akeeba');
         }
         // Make sure we have a profile set throughout the component's lifetime
         $session = JFactory::getSession();
         $profile_id = $session->get('profile', null, 'akeeba');
         if (is_null($profile_id)) {
             // No profile is set in the session; use default profile
             $session->set('profile', 1, 'akeeba');
         }
         // Load Akeeba Engine
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/engine/Factory.php';
         Platform::addPlatform('joomla25', JPATH_COMPONENT_ADMINISTRATOR . '/platform/joomla25');
         // Load the Akeeba Backup configuration and check user access permission
         $akeebaEngineConfig = Factory::getConfiguration();
         Platform::getInstance()->load_configuration();
         unset($akeebaEngineConfig);
         // Preload helpers
         require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/helpers/includes.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/helpers/escape.php';
         // If JSON functions don't exist, load our compatibility layer
         if (!function_exists('json_encode') || !function_exists('json_decode')) {
             require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/jsonlib.php';
         }
         // Load Akeeba Strapper
         include_once JPATH_ROOT . '/media/akeeba_strapper/strapper.php';
         AkeebaStrapper::bootstrap();
     }
     return $result;
 }
示例#9
0
 /**
  * Sets up the environment to start or continue a file scan
  *
  * @return bool
  */
 private function scanEngineSetup()
 {
     // Load the Akeeba Engine autoloader
     define('AKEEBAENGINE', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_admintools/engine/Autoloader.php';
     // Load the platform
     \Akeeba\Engine\Platform::addPlatform('filescan', JPATH_ADMINISTRATOR . '/components/com_admintools/platform/Filescan');
     // Load the engine configuration
     \Akeeba\Engine\Platform::getInstance()->load_configuration(1);
     $this->aeconfig = \Akeeba\Engine\Factory::getConfiguration();
     define('AKEEBA_BACKUP_ORIGIN', 'backend');
     // Unset time limits
     $safe_mode = true;
     if (function_exists('ini_get')) {
         $safe_mode = ini_get('safe_mode');
     }
     if (!$safe_mode && function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     return true;
 }
示例#10
0
 /**
  * Executes before dispatching the request to the appropriate controller
  */
 public function onBeforeDispatch()
 {
     $this->onBeforeDispatchViewAliases();
     // Load the FOF language
     $lang = $this->container->platform->getLanguage();
     $lang->load('lib_fof30', JPATH_ADMINISTRATOR, 'en-GB', true, true);
     $lang->load('lib_fof30', JPATH_ADMINISTRATOR, null, true, false);
     // Necessary for routing the Alice view
     $this->container->inflector->addWord('Alice', 'Alices');
     // Necessary defines for Akeeba Engine
     if (!defined('AKEEBAENGINE')) {
         define('AKEEBAENGINE', 1);
         define('AKEEBAROOT', $this->container->backEndPath . '/BackupEngine');
         define('ALICEROOT', $this->container->backEndPath . '/AliceEngine');
     }
     // Does the user have adequate permissions to access our component?
     if (!JFactory::getUser()->authorise('core.manage', 'com_akeeba')) {
         throw new \RuntimeException(\JText::_('JERROR_ALERTNOAUTHOR'), 404);
     }
     // Make sure we have a profile set throughout the component's lifetime
     $session = $this->container->session;
     $profile_id = $session->get('profile', null, 'akeeba');
     if (is_null($profile_id)) {
         $session->set('profile', 1, 'akeeba');
     }
     // Load Akeeba Engine
     $basePath = $this->container->backEndPath;
     require_once $basePath . '/BackupEngine/Factory.php';
     // Load ALICE (Pro version only)
     if (@file_exists($basePath . '/AliceEngine/factory.php')) {
         require_once $basePath . '/AliceEngine/factory.php';
     }
     // Load the Akeeba Engine configuration
     try {
         Platform::addPlatform('joomla3x', JPATH_COMPONENT_ADMINISTRATOR . '/BackupPlatform/Joomla3x');
         $akeebaEngineConfig = Factory::getConfiguration();
         Platform::getInstance()->load_configuration();
         unset($akeebaEngineConfig);
     } catch (\Exception $e) {
         // Maybe the tables are not installed?
         /** @var ControlPanel $cPanelModel */
         $cPanelModel = $this->container->factory->model('ControlPanel')->tmpInstance();
         $cPanelModel->checkAndFixDatabase();
         $msg = \JText::_('COM_AKEEBA_CONTROLPANEL_MSG_REBUILTTABLES');
         $app = \JFactory::getApplication();
         $app->enqueueMessage($msg, 'warning');
         $app->redirect('index.php', 307);
     }
     // Prevents the "SQLSTATE[HY000]: General error: 2014" due to resource sharing with Akeeba Engine
     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     // !!!!! WARNING: ALWAYS GO THROUGH JFactory; DO NOT GO THROUGH $this->container->db !!!!!
     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     $jDbo = JFactory::getDbo();
     if ($jDbo->name == 'pdomysql') {
         @JFactory::getDbo()->disconnect();
     }
     // Load the utils helper library
     Platform::getInstance()->load_version_defines();
     // Make sure we have a version loaded
     @(include_once $this->container->backEndPath . '/components/com_akeeba/version.php');
     if (!defined('AKEEBA_VERSION')) {
         define('AKEEBA_VERSION', 'dev');
         define('AKEEBA_DATE', date('Y-m-d'));
     }
     // Create a media file versioning tag
     $this->container->mediaVersion = md5(AKEEBA_VERSION . AKEEBA_DATE);
     // Perform certain functionality only in HTML tasks
     $format = $this->input->getCmd('format', 'html');
     if ($format == 'html') {
         // Load common media files
         $this->loadCommonMediaFiles();
         // Perform common maintenance tasks
         $this->autoMaintenance();
     }
     // Set the linkbar style to Classic (Bootstrap tabs). The sidebar takes too much space and requires adding
     // manual HTML to render it...
     $this->container->renderer->setOption('linkbar_style', 'classic');
 }
示例#11
0
 /**
  * Check the strength of the Secret Word for front-end and remote scans. If it is insecure return the reason it
  * is insecure as a string. If the Secret Word is secure return an empty string.
  *
  * @return  string
  */
 public function getFrontendSecretWordError()
 {
     // Load the Akeeba Engine autoloader
     define('AKEEBAENGINE', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_admintools/engine/Autoloader.php';
     // Load the platform
     \Akeeba\Engine\Platform::addPlatform('filescan', JPATH_ADMINISTRATOR . '/components/com_admintools/platform/Filescan');
     // Is frontend backup enabled?
     $febEnabled = \Akeeba\Engine\Platform::getInstance()->get_platform_configuration_option('frontend_enable', 0) != 0;
     if (!$febEnabled) {
         return '';
     }
     $secretWord = \Akeeba\Engine\Platform::getInstance()->get_platform_configuration_option('frontend_secret_word', '');
     try {
         \Akeeba\Engine\Util\Complexify::isStrongEnough($secretWord);
     } catch (RuntimeException $e) {
         // Ah, the current Secret Word is bad. Create a new one if necessary.
         $session = JFactory::getSession();
         $newSecret = $session->get('newSecretWord', null, 'admintools.cpanel');
         if (empty($newSecret)) {
             $random = new \Akeeba\Engine\Util\RandomValue();
             $newSecret = $random->generateString(32);
             $session->set('newSecretWord', $newSecret, 'admintools.cpanel');
         }
         return $e->getMessage();
     }
     return '';
 }