Exemplo n.º 1
0
 /**
  * Processes the migration item
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function process()
 {
     // Check for request forgeries
     FD::checkToken();
     // Retrieve the view.
     $view = $this->getCurrentView();
     $component = JRequest::getVar('component', '');
     $item = JRequest::getVar('item', '');
     $mapping = JRequest::getVar('mapping', '');
     $updateconfig = JRequest::getBool('updateconfig', 0);
     $migrator = FD::get('Migrators', $component);
     // Set the user mapping
     $migrator->setUserMapping($mapping);
     // we need to check if we need to update config or not.
     if (empty($item)) {
         $configTable = FD::table('Config');
         $config = FD::registry();
         if ($configTable->load('site')) {
             $config->load($configTable->value);
             if ($config->get('points.enabled') == 1) {
                 $config->set('points.enabled', 0);
                 // Convert the config object to a json string.
                 $jsonString = $config->toString();
                 $configTable->set('value', $jsonString);
                 // Try to store the configuration.
                 if ($configTable->store()) {
                     $updateconfig = true;
                     // we need to reload the config
                     $esConfig = new SocialConfig();
                     $esConfig->reload();
                 }
             }
         }
     }
     // Process the migration
     $obj = $migrator->process($item);
     if ($obj->continue == false && $updateconfig == true) {
         // now we need to re-enable back the points setting.
         $configTable = FD::table('Config');
         $config = FD::registry();
         if ($configTable->load('site')) {
             $config->load($configTable->value);
             $config->set('points.enabled', 1);
             // Convert the config object to a json string.
             $jsonString = $config->toString();
             $configTable->set('value', $jsonString);
             // Try to store the configuration.
             $configTable->store();
             $updateconfig = false;
         }
     }
     // Return the data back to the view.
     return $view->call(__FUNCTION__, $obj, $updateconfig);
 }
Exemplo n.º 2
0
 /**
  * An alias to FD::getInstance( 'Config' , 'joomla' )
  *
  * Example:
  * <code>
  * <?php
  * $config 	= FD::jconfig();
  * echo $config->getValue( 'some.value' );
  * ?>
  * </code>
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	SocialTableConfig	Configuration object.
  *
  * @author	Mark Lee <*****@*****.**>
  */
 public static function jconfig()
 {
     // Load config library
     FD::load('config');
     $config = SocialConfig::getInstance('joomla');
     return $config;
 }