예제 #1
0
 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success, False on error.
  *
  * @throws  RuntimeException
  *
  * @since   1.2
  */
 public function save($data)
 {
     if (isset($data['grant_types'])) {
         foreach ($data['grant_types'] as $grantType) {
             if ($grantType == 'client_credentials') {
                 if (empty($data['user_id'])) {
                     $this->setError(JText::_('COM_REDCORE_OAUTH_CLIENTS_ERROR_CLIENT_CREDENTIALS_JOOMLA_USER'));
                     return false;
                 }
             }
         }
     }
     if (isset($data['grant_types']) && is_array($data['grant_types'])) {
         $data['grant_types'] = implode(' ', $data['grant_types']);
     }
     if (isset($data['scope']) && is_array($data['scope'])) {
         $data['scope'] = implode(' ', $data['scope']);
     }
     if (empty($data['id'])) {
         $data['client_secret'] = $this->generateSecretKey($data['client_id']);
     }
     if (parent::save($data)) {
         return $this->setTokensToExpire($data['client_id']);
     }
     return false;
 }
예제 #2
0
 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success, False on error.
  *
  * @throws  RuntimeException
  *
  * @since   1.2
  */
 public function save($data)
 {
     $pluginParams = JFactory::getApplication()->input->get('plugin', array(), 'array');
     $data = array_merge($data, $pluginParams);
     if (parent::save($data)) {
         return true;
     }
     return false;
 }
예제 #3
0
 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success, False on error.
  *
  * @since   12.2
  */
 public function save($data)
 {
     if (isset($data['channel_params']) && is_array($data['channel_params'])) {
         $registry = new JRegistry();
         $registry->loadArray($data['channel_params']);
         $data['channel_params'] = (string) $registry;
     }
     return parent::save($data);
 }
예제 #4
0
 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success, False on error.
  *
  * @throws  RuntimeException
  *
  * @since   1.2
  */
 public function save($data)
 {
     try {
         if (!$this->saveXml($data)) {
             return false;
         }
     } catch (Exception $e) {
         $this->setError(JText::sprintf('COM_REDCORE_WEBSERVICE_ERROR_SAVING_XML', $e->getMessage()));
         return false;
     }
     /** @var RedcoreModelWebservices $model */
     $model = RModelAdmin::getAdminInstance('Webservices', array(), 'com_redcore');
     if ($id = $model->installWebservice($data['main']['client'], $data['main']['name'], $data['main']['version'], $data['main']['path'], $data['main']['id'])) {
         $this->setState($this->getName() . '.id', $id);
         $this->setState($this->getName() . '.new', empty($data['main']['id']));
         // Update created, modified flags
         return parent::save(array('id' => $id));
     }
     return false;
 }