Location: PHPKode > projects > HikaShop > back/controllers/import.php
<?php
/**
 * @package		HikaShop for Joomla!
 * @version		1.4.3
 * @author		hikashop.com
 * @copyright	(C) 2010 HIKARI SOFTWARE. All rights reserved.
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php
class ImportController extends hikashopController{
	var $type='import';
	function __construct(){
		parent::__construct();
		$this->modify[]='import';
		$this->registerDefaultTask('show');
		$this->helper = hikashop::get('helper.import');
	}
	function import(){
		JRequest::checkToken() or die( 'Invalid Token' );
		$function = JRequest::getCmd('importfrom');
		$this->helper->addTemplate(JRequest::getInt('template_product',0));
		switch($function){
			case 'file':
				$this->_file();
				break;
			case 'textarea':
				$this->_textarea();
				break;
			case 'folder':
				if(hikashop::level(2)){
					$this->_folder();
				}
				break;
			default:
				$plugin = hikashop::import('hikashop',$function);
				if($plugin){
					$plugin->onImportRun();
				}
				break;
		}
		return $this->show();
	}
	function _textarea(){
		$content = JRequest::getVar('textareaentries','','','string',JREQUEST_ALLOWRAW);
		$this->helper->overwrite = JRequest::getInt('textarea_update_products');
		$this->helper->createCategories = JRequest::getInt('textarea_create_categories');
		$this->helper->force_published = JRequest::getInt('textarea_force_publish');
		return $this->helper->handleContent($content);
	}
	function _folder(){
		$type = JRequest::getCmd('importfolderfrom');
		$delete = JRequest::getInt('delete_files_automatically');
		$uploadFolder = JRequest::getVar($type.'_folder','');
		return $this->helper->importFromFolder($type,$delete,$uploadFolder);
	}
	function _file(){
		$importFile =  JRequest::getVar( 'importfile', array(), 'files','array');
		$this->helper->overwrite = JRequest::getInt('file_update_products');
		$this->helper->createCategories = JRequest::getInt('file_create_categories');
		$this->helper->force_published = JRequest::getInt('file_force_publish');
		return $this->helper->importFromFile($importFile);
	}
}
Return current item: HikaShop