/** * Saves the current configuration to the database table * * @param int $profile_id The profile where to save the configuration to, defaults to current profile * * @return bool True if everything was saved properly */ public function save_configuration($profile_id = null) { // Load Joomla! database class $db = AEFactory::getDatabase($this->get_platform_database_options()); if (!$db->connected()) { return false; } // Get the active profile number, if no profile was specified if (is_null($profile_id)) { $profile_id = $this->get_active_profile(); } // Get an INI format registry dump $registry = AEFactory::getConfiguration(); $dump_profile = $registry->exportAsINI(); // Encrypt the registry dump if required $dump_profile = AEUtilSecuresettings::encryptSettings($dump_profile); $sql = $db->getQuery(true)->update($db->qn($this->tableNameProfiles))->set($db->qn('configuration') . ' = ' . $db->q($dump_profile))->where($db->qn('id') . ' = ' . $db->q($profile_id)); $db->setQuery($sql); try { $db->query(); } catch (Exception $exc) { return false; } return true; }
/** * Saves the current configuration to the database table * @param int $profile_id The profile where to save the configuration to, defaults to current profile * @return bool True if everything was saved properly */ public static function save_configuration($profile_id = null) { // Load Joomla! database class $db =& AEFactory::getDatabase( self::get_platform_database_options() ); // Get the active profile number, if no profile was specified if(is_null($profile_id)) { $profile_id = self::get_active_profile(); } // Get an INI format registry dump $registry =& AEFactory::getConfiguration(); $dump_profile = $registry->exportAsINI(); // Encrypt the registry dump if required $dump_profile = AEUtilSecuresettings::encryptSettings($dump_profile); // Write the local profile's configuration data $sql = 'UPDATE '.$db->nameQuote('#__ak_profiles').' SET '. $db->nameQuote('configuration').' = '.$db->Quote($dump_profile) .' WHERE '. $db->nameQuote('id').' = '. $db->Quote($profile_id); $db->setQuery($sql); if($db->query() === false) { return false; //JError::raiseError(500,'Can\'t save Akeeba Configuration','SQL Query<br/>'.$db->getQuery().'<br/>SQL Error:'.$db->getError()); } return true; }
/** * Saves the current configuration to the database table * @param int $profile_id The profile where to save the configuration to, defaults to current profile * @return bool True if everything was saved properly */ public function save_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(); } // Get an INI format registry dump $registry = AEFactory::getConfiguration(); $dump_profile = $registry->exportAsINI(); // Encrypt the registry dump if required $dump_profile = AEUtilSecuresettings::encryptSettings($dump_profile); $sql = $db->getQuery(true)->update($db->qn($this->tableNameProfiles))->set($db->qn('configuration') . ' = ' . $db->q($dump_profile))->where($db->qn('id') . ' = ' . $db->q($profile_id)); $db->setQuery($sql); if ($db->query() === false) { return false; //JError::raiseError(500,'Can\'t save Akeeba Configuration','SQL Query<br/>'.$db->getQuery().'<br/>SQL Error:'.$db->getError()); } return true; }
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(); } }
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(); } } }