Exemplo n.º 1
0
 /**
  * Controller
  */
 public function process()
 {
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('admincp.product.process')->updateActive($aVals)) {
             $this->url()->send('admincp.product', null, Phpfox::getPhrase('admincp.product_s_updated'));
         }
     }
     if ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_product_index_3')) {
         eval($sPlugin);
         if (isset($mReturnFromPlugin)) {
             return $mReturnFromPlugin;
         }
     }
     if ($sDeleteProduct = $this->request()->get('delete')) {
         if (Phpfox::getService('admincp.product.process')->delete($sDeleteProduct)) {
             $this->url()->send('admincp.product', null, Phpfox::getPhrase('admincp.product_successfully_deleted'));
         }
     }
     if ($sUpgrade = $this->request()->get('upgrade')) {
         if ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_product_index_1')) {
             eval($sPlugin);
             if (isset($mReturnFromPlugin)) {
                 return $mReturnFromPlugin;
             }
         }
         if (Phpfox::getService('admincp.product.process')->upgrade($sUpgrade)) {
             Phpfox_Plugin::set();
             if ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_product_index_2')) {
                 eval($sPlugin);
                 if (isset($mReturnFromPlugin)) {
                     return $mReturnFromPlugin;
                 }
             }
             $this->url()->send('admincp.product', null, Phpfox::getPhrase('admincp.product_successfully_upgraded'));
         }
     }
     $aProducts = Admincp_Service_Product_Product::instance()->get(false);
     foreach ($aProducts as $iKey => $aProduct) {
         if ($aProduct['product_id'] == 'phpfox' || $aProduct['product_id'] == 'phpfox_installer') {
             unset($aProducts[$iKey]);
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('admincp.manage_products'))->setBreadcrumb(Phpfox::getPhrase('admincp.manage_products'))->assign(array('aProducts' => $aProducts));
 }
Exemplo n.º 2
0
	date_default_timezone_set('GMT');
	
	define('PHPFOX_TIME', time());
}
else 
{
	define('PHPFOX_TIME', strtotime(gmdate("M d Y H:i:s", time())));
}

Phpfox::getLib('setting')->set();

if (!defined('PHPFOX_NO_PLUGINS'))
{
	require(PHPFOX_DIR_LIB_CORE . 'plugin' . PHPFOX_DS . 'plugin.class.php');
	
	Phpfox_Plugin::set();
}
else 
{
	final class Phpfox_Plugin
	{
		public static function set() {}
		public static function get() {return false;}
	}
}

if (!function_exists('json_encode')) 
{
	require(PHPFOX_DIR_LIB . 'json' . PHPFOX_DS . 'JSON.php');
	
	if (!function_exists('json_encode'))
Exemplo n.º 3
0
 /**
  * Controller
  */
 public function process()
 {
     if (Phpfox::getParam('core.phpfox_is_hosted')) {
         $this->url()->send('admincp');
     }
     $oArchiveExport = Phpfox::getLib('archive.export')->set(array('zip'));
     $oArchiveImport = Phpfox::getLib('archive.import')->set(array('zip'));
     if ($this->request()->get('req4') == 'process') {
         $aData = unserialize(base64_decode($this->request()->get('step')));
         if ($mReturn = Phpfox::getService('admincp.module.process')->processInstall($this->request()->get('id'), $aData, $this->request()->get('overwrite'))) {
             if (is_array($mReturn)) {
                 $this->url()->send('admincp', array('product', 'file', 'process', 'overwrite' => $this->request()->get('overwrite'), 'id' => $this->request()->get('id'), 'step' => base64_encode(serialize($mReturn))));
             } else {
                 Phpfox_Module::instance()->_cacheModules();
                 Phpfox_Plugin::set();
                 if ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_product_file_1')) {
                     eval($sPlugin);
                     if (isset($mReturnFromPlugin)) {
                         return $mReturnFromPlugin;
                     }
                 }
                 if ($this->request()->get('overwrite')) {
                     if ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_product_file_2')) {
                         eval($sPlugin);
                         if (isset($mReturnFromPlugin)) {
                             return $mReturnFromPlugin;
                         }
                     }
                     $this->url()->send('admincp', array('product'), Phpfox::getPhrase('admincp.product_successfully_installed'));
                 } else {
                     if ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_product_file_3')) {
                         eval($sPlugin);
                         if (isset($mReturnFromPlugin)) {
                             return $mReturnFromPlugin;
                         }
                     }
                     $this->url()->send('admincp', array('product'), Phpfox::getPhrase('admincp.product_successfully_installed'));
                 }
             }
         }
     }
     // Run the export routine
     if ($sExportId = $this->request()->get('export')) {
         if ($mData = Admincp_Service_Product_Product::instance()->export($sExportId)) {
             $oArchiveExport->download('phpfox-product-' . $mData['name'], 'zip', $mData['folder']);
         }
     }
     if ($sProduct = $this->request()->get('install')) {
         // Import the settings
         if ($aInstall = Phpfox::getService('admincp.product.process')->import($sProduct, $this->request()->get('overwrite'))) {
             $this->url()->send('admincp', array('product', 'file', 'process', 'overwrite' => $this->request()->get('overwrite'), 'id' => $aInstall['product_id'], 'step' => base64_encode(serialize($aInstall['files']))));
         }
     }
     // Run the import routine
     // if (isset($_FILES['import']) && ($aFile = $_FILES['import']))
     /*
     if ($this->request()->get('import'))
     {
     	if (preg_match('/^phpfox-product-(.*?)\.zip$/i', $aFile['name'], $aMatches))
                 {
     		if ($aFiles = $oArchiveImport->process($aFile))
     		{
     			$sFolderName = $aMatches[1];
     			if (preg_match('/^(.*)-(.*?)$/i', $aMatches[1]))
     			{
     				$aParts = explode('-', $aMatches[1]);
     				$sFolderName = $aParts[0];
     			}						
     			
     			// Import the settings
     			if (($aInstall = Phpfox::getService('admincp.product.process')->import($sFolderName, $this->request()->get('overwrite'))))
     			{
     				$this->url()->send('admincp', array('product', 'file', 'process', 'overwrite' => $this->request()->get('overwrite'), 'id' => $aInstall['product_id'], 'step' => base64_encode(serialize($aInstall['files']))));
     			}
     		}
                 }
                 else 
                 {
                 	Phpfox_Error::set('Not a valid product to import.');	
                 }
     }
     */
     $aProducts = Admincp_Service_Product_Product::instance()->get();
     foreach ($aProducts as $iKey => $aProduct) {
         if ($aProduct['product_id'] == 'phpfox' || $aProduct['product_id'] == 'phpfox_installer') {
             unset($aProducts[$iKey]);
         }
     }
     // Assign needed vars to the template
     $this->template()->setTitle(Phpfox::getPhrase('admincp.import_products'))->setBreadcrumb(Phpfox::getPhrase('admincp.products'), $this->url()->makeUrl('admincp.product'))->setBreadCrumb(Phpfox::getPhrase('admincp.import_products'), null, true)->assign(array('aArchives' => $oArchiveExport->getSupported(), 'sSupported' => $oArchiveImport->getSupported(), 'sFtpEditLink' => $this->url()->makeUrl('admincp.setting.edit', array('group-id' => 'ftp')), 'aNewProducts' => Admincp_Service_Product_Product::instance()->getNewProductsForInstall()));
 }