コード例 #1
0
     $zp = gzopen($languageFile, "r");
     $languageFile = tempnam(__FILE__, '');
     $handle = fopen($languageFile, "w");
     while (!gzeof($zp)) {
         $data = gzread($zp, 1024);
         fwrite($handle, $data);
     }
     gzclose($zp);
     fclose($handle);
 }
 $language = new Language();
 $configuration = new Configurations();
 $importResults = $language->import($languageFile);
 G::LoadClass("wsTools");
 $renegerateContent = new workspaceTools(SYS_SYS);
 $messs = $renegerateContent->upgradeContent();
 $result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\n";
 $result->msg .= G::LoadTranslation("ID_FILE_NUM_RECORD") . $importResults->recordsCount . "\n";
 $result->msg .= G::LoadTranslation("ID_SUCCESS_RECORD") . $importResults->recordsCountSuccess . "\n";
 $result->msg .= G::LoadTranslation("ID_FAILED_RECORD") . ($importResults->recordsCount - $importResults->recordsCountSuccess) . "\n";
 if ($importResults->errMsg != '') {
     $result->msg .= G::LoadTranslation("ID_ERROR_REGISTERED") . " \n" . $importResults->errMsg . "\n";
 }
 //$result->msg = htmlentities($result->msg);
 $result->success = true;
 //saving metadata
 $configuration->aConfig = array('headers' => $importResults->headers, 'language' => $importResults->lang, 'import-date' => date('Y-m-d H:i:s'), 'user' => '', 'version' => '1.0');
 $configuration->saveConfig('LANGUAGE_META', $importResults->lang);
 $dir = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP;
 if (!is_writable($dir)) {
     throw new Exception(G::LoadTranslation('ID_TRANSLATIONS_FOLDER_PERMISSIONS'));