public function onAdd($tpl = null) { $media_folder = JURI::base() . '../media/com_akeeba/'; // Get a JSON representation of GUI data $json = AkeebaHelperEscape::escapeJS(AEUtilInihelper::getJsonGuiDefinition(), '"\\'); $this->assignRef('json', $json); // Get profile ID $profileid = AEPlatform::getInstance()->get_active_profile(); $this->assign('profileid', $profileid); // Get profile name $profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description; $this->assign('profilename', $profileName); // Get the root URI for media files $this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/')); // Are the settings secured? if (AEPlatform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) { $this->assign('securesettings', -1); } elseif (!AEUtilSecuresettings::supportsEncryption()) { $this->assign('securesettings', 0); } else { JLoader::import('joomla.filesystem.file'); $filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php'; if (JFile::exists($filename)) { $this->assign('securesettings', 1); } else { $this->assign('securesettings', 0); } } // Add live help AkeebaHelperIncludes::addHelp('config'); }
function display() { // Toolbar buttons JToolBarHelper::title(JText::_('AKEEBA').':: <small>'.JText::_('CONFIGURATION').'</small>','akeeba'); JToolBarHelper::preferences('com_akeeba', '500', '660'); JToolBarHelper::spacer(); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); JToolBarHelper::spacer(); // Add references to scripts and CSS AkeebaHelperIncludes::includeMedia(false); $media_folder = JURI::base().'../media/com_akeeba/'; // Get a JSON representation of GUI data $json = AkeebaHelperEscape::escapeJS(AEUtilInihelper::getJsonGuiDefinition(),'"\\'); $this->assignRef( 'json', $json ); // Get profile ID $profileid = AEPlatform::get_active_profile(); $this->assign('profileid', $profileid); // Get profile name akimport('models.profiles',true); $model = new AkeebaModelProfiles(); $model->setId($profileid); $profile_data = $model->getProfile(); $this->assign('profilename', $profile_data->description); // Get the root URI for media files $this->assign( 'mediadir', AkeebaHelperEscape::escapeJS($media_folder.'theme/') ); // Are the settings secured? if( AEPlatform::get_platform_configuration_option('useencryption', -1) == 0 ) { $this->assign('securesettings', -1); } elseif( !AEUtilSecuresettings::supportsEncryption() ) { $this->assign('securesettings', 0); } else { jimport('joomla.filesystem.file'); $filename = JPATH_COMPONENT_ADMINISTRATOR.'/akeeba/serverkey.php'; if(JFile::exists($filename)) { $this->assign('securesettings', 1); } else { $this->assign('securesettings', 0); } } // Add live help AkeebaHelperIncludes::addHelp(); parent::display(); }
/** * 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 enableSettingsEncryption() { $key = $this->createSettingsKey(); if (empty($key) || $key == false) { return; } // Loop all profiles and encrypt their settings $profilesModel = JModel::getInstance('Profiles', 'AkeebaModel'); $profiles = $profilesModel->getProfilesList(true); $db = $this->getDBO(); foreach ($profiles as $profile) { $id = $profile->id; $config = AEUtilSecuresettings::encryptSettings($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(); } }
<?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 enableSettingsEncryption() { $key = $this->createSettingsKey(); if (empty($key) || $key == false) { return; } // Loop all profiles and encrypt their settings $profilesModel = FOFModel::getTmpInstance('Profiles', 'AkeebaModel'); $profiles = $profilesModel->getList(true); $db = $this->getDBO(); if (!empty($profiles)) { foreach ($profiles as $profile) { $id = $profile->id; $config = AEUtilSecuresettings::encryptSettings($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(); } } }