public static function onCCK_Storage_LocationImport($data, &$config = array(), $pk = 0) { // $config['force_password'] = true; if (!$config['pk']) { // Init if (isset($config['key']) && $config['key']) { if (isset($data[$config['key']]) && $data[$config['key']] != '') { $pk = JCckDatabase::loadResult('SELECT ' . self::$key . ' FROM ' . self::$table . ' WHERE ' . $config['key'] . ' = "' . $data[$config['key']] . '"'); } $pk = $pk > 0 ? $pk : 0; } else { $pk = isset($data[self::$key]) && $data[self::$key] > 0 ? $data[self::$key] : 0; } $table = self::_getTable_fromSite($pk); $isNew = $table->{self::$key} > 0 ? false : true; $iPk = 0; if ($isNew) { if (isset($data[self::$key])) { $iPk = $data[self::$key]; unset($data[self::$key]); } $config['log'] = 'created'; } else { $config['id'] = JCckDatabase::loadResult('SELECT id FROM #__cck_core WHERE storage_location = "joomla_user" AND pk = ' . (int) $pk); $config['log'] = 'updated'; } if (!$config['id']) { $config['id'] = parent::g_onCCK_Storage_LocationPrepareStore(); } self::_initTable($table, $data, $config, true); // Prepare if ($data['password']) { $data['password2'] = $data['password']; } $table->bind($data); if (isset($config['params']['force_password']) && $config['params']['force_password']) { $table->password = $table->password_clear; } $parameters = JComponentHelper::getParams('com_users'); self::_completeTable($table, $data, $config, $parameters); // Store if (!$table->save()) { $config['error'] = true; $config['log'] = 'cancelled'; $config['pk'] = $pk; parent::g_onCCK_Storage_LocationRollback($config['id']); return false; } // Tweak //if ( $iPk > 0 ) { // if ( JCckDatabase::execute( 'UPDATE '.self::$table.' SET '.self::$key.' = '.(int)$iPk.' WHERE '.self::$key.' = '.(int)$table->{self::$key} ) ) { // $table->{self::$key} = $iPk; // $config['auto_inc'] = ( $iPk > $config['auto_inc'] ) ? $iPk : $config['auto_inc']; // if ( $table->asset_id ) { // JCckDatabase::execute( 'UPDATE #__assets SET name = "com_content.article.'.$iPk.'" WHERE id = '.(int)$table->asset_id ); // } // } //} if (!$config['pk']) { $config['pk'] = $table->{self::$key}; } $config['author'] = $table->id; } parent::g_onCCK_Storage_LocationStore($data, self::$table, $config['pk'], $config, $config['params']); return true; }