public function importUserModuleStep2(Vtiger_Request $request) { $viewer = $this->getViewer($request); $uploadDir = Settings_ModuleManager_Module_Model::getUploadDirectory(); $qualifiedModuleName = $request->getModule(false); $uploadFile = 'usermodule_' . time() . '.zip'; $uploadFileName = "{$uploadDir}/{$uploadFile}"; $error = ''; checkFileAccess($uploadDir); if (!move_uploaded_file($_FILES['moduleZip']['tmp_name'], $uploadFileName)) { $error = 'LBL_ERROR_MOVE_UPLOADED_FILE'; } else { $package = new Vtiger_Package(); $importModuleName = $package->getModuleNameFromZip($uploadFileName); $importModuleDepVtVersion = $package->getDependentVtigerVersion(); if ($importModuleName == null) { $error = $package->_errorText; checkFileAccessForDeletion($uploadFileName); unlink($uploadFileName); } else { // We need these information to push for Update if module is detected to be present. $moduleLicence = vtlib_purify($package->getLicense()); $viewer->assign("MODULEIMPORT_FILE", $uploadFile); $viewer->assign("MODULEIMPORT_TYPE", $package->type()); $viewer->assign("MODULEIMPORT_NAME", $importModuleName); $viewer->assign("MODULEIMPORT_DEP_VTVERSION", $importModuleDepVtVersion); $viewer->assign("MODULEIMPORT_LICENSE", $moduleLicence); if (!$package->isLanguageType() && !$package->isUpdateType() && !$package->isModuleBundle()) { $moduleInstance = Vtiger_Module::getInstance($importModuleName); $moduleimport_exists = $moduleInstance ? "true" : "false"; $moduleimport_dir_name = "modules/{$importModuleName}"; $moduleimport_dir_exists = is_dir($moduleimport_dir_name) ? "true" : "false"; $viewer->assign("MODULEIMPORT_EXISTS", $moduleimport_exists); $viewer->assign("MODULEIMPORT_DIR", $moduleimport_dir_name); $viewer->assign("MODULEIMPORT_DIR_EXISTS", $moduleimport_dir_exists); } } } $viewer->assign('MODULEIMPORT_ERROR', $error); $viewer->view('ImportUserModuleStep2.tpl', $qualifiedModuleName); }