Exemplo n.º 1
0
 /**
  * Saves the system configuration
  *
  * @return boolean  If successfull return TRUE, otherwise FALSE
  */
 public function save()
 {
     if (!empty($this->_modified)) {
         $config = new JRegistry('config');
         $config->loadArray(JFactory::getConfig()->toArray());
         $config->loadArray($this->_data);
         if (file_put_contents($this->getPath(), $config->toString('PHP', 'config', array('class' => 'JConfig'))) === false) {
             $this->setStatusMessage(JText::_('ERRORCONFIGFILE'));
             $this->setStatus(KDatabase::STATUS_FAILED);
             return false;
         }
         $this->setStatus(KDatabase::STATUS_UPDATED);
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Method to bind an associative array or object to the JTable instance.This
  * method only binds properties that are publicly accessible and optionally
  * takes an array of properties to ignore when binding.
  *
  * @param   mixed  $src     An associative array or object to bind to the JTable instance.
  * @param   mixed  $ignore  An optional array or space separated list of properties to ignore while binding.
  *
  * @return  boolean  True on success.
  *
  * @link    http://docs.joomla.org/JTable/bind
  * @since   11.1
  * @throws  InvalidArgumentException
  */
 public function bind($src, $ignore = array())
 {
     if (is_object($src)) {
         $src = get_object_vars($src);
     }
     if (isset($src['params']) && is_array($src['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($src['params']);
         $src['params'] = $registry->toString();
     }
     if (isset($src['plugins']) && is_array($src['plugins'])) {
         $registry = new JRegistry();
         $registry->loadArray($src['plugins']);
         $src['plugins'] = $registry->toString();
     }
     if (isset($src['rules']) && is_array($src['rules'])) {
         $rules = array();
         foreach ((array) $src['rules'] as $action => $ids) {
             $rules[$action] = array();
             foreach ($ids as $id => $p) {
                 if ($p !== '') {
                     $rules[$action][$id] = $p == '1' || $p == 'true' ? true : false;
                 }
             }
         }
         $this->setRules(new JAccessRules($rules));
     }
     return parent::bind($src, $ignore);
 }
Exemplo n.º 3
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param    array        Named array
  *
  * @return    null|string    null is operation was satisfactory, otherwise returns an error
  * @see        JTable:bind
  * @since      1.5
  */
 public function bind($array, $ignore = '')
 {
     $input = JFactory::getApplication()->input;
     $task = $input->getString('task', '');
     if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_somosmaestros') && $array['state'] == 1)) {
         $array['state'] = 0;
     }
     if ($array['id'] == 0) {
         $array['created_by'] = JFactory::getUser()->id;
     }
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_somosmaestros.video.' . $array['id'])) {
         $actions = JFactory::getACL()->getActions('com_somosmaestros', 'video');
         $default_actions = JFactory::getACL()->getAssetRules('com_somosmaestros.video.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     //Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param	array		Named array
  * @return	null|string	null is operation was satisfactory, otherwise returns an error
  * @see		JTable:bind
  * @since	1.5
  */
 public function bind($array, $ignore = '')
 {
     if (!JFactory::getUser()->authorise('core.edit.state', 'com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id']) && $array['state'] == 1) {
         $array['state'] = 0;
     }
     if (!isset($array['created_by']) || $array['created_by'] == 0) {
         $array['created_by'] = JFactory::getUser()->id;
     }
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id'])) {
         $actions = JFactory::getACL()->getActions('com_einsatzkomponente', 'einsatzbilderbearbeiten');
         $default_actions = JFactory::getACL()->getAssetRules('com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     //Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 5
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param    array        Named array
  *
  * @return   null|string  null is operation was satisfactory, otherwise returns an error
  * @see      JTable::bind
  */
 public function bind($array, $ignore = '')
 {
     // For Fields group
     // Convert jform[fields_group][field] to jform[field] or JTable cannot bind data.
     // ==========================================================================================
     $data = array();
     $array = AKHelper::_('array.pivotFromTwoDimension', $array);
     // Set field['param_xxx'] to params
     // ==========================================================================================
     if (empty($array['params'])) {
         $array['params'] = AKHelper::_('array.pivotFromPrefix', 'param_', $array, JArrayHelper::getValue($array, 'params', array()));
     }
     // Set params to JRegistry
     // ==========================================================================================
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     // Bind the rules.
     // ==========================================================================================
     if (isset($array['rules']) && is_array($array['rules'])) {
         $rules = new JAccessRules($array['rules']);
         $this->setRules($rules);
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 6
0
 /**
  * Overloaded bind function
  *
  * @param   array  $array   Named array to bind
  * @param   mixed  $ignore  An optional array or space separated list of properties to ignore while binding.
  *
  * @return  mixed  Null if operation was satisfactory, otherwise returns an error
  *
  * @since   1.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_quick2cart.region.' . $array['id'])) {
         $actions = JFactory::getACL()->getActions('com_quick2cart', 'region');
         $default_actions = JFactory::getACL()->getAssetRules('com_quick2cart.region.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     // Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 7
0
 protected function preprocessForm(\JForm $form, $data, $group = 'content')
 {
     // if no data, grab the posted form data.
     if (!$data instanceof JObject) {
         $data = JFactory::getApplication()->input->get('jform', $data, 'array');
         $data = JArrayHelper::toObject($data);
     }
     $params = new JRegistry();
     $params->loadArray($data->params);
     if ($params->get('discovery.url')) {
         $plugin = $params->get('discovery.type');
         $language = JFactory::getLanguage();
         $language->load('plg_harvest_' . $plugin);
         $path = JPATH_ROOT . '/plugins/harvest/' . $plugin . '/forms/harvest.xml';
         $form->loadFile($path, false);
         foreach (JPluginHelper::getPlugin('ingest') as $plugin) {
             $language->load('plg_ingest_' . $plugin->name);
             $path = JPATH_ROOT . '/plugins/ingest/' . $plugin->name . '/forms/ingest.xml';
             $form->loadFile($path, false);
         }
         $form->removeField('originating_url');
         $form->removeField('harvester');
         // hide the run_once value (users cannot set it after discovery)
         $form->setFieldAttribute("run_once", 'type', 'hidden');
         $form->setFieldAttribute("run_once", 'class', '');
     } else {
         $form->removeField('state');
         $form->removeField('harvested');
         $form->removeField('url', 'params.discovery');
         $form->removeField('type', 'params.discovery');
     }
     parent::preprocessForm($form, $data, $group);
 }
Exemplo n.º 8
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param   array  Named array
  * @return  null|string	null is operation was satisfactory, otherwise returns an error
  * @see     JTable:bind
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['body']) && is_array($array['body'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['body']);
         $array['body'] = (string) $registry;
     }
     if (isset($array['special']) && is_array($array['special'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['special']);
         $array['special'] = (string) $registry;
     }
     if (isset($array['laboratory']) && is_array($array['laboratory'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['laboratory']);
         $array['laboratory'] = (string) $registry;
     }
     if (isset($array['payment']) && is_array($array['payment'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['payment']);
         $array['payment'] = (string) $registry;
     }
     if (isset($array['ctags']) && is_array($array['ctags'])) {
         $array['ctags'] = implode(',', $array['ctags']);
     } else {
         $data['ctags'] = '';
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 9
0
 /**
  * Extend store
  */
 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     // created & modified
     if (!$this->created) {
         $this->created = $date->toSql();
     }
     if (!$this->created_by) {
         $this->created_by = $user->get('id');
     }
     $this->modified = $date->toSql();
     $this->modified_by = $user->get('id');
     // ordering
     if (!$this->id) {
         $where = "catid = " . $this->catid;
         $this->ordering = $this->getNextOrder($where);
     }
     // params
     // Transform the params field
     if (is_array($this->params)) {
         $registry = new JRegistry();
         $registry->loadArray($this->params);
         $this->params = (string) $registry;
     }
     return parent::store($updateNulls);
 }
Exemplo n.º 10
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param   array       Named array
  * @return  null|string null is operation was satisfactory, otherwise returns an error
  * @see     JTable:bind
  * @since   1.5
  */
 public function bind($array, $ignore = '')
 {
     $input = JFactory::getApplication()->input;
     $task = $input->getString('task', '');
     if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_dzproduct') && $array['state'] == 1)) {
         $array['state'] = 0;
     }
     //Support for multiple or not foreign key field: itemid
     if (isset($array['itemid'])) {
         if (is_array($array['itemid'])) {
             $array['itemid'] = implode(',', $array['itemid']);
         } else {
             if (strrpos($array['itemid'], ',') != false) {
                 $array['itemid'] = explode(',', $array['itemid']);
             } else {
                 if (empty($array['itemid'])) {
                     $array['itemid'] = '';
                 }
             }
         }
     }
     //Support for multiple or not foreign key field: fieldid
     if (isset($array['fieldid'])) {
         if (is_array($array['fieldid'])) {
             $array['fieldid'] = implode(',', $array['fieldid']);
         } else {
             if (strrpos($array['fieldid'], ',') != false) {
                 $array['fieldid'] = explode(',', $array['fieldid']);
             } else {
                 if (empty($array['fieldid'])) {
                     $array['fieldid'] = '';
                 }
             }
         }
     }
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_dzproduct.fielddata.' . $array['id'])) {
         $actions = JFactory::getACL()->getActions('com_dzproduct', 'fielddata');
         $default_actions = JFactory::getACL()->getAssetRules('com_dzproduct.fielddata.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     //Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 11
0
 function apply()
 {
     $app = JFactory::getApplication();
     $configs = JRequest::get('POST');
     $model = JFBCFactory::config();
     JPluginHelper::importPlugin('socialprofiles');
     $profilePlugins = $app->triggerEvent('socialProfilesGetPlugins');
     foreach ($profilePlugins as $plugin) {
         $pluginName = $plugin->getName();
         $settings = new JRegistry();
         $search = "profiles_" . $pluginName . "_";
         $stdFields = JRequest::getVar('profiles_' . $pluginName);
         $settings->loadArray($stdFields);
         foreach ($configs as $key => $value) {
             $pos = strpos($key, $search);
             if ($pos === 0) {
                 $key = str_replace($search, "", $key);
                 if (strpos($key, "field_map") != false) {
                     $key = str_replace("_field_map", ".", $key);
                     $settings->set('field_map.' . $key, $value);
                 }
             }
         }
         $model->update("profile_" . $pluginName, $settings->toString());
     }
     JFBCFactory::log(JText::_('COM_JFBCONNECT_MSG_SETTINGS_UPDATED'));
     $this->display();
 }
Exemplo n.º 12
0
 /**
  * TuiyoParameter::saveParams()
  * 
  * @param mixed $postParams
  * @param mixed $key
  * @param string $type
  * @return
  */
 public function saveParams($postParams, $key, $type = "system")
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.client.helper');
     // Set FTP credentials, if given
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     $file = TUIYO_CONFIG . DS . strtolower($key) . ".ini";
     if (JFile::exists($file)) {
         JFile::write($file);
     }
     if (count($postParams)) {
         $registry = new JRegistry();
         $registry->loadArray($postParams);
         $iniTxt = $registry->toString();
         // Try to make the params file writeable
         if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) {
             JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file writable'));
             return false;
         }
         //Write the file
         $return = JFile::write($file, $iniTxt);
         // Try to make the params file unwriteable
         if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
             JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file unwritable'));
             return false;
         }
         if (!$return) {
             JError::raiseError(TUIYO_SERVER_ERROR, _("Could not save the template parameters"));
             return false;
         }
         return $return;
     }
 }
Exemplo n.º 13
0
 public function savepositions($cachable = false, $urlparams = false)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $jinput = JFactory::getApplication()->input;
     $layout = $jinput->get('layout', 'default', 'STRING');
     $print_config = $jinput->get('print_config', array(), 'ARRAY');
     $direction = $jinput->get('direction', '', 'STRING');
     $modified = JFactory::getDate()->toSql();
     $db = JFactory::getDBO();
     $registry = new JRegistry();
     $registry->loadArray($print_config);
     $print_config = (string) $registry;
     // get component params
     $params = JComponentHelper::getParams('com_sibdiet');
     if ($layout == 'addresses') {
         $params->set('print_config_addresses', $print_config);
         // Save to component params
         $query = $db->getQuery(true)->update("#__extensions")->set('`params` = ' . $db->quote((string) $params))->where("`element` = 'com_sibdiet'");
     } else {
         $params->set('print_config_' . $direction, $print_config);
         // Save to user settings
         $query = "INSERT INTO #__sibdiet_settings (id,modified,print_config_" . $direction . ") VALUES (" . JFactory::getUser()->id . ",'" . $modified . "','" . $print_config . "') ON DUPLICATE KEY UPDATE modified = '" . $modified . "', print_config_" . $direction . " = '" . $print_config . "'";
     }
     $db->setQuery($query);
     //execute db object
     try {
         // Execute the query in Joomla 3.0.
         $result = $db->execute();
     } catch (Exception $e) {
         //print the errors
         print_r($e);
     }
     return self::display();
 }
Exemplo n.º 14
0
 public function save()
 {
     $task = $this->getTask();
     // get the Application Object
     $app = JFactory::getApplication();
     // get the payment id
     $payment_id = $app->input->getInt('extension_id');
     // if payment id exists
     if ($payment_id) {
         $data = $app->input->getArray($_POST);
         $paymentdata = array();
         $paymentdata['extension_id'] = $payment_id;
         $registry = new JRegistry();
         $registry->loadArray($data);
         $paymentdata['params'] = $registry->toString('JSON');
         try {
             F0FTable::getAnInstance('Payment', 'J2StoreTable')->save($paymentdata);
         } catch (Exception $e) {
             $msg = $e->getMessage();
         }
         switch ($task) {
             case 'apply':
                 parent::apply();
                 break;
             case 'save':
                 parent::save();
                 break;
             case 'savenew':
                 parent::savenew();
                 break;
         }
     }
 }
Exemplo n.º 15
0
 function display($cachable = false, $urlparams = array())
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if (empty(JFactory::getUser()->id)) {
         $url = JRoute::_("index.php?option=com_j2store&view=downloads");
         $redirect = "index.php?option=com_users&view=login&return=" . base64_encode($url);
         $redirect = JRoute::_($redirect, false);
         JFactory::getApplication()->redirect($redirect);
         return;
     }
     $params = JComponentHelper::getParams('com_j2store');
     $model = $this->getModel('downloads');
     $ns = 'com_j2store.downloads';
     $files = $model->getItems();
     $registry = new JRegistry();
     $registry->loadArray($files);
     $files = $registry->toObject();
     //print_r($files);
     //exit;
     //$freefiles=$model->getFreeFiles();
     //$files=$this->process($files,$freefiles);
     $view = $this->getView('downloads', 'html');
     $view->set('_controller', 'downloads');
     $view->set('_view', 'downloads');
     $view->set('_doTask', true);
     $view->set('hidemenu', false);
     $view->setModel($model, true);
     $view->assign('files', $files);
     $view->assign('params', $params);
     $view->setLayout('default');
     //	$view->display();
     parent::display();
 }
Exemplo n.º 16
0
	public function bind($array, $ignore = '')
	{
		if (is_object($array))
		{
			$array = get_object_vars($array);
		}

		if (isset($array['params']) && !is_string($array['params']))
		{
			if ($array['params'] instanceof JRegistry)
			{
				$registry = $array['params'];
			}
			elseif (is_array($array['params']))
			{
				$registry = new JRegistry;
				$registry->loadArray($array['params']);
			}
			else
			{
				$registry = new JRegistry;
			}
			// TODO: convert to J!2.5: (string) $registry
			$array['params'] = $registry->toString();
		}

		return parent::bind($array, $ignore);
	}
Exemplo n.º 17
0
/**
 * Disables the unsupported eAccelerator caching method, replacing it with the
 * "file" caching method.
 *
 * @return  void
 *
 * @since   3.2
 */
function admin_postinstall_eaccelerator_action()
{
    $prev = new JConfig();
    $prev = JArrayHelper::fromObject($prev);
    $data = array('cacheHandler' => 'file');
    $data = array_merge($prev, $data);
    $config = new JRegistry('config');
    $config->loadArray($data);
    jimport('joomla.filesystem.path');
    jimport('joomla.filesystem.file');
    // Set the configuration file path.
    $file = JPATH_CONFIGURATION . '/configuration.php';
    // Get the new FTP credentials.
    $ftp = JClientHelper::getCredentials('ftp', true);
    // Attempt to make the file writeable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
    }
    // Attempt to write the configuration file as a PHP class named JConfig.
    $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
    if (!JFile::write($file, $configuration)) {
        JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
        return;
    }
    // Attempt to make the file unwriteable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
    }
}
Exemplo n.º 18
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param	array		$array Named array
  * @param   string 		$ignore
  * @return	null|string	null is operation was satisfactory, otherwise returns an error
  * @see		JTable:bind
  * @since	1.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!isset($array['lat']) && !isset($array['lng'])) {
         $options = array(0 => $array['address_1'], 1 => $array['city'], 2 => isset($array['geo_state_id']) ? $array['geo_state_id'] : null, 3 => $array['country_id']);
         $coords = SRFactory::getGeoCoder($options)->process();
         if (is_array($coords)) {
             $array['lat'] = $coords['lat'];
             $array['lng'] = $coords['lng'];
         }
     }
     // Bind the rules.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $rules = new JAccessRules($array['rules']);
         $this->setRules($rules);
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 19
0
 function save()
 {
     $config = new JRegistry('config');
     $config_array = array();
     // affichage des boutons
     $config_array['bt_jamendo'] = JRequest::getVar('bt_jamendo', 0, 'post', 'int');
     $config_array['bt_artiste'] = JRequest::getVar('bt_artiste', 0, 'post', 'int');
     $config_array['bt_categories'] = JRequest::getVar('bt_categories', 0, 'post', 'int');
     $config_array['bt_sms'] = JRequest::getVar('bt_sms', 0, 'post', 'int');
     $config_array['bt_stats'] = JRequest::getVar('bt_stats', 0, 'post', 'int');
     $config_array['bt_aide'] = JRequest::getVar('bt_aide', 0, 'post', 'int');
     $config->loadArray($config_array);
     //Fichier de configuration
     $fname = JPATH_BASE . "/components/com_muzeetop/config.php";
     //écriture du fichier
     jimport('joomla.filesystem.file');
     $string = $config->toString('PHP', array('class' => 'JMztOptions'));
     if (JFile::write($fname, &$string)) {
         $msg = JTEXT::_('COM_MUZEETOP_OPTIONS_ENREGISTRE');
     } else {
         $msg = JTEXT::_('COM_MUZEETOP_ERREUR_OPTIONS_ENREGISTRE');
     }
     $link = 'index.php?option=com_muzeetop';
     $this->setRedirect($link, $msg);
 }
Exemplo n.º 20
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param   array  Named array
  * @return  null|string	null is operation was satisfactory, otherwise returns an error
  * @see     JTable:bind
  * @since   1.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['print_title']) && is_array($array['print_title'])) {
         $array['print_title'] = array_filter($array['print_title']);
         if (count($array['print_title'])) {
             $registry = new JRegistry();
             $registry->loadArray($array['print_title']);
             $array['print_title'] = (string) $registry;
         }
     }
     if (isset($array['nutrients']) && is_array($array['nutrients'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['nutrients']);
         $array['nutrients'] = (string) $registry;
     }
     if (isset($array['compositions']) && is_array($array['compositions'])) {
         // delete 0 values
         $array['compositions'] = array_filter($array['compositions']);
         $registry = new JRegistry();
         $registry->loadArray($array['compositions']);
         $array['compositions'] = (string) $registry;
         // if composition has sub compositions then nutrients values must delete
         $array['nutrients'] = '';
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 21
0
 /**
  * Stores a contact
  *
  * @param	boolean	True to update fields even if they are null.
  * @return	boolean	True on success, false on failure.
  * @since	1.6
  */
 public function store($updateNulls = false)
 {
     // Transform the params field
     if (is_array($this->params)) {
         $registry = new JRegistry();
         $registry->loadArray($this->params);
         $this->params = (string) $registry;
     }
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified = $date->toSql();
         $this->modified_by = $user->get('id');
     } else {
         // New newsfeed. A feed created and created_by field can be set by the user,
         // so we don't touch either of these if they are set.
         if (!intval($this->created)) {
             $this->created = $date->toSql();
         }
         if (empty($this->created_by)) {
             $this->created_by = $user->get('id');
         }
     }
     // Verify that the alias is unique
     $table = JTable::getInstance('Contact', 'ContactTable');
     if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_CONTACT_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     // Attempt to store the data.
     return parent::store($updateNulls);
 }
Exemplo n.º 22
0
 public function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('RESTRICTED');
     $db = JFactory::getDBO();
     $post = JRequest::getVar('params', '', 'POST', 'ARRAY');
     $registry = new JRegistry();
     $registry->loadArray($post);
     // get params
     $component = WFExtensionHelper::getComponent();
     // set preferences object
     $preferences = $registry->toObject();
     if (isset($preferences->rules)) {
         $preferences->access = $preferences->rules;
         unset($preferences->rules);
     }
     // set params as JSON string
     $component->params = json_encode($preferences);
     if (!$component->check()) {
         JError::raiseError(500, $row->getError());
     }
     if (!$component->store()) {
         JError::raiseError(500, $row->getError());
     }
     $component->checkin();
     $close = 0;
     if ($this->getTask() == 'save') {
         $close = 1;
     }
     $this->setRedirect('index.php?option=com_jce&view=preferences&tmpl=component&close=' . $close, WFText::_('WF_PREFERENCES_SAVED'));
 }
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param    array        Named array
  *
  * @return    null|string    null is operation was satisfactory, otherwise returns an error
  * @see        JTable:bind
  * @since      1.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_mapa.mapadevenezuela.' . $array['id'])) {
         $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_mapa/access.xml', "/access/section[@name='mapadevenezuela']/");
         $default_actions = JAccess::getAssetRules('com_mapa.mapadevenezuela.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     //Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 24
0
 function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('RESTRICTED');
     $db = JFactory::getDBO();
     $task = $this->getTask();
     $client = JRequest::getWord('client', 'site');
     // get params
     $component = WFExtensionHelper::getComponent();
     // create params object from json string
     $params = json_decode($component->params);
     $registry = new JRegistry();
     $registry->loadArray(JRequest::getVar('params', '', 'POST', 'ARRAY'));
     // set preference object
     $params->editor = $registry->toObject();
     // set params as JSON string
     $component->params = json_encode($params);
     if (!$component->check()) {
         JError::raiseError(500, $component->getError());
     }
     if (!$component->store()) {
         JError::raiseError(500, $component->getError());
     }
     $component->checkin();
     $msg = JText::sprintf('WF_CONFIG_SAVED');
     switch ($task) {
         case 'apply':
             $this->setRedirect('index.php?option=com_jce&view=config', $msg);
             break;
         case 'save':
         default:
             $this->setRedirect('index.php?option=com_jce&view=cpanel', $msg);
             break;
     }
 }
Exemplo n.º 25
0
 /**
  * Overloaded bind function
  *
  * @param	array		$hash named array
  * @return	null|string	null is operation was satisfactory, otherwise returns an error
  * @see JTable:bind
  * @since 1.5
  */
 public function bind($array, $ignore = array())
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         if ((int) $registry->get('width', 0) < 0) {
             $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_WIDTH_LABEL')));
             return false;
         }
         if ((int) $registry->get('height', 0) < 0) {
             $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_HEIGHT_LABEL')));
             return false;
         }
         // Converts the width and height to an absolute numeric value:
         $width = abs((int) $registry->get('width', 0));
         $height = abs((int) $registry->get('height', 0));
         // Sets the width and height to an empty string if = 0
         $registry->set('width', $width ? $width : '');
         $registry->set('height', $height ? $height : '');
         $array['params'] = (string) $registry;
     }
     if (isset($array['imptotal'])) {
         $array['imptotal'] = abs((int) $array['imptotal']);
     }
     return parent::bind($array, $ignore);
 }
 /**
  * Overloaded bind function
  *
  * @param   array  $array   Named array
  * @param   mixed  $ignore  An optional array or space separated list of properties
  *                          to ignore while binding.
  *
  * @return  mixed  Null if operation was satisfactory, otherwise returns an error string
  *
  * @see     JTable::bind()
  * @since   3.1
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['core_params']) && is_array($array['core_params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['core_params']);
         $array['core_params'] = (string) $registry;
     }
     if (isset($array['core_metadata']) && is_array($array['core_metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['core_metadata']);
         $array['core_metadata'] = (string) $registry;
     }
     if (isset($array['core_images']) && is_array($array['core_images'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['core_images']);
         $array['core_images'] = (string) $registry;
     }
     if (isset($array['core_urls']) && is_array($array['core_urls'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['core_urls']);
         $array['core_urls'] = (string) $registry;
     }
     if (isset($array['core_body']) && is_array($array['core_body'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['core_body']);
         $array['core_body'] = (string) $registry;
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 27
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param   array  $array   Named array
  * @param   mixed  $ignore  Optional array or list of parameters to ignore
  *
  * @return  null|string  null is operation was satisfactory, otherwise returns an error
  *
  * @see     JTable:bind
  * @since   1.5
  */
 public function bind($array, $ignore = '')
 {
     $input = JFactory::getApplication()->input;
     $task = $input->getString('task', '');
     if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_autofilter') && $array['state'] == 1)) {
         $array['state'] = 0;
     }
     if ($array['id'] == 0) {
         $array['created_by'] = JFactory::getUser()->id;
     }
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_autofilter.categorie.' . $array['id'])) {
         $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_autofilter/access.xml', "/access/section[@name='categorie']/");
         $default_actions = JAccess::getAssetRules('com_autofilter.categorie.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     // Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
Exemplo n.º 28
0
	/**
	 * Overloaded bind function
	 *
	 * @param   array  $array   Named array
	 * @param   mixed  $ignore  An optional array or space separated list of properties to ignore while binding.
	 *
	 * @return  mixed  Null if operation was satisfactory, otherwise returns an error
	 *
	 * @see     JTable:bind
	 * @since   11.1
	 */
	public function bind($array, $ignore = '')
	{
		// Verify that the default home menu is not unset
		if ($this->home == '1' && $this->language == '*' && ($array['home'] == '0'))
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT_DEFAULT'));
			return false;
		}
		//Verify that the default home menu set to "all" languages" is not unset
		if ($this->home == '1' && $this->language == '*' && ($array['language'] != '*'))
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT'));
			return false;
		}

		// Verify that the default home menu is not unpublished
		if ($this->home == '1' && $this->language == '*' && $array['published'] != '1')
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'));
			return false;
		}

		if (isset($array['params']) && is_array($array['params']))
		{
			$registry = new JRegistry();
			$registry->loadArray($array['params']);
			$array['params'] = (string) $registry;
		}

		return parent::bind($array, $ignore);
	}
Exemplo n.º 29
0
 /**
  * Adds the ilike service to user tables;
  * @param unknown_type $post
  * @param unknown_type $userid
  */
 public function addService($post, $userid)
 {
     TuiyoLoader::helper("parameter");
     $table =& TuiyoLoader::table("userplugins", true);
     $table->load(null);
     //blank
     $table->name = "ilike";
     $table->type = "service";
     $table->userid = (int) $userid;
     $table->privacy = '%p00%';
     //get parameters;
     $registry = new JRegistry();
     $postParams = JRequest::getVar('params', array(), 'post', 'array');
     if (count($postParams)) {
         $registry->loadArray($postParams);
         $table->params = $registry->toString();
         //store the username and password and anything else;
     }
     if (!$table->store()) {
         echo $table->getError();
         return false;
         //get the eror;
     }
     return true;
 }
Exemplo n.º 30
0
 function saveDetails()
 {
     jimport('joomla.filesystem.file');
     $option = JRequest::getVar('option', '', '', 'cmd');
     $post = JRequest::get('post');
     $basepath = JPATH_ADMINISTRATOR . '/components/com_jsecure';
     $configFile = $basepath . '/params.php';
     $xml = $basepath . '/com_jsecure.xml';
     require_once $configFile;
     // Read the ini file
     if (JFile::exists($configFile)) {
         $content = JFile::read($configFile);
     } else {
         $content = null;
     }
     $config = new JRegistry('JSecureConfig');
     $config_array = array();
     $config_array['publish'] = JRequest::getVar('publish', 0, 'post', 'int');
     $config_array['enableMasterPassword'] = JRequest::getVar('enableMasterPassword', 0, 'post', 'int');
     $config_array['master_password'] = JRequest::getVar('master_password', '', 'post', 'string');
     $config_array['passkeytype'] = JRequest::getVar('passkeytype', 'url', 'post', 'string');
     $config_array['key'] = JRequest::getVar('key', '', 'post', 'string');
     $config_array['options'] = JRequest::getVar('options', 0, 'post', 'string');
     $config_array['custom_path'] = JRequest::getVar('custom_path', '', 'post', 'string');
     $config_array['sendemail'] = JRequest::getVar('sendemail', 0, 'post', 'string');
     $config_array['sendemaildetails'] = JRequest::getVar('sendemaildetails', '3', 'post', 'string');
     $config_array['emailid'] = JRequest::getVar('emailid', '', 'post', 'string');
     $config_array['emailsubject'] = JRequest::getVar('emailsubject', '', 'post', 'string');
     $config_array['iptype'] = JRequest::getVar('iptype', 0, 'post', 'int');
     $config_array['iplist'] = JRequest::getVar('iplist', '', 'post', 'string');
     $config_array['mpsendemail'] = JRequest::getVar('mpsendemail', 0, 'post', 'int');
     $config_array['mpemailsubject'] = JRequest::getVar('mpemailsubject', '', 'post', 'string');
     $config_array['mpemailid'] = JRequest::getVar('mpemailid', '', 'post', 'string');
     $oldValue = new JSecureConfig();
     if ($config_array['key'] == '') {
         $config_array['key'] = $oldValue->key;
     } else {
         $keyvalue = $config_array['key'];
         $config_array['key'] = md5(base64_encode($config_array['key']));
     }
     if ($config_array['master_password'] == '') {
         $config_array['master_password'] = $oldValue->master_password;
     } else {
         $masterkeyvalue = $config_array['master_password'];
         $config_array['master_password'] = md5(base64_encode($config_array['master_password']));
     }
     $modifiedFieldName = $this->checkModifiedFieldName($config_array, $oldValue, $JSecureCommon, $keyvalue, $masterkeyvalue);
     $config->loadArray($config_array);
     $fname = JPATH_COMPONENT_ADMINISTRATOR . DS . 'params.php';
     if (JFile::write($fname, $config->toString('PHP', 'JSecureConfig', array('class' => 'JSecureConfig')))) {
         $msg = JText::_('The Configuration Details have been updated');
     } else {
         $msg = JText::_('ERRORCONFIGFILE');
     }
     $JSecureConfig = new JSecureConfig();
     if ($JSecureConfig->mpsendemail != '0') {
         $result = $this->sendmail($JSecureConfig, $modifiedFieldName);
     }
     return true;
 }