コード例 #1
0
 /**
  * Imports an exported profile .json file
  */
 public function import()
 {
     $this->_csrfProtection();
     $user = JFactory::getUser();
     if (!$user->authorise('akeeba.configure', 'com_akeeba')) {
         return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     // Get the user
     $user = JFactory::getUser();
     // Get some data from the request
     $file = F0FInput::getVar('importfile', '', $_FILES, 'array');
     if (isset($file['name'])) {
         // Load the file data
         $data = JFile::read($file['tmp_name']);
         @unlink($file['tmp_name']);
         // JSON decode
         $data = json_decode($data, true);
         // Check for data validity
         $isValid = is_array($data) && !empty($data);
         if ($isValid) {
             $isValid = $isValid && array_key_exists('description', $data);
         }
         if ($isValid) {
             $isValid = $isValid && array_key_exists('configuration', $data);
         }
         if ($isValid) {
             $isValid = $isValid && array_key_exists('filters', $data);
         }
         if (!$isValid) {
             $this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_ERR_IMPORT_INVALID'), 'error');
             return false;
         }
         // Unset the id, if it exists
         if (array_key_exists('id', $data)) {
             unset($data['id']);
         }
         // Try saving the profile
         $result = $this->getThisModel()->getTable()->save($data);
         if ($result) {
             $this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_MSG_IMPORT_COMPLETE'));
         } else {
             $this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_ERR_IMPORT_FAILED'), 'error');
         }
     } else {
         $this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('MSG_UPLOAD_INVALID_REQUEST'), 'error');
         return false;
     }
 }
コード例 #2
0
ファイル: scanner.php プロジェクト: knigherrant/decopatio
 public function saveConfiguration()
 {
     $rawInput = $this->getState('rawinput', array());
     $newFileExtension = trim(F0FInput::getVar('fileextensions', '', $rawInput));
     $newExcludeFolders = trim(F0FInput::getVar('exludefolders', '', $rawInput));
     $newExcludeFiles = trim(F0FInput::getVar('exludefiles', '', $rawInput));
     $newMinExecTime = trim(F0FInput::getInt('mintime', '', $rawInput));
     $newMaxExecTime = trim(F0FInput::getInt('maxtime', '', $rawInput));
     $newRuntimeBias = trim(F0FInput::getInt('runtimebias', '', $rawInput));
     $protectedKeys = $this->aeconfig->getProtectedKeys();
     $this->aeconfig->resetProtectedKeys();
     $this->aeconfig->set('akeeba.basic.file_extensions', join('|', $this->getTextInputAsArray($newFileExtension)));
     $this->aeconfig->set('akeeba.basic.exclude_folders', join('|', $this->getTextInputAsArray($newExcludeFolders, '/')));
     $this->aeconfig->set('akeeba.basic.exclude_files', join('|', $this->getTextInputAsArray($newExcludeFiles, '/')));
     $this->aeconfig->set('akeeba.tuning.min_exec_time', $newMinExecTime);
     $this->aeconfig->set('akeeba.tuning.max_exec_time', $newMaxExecTime);
     $this->aeconfig->set('akeeba.tuning.run_time_bias', $newRuntimeBias);
     \Akeeba\Engine\Platform::getInstance()->save_configuration();
     $this->aeconfig->setProtectedKeys($protectedKeys);
 }