/** * Loads the current configuration off the database table * @param int $profile_id The profile where to read the configuration from, defaults to current profile * @return bool True if everything was read properly */ public function load_configuration($profile_id = null) { // Load Joomla! database class $db =& AEFactory::getDatabase($this->get_platform_database_options()); // Get the active profile number, if no profile was specified if (is_null($profile_id)) { $profile_id = $this->get_active_profile(); } // Initialize the registry $registry =& AEFactory::getConfiguration(); $registry->reset(); // Load the INI format local configuration dump off the database $sql = "SELECT " . $db->nameQuote('configuration') . ' FROM ' . $db->nameQuote('#__ak_profiles') . ' WHERE ' . $db->nameQuote('id') . ' = ' . $db->Quote($profile_id); $db->setQuery($sql); $ini_data_local = $db->loadResult(); if (empty($ini_data_local) || is_null($ini_data_local)) { // No configuration was saved yet - store the defaults $this->save_configuration($profile_id); } else { // Configuration found. Convert to array format. if (function_exists('get_magic_quotes_runtime')) { if (@get_magic_quotes_runtime()) { $ini_data_local = stripslashes($ini_data_local); } } // Decrypt the data if required $ini_data_local = AEUtilSecuresettings::decryptSettings($ini_data_local); $ini_data_local = AEUtilINI::parse_ini_file_php($ini_data_local, true, true); $ini_data = array(); foreach ($ini_data_local as $section => $row) { if (!empty($row)) { foreach ($row as $key => $value) { $ini_data["{$section}.{$key}"] = $value; } } } unset($ini_data_local); // Import the configuration array $registry->mergeArray($ini_data, false, false); } // Apply config overrides if (is_array($this->configOverrides) && !empty($this->configOverrides)) { AEFactory::getConfiguration()->mergeArray($this->configOverrides, false, false); } $registry->activeProfile = $profile_id; }
private function disableSettingsEncryption() { // Load the server key file if necessary jimport('joomla.filesystem.file'); $filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php'; $key = AEUtilSecuresettings::getKey(); // Loop all profiles and decrypt their settings $profilesModel = JModel::getInstance('Profiles', 'AkeebaModel'); $profiles = $profilesModel->getProfilesList(true); $db = $this->getDBO(); foreach ($profiles as $profile) { $id = $profile->id; $config = AEUtilSecuresettings::decryptSettings($profile->configuration, $key); $sql = 'UPDATE ' . $db->nameQuote('#__ak_profiles') . ' SET ' . $db->nameQuote('configuration') . ' = ' . $db->Quote($config) . ' WHERE ' . $db->nameQuote('id') . ' = ' . $db->Quote($id); $db->setQuery($sql); $db->query(); } // Finally, remove the key file JFile::delete($filename); }
<?php /** * @package AkeebaBackup * @copyright Copyright (c)2009-2013 Nicholas K. Dionysopoulos * @license GNU General Public License version 3, or later * @since 1.3 */ defined('_JEXEC') or die; $data = $this->item->getData(); if (substr($data['configuration'], 0, 12) == '###AES128###') { // Load the server key file if necessary JLoader::import('joomla.filesystem.file'); if (!defined('AKEEBA_SERVERKEY')) { $filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php'; include_once $filename; } $key = AEUtilSecuresettings::getKey(); $data['configuration'] = AEUtilSecuresettings::decryptSettings($data['configuration'], $key); } $defaultName = $this->input->get('view', 'joomla', 'cmd'); $filename = $this->input->get('basename', $defaultName, 'cmd'); $document = JFactory::getDocument(); $document->setName($filename); echo json_encode($data);
private function disableSettingsEncryption() { // Load the server key file if necessary JLoader::import('joomla.filesystem.file'); $filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php'; $key = AEUtilSecuresettings::getKey(); // Loop all profiles and decrypt their settings $profilesModel = FOFModel::getTmpInstance('Profiles', 'AkeebaModel'); $profiles = $profilesModel->getList(true); $db = $this->getDBO(); foreach ($profiles as $profile) { $id = $profile->id; $config = AEUtilSecuresettings::decryptSettings($profile->configuration, $key); $sql = $db->getQuery(true)->update($db->qn('#__ak_profiles'))->set($db->qn('configuration') . ' = ' . $db->q($config))->where($db->qn('id') . ' = ' . $db->q($id)); $db->setQuery($sql); $db->execute(); } // Finally, remove the key file JFile::delete($filename); }