diff --git a/workflow/engine/methods/setup/pluginsImportFile.php b/workflow/engine/methods/setup/pluginsImportFile.php index 69a90098e..e5745908d 100755 --- a/workflow/engine/methods/setup/pluginsImportFile.php +++ b/workflow/engine/methods/setup/pluginsImportFile.php @@ -110,6 +110,81 @@ try { $message = G::loadTranslation( 'ID_ENTERPRISE_INSTALLED') . ' ' . G::loadTranslation( 'ID_LOG_AGAIN'); G::SendMessageText($message, "INFO"); + $licenseManager = &pmLicenseManager::getSingleton(); + die(''); + } + } + + //save the packages plugins + if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) { + $filename = $_FILES['form']['name']['PLUGIN_FILENAME']; + $path = PATH_DOCUMENT . 'input' . PATH_SEP; + if (strpos($filename, 'plugins-') !== false) { + + G::LoadThirdParty( 'pear/Archive', 'Tar' ); + $tar = new Archive_Tar( $path . $filename ); + $sFileName = substr( $filename, 0, strrpos( $filename, '.' ) ); + $sClassName = substr( $filename, 0, strpos( $filename, '-' ) ); + + $files = $tar->listContent(); + $licenseName = ''; + $listFiles = array(); + foreach ($files as $key => $val) { + if (strpos(trim($val['filename']), 'plugins/') !== false) { + $listFiles[] = trim($val['filename']); + } + if (strpos(trim($val['filename']), 'license_') !== false) { + $licenseName = trim($val['filename']); + } + } + $tar->extractList( $listFiles, PATH_PLUGINS . 'data'); + $tar->extractList( $licenseName, PATH_PLUGINS); + + $pluginRegistry = &PMPluginRegistry::getSingleton(); + $autoPlugins = glob(PATH_PLUGINS . "data/plugins/*.tar"); + $autoPluginsA = array(); + + foreach ($autoPlugins as $filePath) { + $plName = basename($filePath); + //if (!(in_array($plName, $def))) { + if (strpos($plName, 'enterprise') === false) { + $autoPluginsA[]["sFilename"] = $plName; + } + } + + $aPlugins = $autoPluginsA; + foreach ($aPlugins as $key=>$aPlugin) { + $sClassName = substr($aPlugin["sFilename"], 0, strpos($aPlugin["sFilename"], "-")); + + $oTar = new Archive_Tar(PATH_PLUGINS . "data/plugins/" . $aPlugin["sFilename"]); + $oTar->extract(PATH_PLUGINS); + + if (!(class_exists($sClassName))) { + require_once (PATH_PLUGINS . $sClassName . ".php"); + } + + $pluginDetail = $pluginRegistry->getPluginDetails($sClassName . ".php"); + $pluginRegistry->installPlugin($pluginDetail->sNamespace); //error + } + + file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance()); + + $licfile = glob(PATH_PLUGINS . "*.dat"); + + if ((isset($licfile[0])) && ( is_file($licfile[0]) )) { + $licfilename = basename($licfile[0]); + @copy($licfile[0], PATH_DATA_SITE . $licfilename); + @unlink($licfile[0]); + } + + require_once ('classes/model/AddonsStore.php'); + AddonsStore::checkLicenseStore(); + $licenseManager = &pmLicenseManager::getSingleton(); + AddonsStore::updateAll(false); + + $message = G::loadTranslation( 'ID_ENTERPRISE_INSTALLED') . ' ' . G::loadTranslation( 'ID_LOG_AGAIN'); + G::SendMessageText($message, "INFO"); + $licenseManager = &pmLicenseManager::getSingleton(); die(''); } }