Пример #1
0
 /**
  * Method to remove root in global configuration.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken('get')) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Initialise model.
     $model = new ConfigModelApplication();
     // Attempt to save the configuration and remove root.
     try {
         $model->removeroot();
     } catch (RuntimeException $e) {
         // Save failed, go back to the screen and display a notice.
         $this->app->enqueueMessage(JText::sprintf('JERROR_SAVE_FAILED', $e->getMessage()), 'error');
         $this->app->redirect(JRoute::_('index.php', false));
     }
     // Set the redirect based on the task.
     $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
     $this->app->redirect(JRoute::_('index.php', false));
 }
Пример #2
0
 /**
  * Method to send the test mail.
  *
  * @return  string
  *
  * @since   3.6
  */
 public function execute()
 {
     if (!JSession::checkToken('get')) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     $model = new ConfigModelApplication();
     echo new JResponseJson($model->sendTestMail());
     JFactory::getApplication()->close();
 }
Пример #3
0
 /**
  * Method to GET permission value and give it to the model for storing in the database.
  *
  * @return  boolean  true on success, false when failed
  *
  * @since   3.5
  */
 public function execute()
 {
     // Send json mime type.
     $this->app->mimeType = 'application/json';
     $this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet);
     $this->app->sendHeaders();
     // Check if user token is valid.
     if (!JSession::checkToken('get')) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'), 'error');
         echo new JResponseJson();
         $this->app->close();
     }
     $model = new ConfigModelApplication();
     echo new JResponseJson($model->storePermissions());
     $this->app->close();
 }
Пример #4
0
 /**
  * Method to GET permission value and give it to the model for storing in the database.
  *
  * @return  boolean  true on success, false when failed
  *
  * @since   3.5
  */
 public function execute()
 {
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Get Post DATA
     $permissions = array('component' => $this->input->get->get('comp'), 'action' => $this->input->get->get('action'), 'rule' => $this->input->get->get('rule'), 'value' => $this->input->get->get('value'), 'title' => $this->input->get->get('title', '', 'RAW'));
     if (!(substr($permissions['component'], -6) == '.false')) {
         // Load Permissions from Session and send to Model
         $model = new ConfigModelApplication();
         $response = $model->storePermissions($permissions);
         echo new JResponseJson(json_encode($response));
     } else {
         echo new JResponseJson(json_encode(false), 0);
     }
 }
Пример #5
0
 /**
  * Method to send the test mail.
  *
  * @return  string
  *
  * @since   3.5
  */
 public function execute()
 {
     // Send json mime type.
     $this->app->mimeType = 'application/json';
     $this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet);
     $this->app->sendHeaders();
     // Check if user token is valid.
     if (!JSession::checkToken('get')) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'), 'error');
         echo new JResponseJson();
         $this->app->close();
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
         echo new JResponseJson();
         $this->app->close();
     }
     $model = new ConfigModelApplication();
     echo new JResponseJson($model->sendTestMail());
     $this->app->close();
 }
Пример #6
0
 /**
  * Method to save global configuration.
  *
  * @return  mixed  Calls $app->redirect() for all cases except JSON
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken()) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Set FTP credentials, if given.
     JClientHelper::setCredentialsFromRequest('ftp');
     $model = new ConfigModelApplication();
     $data = $this->input->post->get('jform', array(), 'array');
     // Complete data array if needed
     $oldData = $model->getData();
     $data = array_replace($oldData, $data);
     // Get request type
     $saveFormat = JFactory::getDocument()->getType();
     // Handle service requests
     if ($saveFormat == 'json') {
         return $model->save($data);
     }
     // Must load after serving service-requests
     $form = $model->getForm();
     // Validate the posted data.
     $return = $model->validate($form, $data);
     // Check for validation errors.
     if ($return === false) {
         /*
          * The validate method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Redirect back to the edit screen.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.application', false));
     }
     // Attempt to save the configuration.
     $data = $return;
     $return = $model->save($data);
     // Check the return value.
     if ($return === false) {
         /*
          * The save method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Save failed, go back to the screen and display a notice.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.application', false));
     }
     // Set the success message.
     $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
     // Set the redirect based on the task.
     switch ($this->options[3]) {
         case 'apply':
             $this->app->redirect(JRoute::_('index.php?option=com_config', false));
             break;
         case 'save':
         default:
             $this->app->redirect(JRoute::_('index.php', false));
             break;
     }
 }
Пример #7
0
 function installComplete($sample = false)
 {
     $this->checkPermissionForTools();
     if (VmConfig::get('dangeroustools', true)) {
         if (!class_exists('com_virtuemartInstallerScript')) {
             require VMPATH_ADMIN . DS . 'install' . DS . 'script.virtuemart.php';
         }
         $updater = new com_virtuemartInstallerScript();
         $updater->install(true);
         $model = $this->getModel('updatesMigration');
         $sid = $model->setStoreOwner();
         $msg = 'System and sampledata succesfull installed, user id of the mainvendor is ' . $sid;
         if (!class_exists('com_virtuemart_allinoneInstallerScript')) {
             require VMPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart_allinone' . DS . 'script.vmallinone.php';
         }
         $updater = new com_virtuemart_allinoneInstallerScript(false);
         $updater->vmInstall(true);
         if ($sample) {
             $model->installSampleData($sid);
         }
         if (!class_exists('VmConfig')) {
             require_once VMPATH_ADMIN . '/models/config.php';
         }
         VirtueMartModelConfig::installVMconfigTable();
         //Now lets set some joomla variables
         //Caching should be enabled, set to files and for 15 minutes
         if (JVM_VERSION > 2) {
             if (!class_exists('ConfigModelCms')) {
                 require VMPATH_ROOT . DS . 'components' . DS . 'com_config' . DS . 'model' . DS . 'cms.php';
             }
             if (!class_exists('ConfigModelForm')) {
                 require VMPATH_ROOT . DS . 'components' . DS . 'com_config' . DS . 'model' . DS . 'application.php';
             }
             if (!class_exists('ConfigModelApplication')) {
                 require VMPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_config' . DS . 'model' . DS . 'application.php';
             }
         } else {
             if (!class_exists('ConfigModelApplication')) {
                 require VMPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_config' . DS . 'models' . DS . 'application.php';
             }
         }
         $jConfModel = new ConfigModelApplication();
         $jConfig = $jConfModel->getData();
         $jConfig['caching'] = 0;
         $jConfig['lifetime'] = 60;
         $jConfig['list_limit'] = 25;
         $jConfig['MetaDesc'] = 'VirtueMart works with Joomla! - the dynamic portal engine and content management system';
         $jConfig['MetaKeys'] = 'virtuemart, vm2, joomla, Joomla';
         $app = JFactory::getApplication();
         $return = $jConfModel->save($jConfig);
         // Check the return value.
         if ($return === false) {
             // Save the data in the session.
             $app->setUserState('com_config.config.global.data', $jConfig);
             vmError(vmText::sprintf('JERROR_SAVE_FAILED', 'installComplete'));
             //return false;
         } else {
             // Set the success message.
             //vmInfo('COM_CONFIG_SAVE_SUCCESS');
         }
     } else {
         $msg = $this->_getMsgDangerousTools();
     }
     $this->setRedirect('index.php?option=com_virtuemart&view=updatesmigration&layout=insfinished', $msg);
 }
Пример #8
0
 function installComplete($sample = false)
 {
     $data = JRequest::get('get');
     JRequest::setVar($data['token'], '1', 'post');
     JRequest::checkToken() or jexit('Invalid Token, in ' . JRequest::getWord('task'));
     $this->checkPermissionForTools();
     if (VmConfig::get('dangeroustools', true)) {
         if (!class_exists('com_virtuemartInstallerScript')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'install' . DS . 'script.virtuemart.php';
         }
         $updater = new com_virtuemartInstallerScript();
         $updater->install(true);
         $model = $this->getModel('updatesMigration');
         $sid = $model->setStoreOwner();
         $model->setUserToPermissionGroup($sid);
         $msg = '';
         if (empty($errors)) {
             $msg = 'System succesfull restored and sampledata installed, user id of the mainvendor is ' . $sid;
         } else {
             foreach ($errors as $error) {
                 $msg .= $error . '<br />';
             }
         }
         if (!class_exists('com_virtuemart_allinoneInstallerScript')) {
             require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart_allinone' . DS . 'script.vmallinone.php';
         }
         $updater = new com_virtuemart_allinoneInstallerScript();
         $updater->vmInstall(true);
         if ($sample) {
             $model->installSampleData($sid);
         }
         VmConfig::installVMconfig();
         //Now lets set some joomla variables
         //Caching should be enabled, set to files and for 15 minutes
         if (!class_exists('ConfigModelApplication')) {
             require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_config' . DS . 'models' . DS . 'application.php';
         }
         $jConfModel = new ConfigModelApplication();
         $jConfig = $jConfModel->getData();
         $jConfig['caching'] = 0;
         $jConfig['lifetime'] = 60;
         $jConfig['list_limit'] = 25;
         $jConfig['MetaDesc'] = 'VirtueMart works with Joomla! - the dynamic portal engine and content management system';
         $jConfig['MetaKeys'] = 'virtuemart, vm2, joomla, Joomla';
         $app = JFactory::getApplication();
         $return = $jConfModel->save($jConfig);
         // Check the return value.
         if ($return === false) {
             // Save the data in the session.
             $app->setUserState('com_config.config.global.data', $jConfig);
             vmError(vmText::sprintf('JERROR_SAVE_FAILED', $model->getError()));
             //return false;
         } else {
             // Set the success message.
             //vmInfo('COM_CONFIG_SAVE_SUCCESS');
         }
     } else {
         $msg = $this->_getMsgDangerousTools();
     }
     $this->setRedirect($this->redirectPath, $msg);
 }
Пример #9
0
 public function joom_settings()
 {
     //Migrate Joomla settings
     //Read the old config file
     $configSrc = $this->getJoomConfigSrc();
     if ($configSrc) {
         JLoader::discover('ConfigModel', JPATH_SITE . '/components/com_config/model');
         JLoader::discover('ConfigModel', JPATH_ADMINISTRATOR . '/components/com_config/models');
         $configModel = new ConfigModelApplication();
         $currentData = $configModel->getData();
         $currentData['offline'] = $configSrc->offline;
         $currentData['offline_message'] = $configSrc->offline_message;
         $currentData['sitename'] = $configSrc->sitename;
         //$currentData['editor'] 			= $config15editor;
         $currentData['debug'] = $configSrc->debug;
         $currentData['debug_lang'] = $configSrc->debug_lang;
         $currentData['sef'] = $configSrc->sef;
         $currentData['sef_rewrite'] = $configSrc->sef_rewrite;
         $currentData['sef_suffix'] = $configSrc->sef_suffix;
         $currentData['feed_limit'] = $configSrc->feed_limit;
         $currentData['feed_email'] = $configSrc->feed_email;
         $currentData['gzip'] = $configSrc->gzip;
         switch ($configSrc->error_reporting) {
             case '-1':
                 $currentData['error_reporting'] = 'default';
                 break;
             case '0':
                 $currentData['error_reporting'] = 'none';
                 break;
             case '7':
                 $currentData['error_reporting'] = 'simple';
                 break;
             case '6143':
                 $currentData['error_reporting'] = 'maximum';
                 break;
             case '30719':
                 $currentData['error_reporting'] = 'development';
                 break;
         }
         $currentData['xmlrpc_server'] = $configSrc->xmlrpc_server;
         $currentData['force_ssl'] = $configSrc->force_ssl;
         $currentData['offset'] = $this->getTimeZoneName($configSrc->offset);
         $currentData['caching'] = $configSrc->caching;
         $currentData['cachetime'] = $configSrc->cachetime;
         $currentData['cache_handler'] = $configSrc->cache_handler;
         $currentData['sitename'] = $configSrc->sitename;
         $currentData['MetaDesc'] = $configSrc->MetaDesc;
         $currentData['MetaKeys'] = $configSrc->MetaKeys;
         $currentData['MetaTitle'] = $configSrc->MetaTitle;
         $currentData['MetaAuthor'] = $configSrc->MetaAuthor;
         $currentData['mailfrom'] = $configSrc->mailfrom;
         $currentData['fromname'] = $configSrc->fromname;
         if ($configModel->save($currentData)) {
             $this->logInfo(JText::_('JOOM_CONFIGURATION_COPIED'));
         } else {
             $this->logError(JText::_('JOOM_CONFIGURATION_COPIED_ERROR'));
         }
         if ($configSrc->sef_rewrite && !JFile::exists(JPATH_SITE . '/.htaccess')) {
             if (JFile::copy(JPATH_SITE . '/htaccess.txt', JPATH_SITE . '/.htaccess')) {
                 $this->logInfo(JText::_('JOOM_CONFIGURATION_HTACCESS'));
             } else {
                 $this->logWarning(JText::_('JOOM_CONFIGURATION_HTACCESS_ERROR'));
             }
         }
     }
 }
Пример #10
0
<link href="components/com_config/assets/css/style.css" rel="stylesheet" type="text/css" />

<?php 
defined('_JEXEC') or die('Restricted access');
?>

<fieldset class="adminform">
    <legend><?php 
echo JText::_('Permissions');
?>
</legend>
    <?php 
$configModelAplication = new ConfigModelApplication();
$usergroupData = $configModelAplication->getUsergroupData();
$ruleData = $configModelAplication->getRuleData();
$usergroupTree = new JUsergroupTree($usergroupData, $ruleData);
$usergroupTreeData = $usergroupTree->getUsergroupTreeData('', 'true');
unset($usergroupTreeData[0]);
unset($usergroupTreeData[1]);
$html = '';
$html = $html . '<div id="accordion">';
foreach ($usergroupTreeData as $usergroupTreeDataItem) {
    $branch = '';
    /*
    for ($i = 0;  $i < $usergroupTreeDataItem['level']; $i++)
    {
        $branch = $branch.'|- ';
    }
    */
    $html = $html . '<h2>' . $branch . $usergroupTreeDataItem['name'] . '</h2>' . '<div class="content">' . '<table>' . '<th width="750px">Action</th><th width="300px">Select New Setting</th><th width="200px">Calculated Setting</th>';
    foreach ($usergroupTreeDataItem['permissions'] as $permission) {
Пример #11
0
 /**
  * Save the configuration
  */
 function save()
 {
     //BEGIN: save permissions
     $configModelApplication = new ConfigModelApplication();
     $usergroupData = $configModelApplication->getUsergroupData();
     $ruleData = $configModelApplication->getRuleData();
     $data = array();
     foreach ($usergroupData as $groupDataItem) {
         $gid = $groupDataItem['id'];
         foreach ($ruleData as $ruleDataItem) {
             $status = JRequest::getVar('comboBox' . '_' . $gid . '_' . $ruleDataItem['name']);
             if ($status == 'allowed') {
                 $data[$ruleDataItem['name']][$gid] = 1;
             } else {
                 if ($status == 'denied') {
                     $data[$ruleDataItem['name']][$gid] = 0;
                 }
             }
         }
     }
     $configModelApplication->updatePermissions($data);
     //END: save permissions
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     //Save user and media manager settings
     $table =& JTable::getInstance('component');
     $userpost['params'] = JRequest::getVar('userparams', array(), 'post', 'array');
     $userpost['option'] = 'com_users';
     $table->loadByOption('com_users');
     $table->bind($userpost);
     // pre-save checks
     if (!$table->check()) {
         JError::raiseWarning(500, $table->getError());
         return false;
     }
     // save the changes
     if (!$table->store()) {
         JError::raiseWarning(500, $table->getError());
         return false;
     }
     $mediapost['params'] = JRequest::getVar('mediaparams', array(), 'post', 'array');
     $mediapost['option'] = 'com_media';
     //Sanitize $file_path and $image_path
     $file_path = $mediapost['params']['file_path'];
     $image_path = $mediapost['params']['image_path'];
     if (strpos($file_path, '/') === 0 || strpos($file_path, '\\') === 0) {
         //Leading slash.  Kill it and default to /media
         $file_path = 'images';
     }
     if (strpos($image_path, '/') === 0 || strpos($image_path, '\\') === 0) {
         //Leading slash.  Kill it and default to /media
         $image_path = 'images/stories';
     }
     if (strpos($file_path, '..') !== false) {
         //downward directories.  Kill it and default to images/
         $file_path = 'images';
     }
     if (strpos($image_path, '..') !== false) {
         //downward directories  Kill it and default to images/stories
         $image_path = 'images/stories';
     }
     $mediapost['params']['file_path'] = $file_path;
     $mediapost['params']['image_path'] = $image_path;
     $table->loadByOption('com_media');
     $table->bind($mediapost);
     // pre-save checks
     if (!$table->check()) {
         JError::raiseWarning(500, $table->getError());
         return false;
     }
     // save the changes
     if (!$table->store()) {
         JError::raiseWarning(500, $table->getError());
         return false;
     }
     $config = new JRegistry('config');
     $config_array = array();
     // SITE SETTINGS
     $config_array['offline'] = JRequest::getVar('offline', 0, 'post', 'int');
     $config_array['editor'] = JRequest::getVar('editor', 'tinymce', 'post', 'cmd');
     $config_array['list_limit'] = JRequest::getVar('list_limit', 20, 'post', 'int');
     $config_array['helpurl'] = JRequest::getVar('helpurl', 'http://help.joomla.org', 'post', 'string');
     // DEBUG
     $config_array['debug'] = JRequest::getVar('debug', 0, 'post', 'int');
     $config_array['debug_lang'] = JRequest::getVar('debug_lang', 0, 'post', 'int');
     // SEO SETTINGS
     $config_array['sef'] = JRequest::getVar('sef', 0, 'post', 'int');
     $config_array['sef_rewrite'] = JRequest::getVar('sef_rewrite', 0, 'post', 'int');
     $config_array['sef_suffix'] = JRequest::getVar('sef_suffix', 0, 'post', 'int');
     // FEED SETTINGS
     $config_array['feed_limit'] = JRequest::getVar('feed_limit', 10, 'post', 'int');
     $config_array['feed_email'] = JRequest::getVar('feed_email', 'author', 'post', 'word');
     // SERVER SETTINGS
     $config_array['secret'] = JRequest::getVar('secret', 0, 'post', 'string');
     $config_array['gzip'] = JRequest::getVar('gzip', 0, 'post', 'int');
     $config_array['error_reporting'] = JRequest::getVar('error_reporting', -1, 'post', 'int');
     $config_array['xmlrpc_server'] = JRequest::getVar('xmlrpc_server', 0, 'post', 'int');
     $config_array['log_path'] = JRequest::getVar('log_path', JPATH_ROOT . DS . 'logs', 'post', 'string');
     $config_array['tmp_path'] = JRequest::getVar('tmp_path', JPATH_ROOT . DS . 'tmp', 'post', 'string');
     $config_array['live_site'] = rtrim(JRequest::getVar('live_site', '', 'post', 'string'), '/\\');
     $config_array['force_ssl'] = JRequest::getVar('force_ssl', 0, 'post', 'int');
     // LOCALE SETTINGS
     $config_array['offset'] = JRequest::getVar('offset', 0, 'post', 'float');
     // CACHE SETTINGS
     $config_array['caching'] = JRequest::getVar('caching', 0, 'post', 'int');
     $config_array['cachetime'] = JRequest::getVar('cachetime', 900, 'post', 'int');
     $config_array['cache_handler'] = JRequest::getVar('cache_handler', 'file', 'post', 'word');
     $config_array['memcache_settings'] = JRequest::getVar('memcache_settings', array(), 'post');
     // FTP SETTINGS
     $config_array['ftp_enable'] = JRequest::getVar('ftp_enable', 0, 'post', 'int');
     $config_array['ftp_host'] = JRequest::getVar('ftp_host', '', 'post', 'string');
     $config_array['ftp_port'] = JRequest::getVar('ftp_port', '', 'post', 'int');
     $config_array['ftp_user'] = JRequest::getVar('ftp_user', '', 'post', 'string');
     $config_array['ftp_pass'] = JRequest::getVar('ftp_pass', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $config_array['ftp_root'] = JRequest::getVar('ftp_root', '', 'post', 'string');
     // DATABASE SETTINGS
     $config_array['dbtype'] = JRequest::getVar('dbtype', 'mysql', 'post', 'word');
     $config_array['host'] = JRequest::getVar('host', 'localhost', 'post', 'string');
     $config_array['user'] = JRequest::getVar('user', '', 'post', 'string');
     $config_array['db'] = JRequest::getVar('db', '', 'post', 'string');
     $config_array['dbprefix'] = JRequest::getVar('dbprefix', 'jos_', 'post', 'string');
     // MAIL SETTINGS
     $config_array['mailer'] = JRequest::getVar('mailer', 'mail', 'post', 'word');
     $config_array['mailfrom'] = JRequest::getVar('mailfrom', '', 'post', 'string');
     $config_array['fromname'] = JRequest::getVar('fromname', 'Joomla 1.5', 'post', 'string');
     $config_array['sendmail'] = JRequest::getVar('sendmail', '/usr/sbin/sendmail', 'post', 'string');
     $config_array['smtpauth'] = JRequest::getVar('smtpauth', 0, 'post', 'int');
     $config_array['smtpsecure'] = JRequest::getVar('smtpsecure', 'none', 'post', 'word');
     $smtpport = JRequest::getVar('smtpport', '', 'post', 'int');
     $config_array['smtpport'] = $smtpport ? $smtpport : '25';
     $config_array['smtpuser'] = JRequest::getVar('smtpuser', '', 'post', 'string');
     $config_array['smtppass'] = JRequest::getVar('smtppass', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $config_array['smtphost'] = JRequest::getVar('smtphost', '', 'post', 'string');
     // META SETTINGS
     $config_array['MetaAuthor'] = JRequest::getVar('MetaAuthor', 1, 'post', 'int');
     $config_array['MetaTitle'] = JRequest::getVar('MetaTitle', 1, 'post', 'int');
     // SESSION SETTINGS
     $config_array['lifetime'] = JRequest::getVar('lifetime', 0, 'post', 'int');
     $config_array['session_handler'] = JRequest::getVar('session_handler', 'none', 'post', 'word');
     //LANGUAGE SETTINGS
     //$config_array['lang']				= JRequest::getVar('lang', 'none', 'english', 'cmd');
     //$config_array['language']			= JRequest::getVar('language', 'en-GB', 'post', 'cmd');
     $config->loadArray($config_array);
     //override any possible database password change
     $config->setValue('config.password', $mainframe->getCfg('password'));
     // handling of special characters
     $sitename = htmlspecialchars(JRequest::getVar('sitename', '', 'post', 'string'), ENT_COMPAT, 'UTF-8');
     $config->setValue('config.sitename', $sitename);
     $MetaDesc = htmlspecialchars(JRequest::getVar('MetaDesc', '', 'post', 'string'), ENT_COMPAT, 'UTF-8');
     $config->setValue('config.MetaDesc', $MetaDesc);
     $MetaKeys = htmlspecialchars(JRequest::getVar('MetaKeys', '', 'post', 'string'), ENT_COMPAT, 'UTF-8');
     $config->setValue('config.MetaKeys', $MetaKeys);
     // handling of quotes (double and single) and amp characters
     // htmlspecialchars not used to preserve ability to insert other html characters
     $offline_message = JRequest::getVar('offline_message', '', 'post', 'string');
     $offline_message = JFilterOutput::ampReplace($offline_message);
     $offline_message = str_replace('"', '&quot;', $offline_message);
     $offline_message = str_replace("'", '&#039;', $offline_message);
     $config->setValue('config.offline_message', $offline_message);
     //purge the database session table (only if we are changing to a db session store)
     if ($mainframe->getCfg('session_handler') != 'database' && $config->getValue('session_handler') == 'database') {
         $table =& JTable::getInstance('session');
         $table->purge(-1);
     }
     // Get the path of the configuration file
     $fname = JPATH_CONFIGURATION . DS . 'configuration.php';
     // Update the credentials with the new settings
     $oldconfig =& JFactory::getConfig();
     $oldconfig->setValue('config.ftp_enable', $config_array['ftp_enable']);
     $oldconfig->setValue('config.ftp_host', $config_array['ftp_host']);
     $oldconfig->setValue('config.ftp_port', $config_array['ftp_port']);
     $oldconfig->setValue('config.ftp_user', $config_array['ftp_user']);
     $oldconfig->setValue('config.ftp_pass', $config_array['ftp_pass']);
     $oldconfig->setValue('config.ftp_root', $config_array['ftp_root']);
     JClientHelper::getCredentials('ftp', true);
     if (!$config->get('caching') && $oldconfig->get('caching')) {
         $cache = JFactory::getCache();
         $cache->clean();
     }
     // Try to make configuration.php writeable
     jimport('joomla.filesystem.path');
     if (!$ftp['enabled'] && JPath::isOwner($fname) && !JPath::setPermissions($fname, '0644')) {
         JError::raiseNotice('SOME_ERROR_CODE', 'Could not make configuration.php writable');
     }
     // Get the config registry in PHP class format and write it to configuation.php
     jimport('joomla.filesystem.file');
     if (JFile::write($fname, $config->toString('PHP', 'config', array('class' => 'JConfig')))) {
         $msg = JText::_('The Configuration Details have been updated');
     } else {
         $msg = JText::_('ERRORCONFIGFILE');
     }
     // Redirect appropriately
     $task = $this->getTask();
     switch ($task) {
         case 'apply':
             $this->setRedirect('index.php?option=com_config', $msg);
             break;
         case 'save':
         default:
             $this->setRedirect('index.php', $msg);
             break;
     }
     // Try to make configuration.php unwriteable
     //if (!$ftp['enabled'] && JPath::isOwner($fname) && !JPath::setPermissions($fname, '0444')) {
     if ($config_array['ftp_enable'] == 0 && !$ftp['enabled'] && JPath::isOwner($fname) && !JPath::setPermissions($fname, '0444')) {
         JError::raiseNotice('SOME_ERROR_CODE', 'Could not make configuration.php unwritable');
     }
 }