From 39dca52a35918596c3ac1bbdf7b2a2dace96f8ae Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sun, 1 Aug 2021 20:06:48 +0800 Subject: [PATCH] feat: add kms host in ospp command --- backend/kms-office.php | 49 ++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/backend/kms-office.php b/backend/kms-office.php index 9b02ff5..63fd437 100644 --- a/backend/kms-office.php +++ b/backend/kms-office.php @@ -16,33 +16,38 @@ $office['2019'] = 'if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16" cscript ospp.vbs /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP'; -$osppOption[] = '/dstatus'; -$osppDescription[] = 'Displays license information for installed product keys.'; -$osppDescriptionCn[] = '显示当前已安装产品密钥的许可证信息'; +function loadOsppInfo() { // 初始化ospp信息 + global $webSite; + global $osppOption, $osppDescription, $osppDescriptionCn; -$osppOption[] = '/dstatusall'; -$osppDescription[] = 'Displays license information for all installed licenses.'; -$osppDescriptionCn[] = '显示当前已安装的所有许可证信息'; + $osppOption[] = '/dstatus'; + $osppDescription[] = 'Displays license information for installed product keys.'; + $osppDescriptionCn[] = '显示当前已安装产品密钥的许可证信息'; -$osppOption[] = '/unpkey:XXXXX'; -$osppDescription[] = 'Uninstalls an product key with the last five digits of it.'; -$osppDescriptionCn[] = '卸载已安装的产品密钥(最后5位)'; + $osppOption[] = '/dstatusall'; + $osppDescription[] = 'Displays license information for all installed licenses.'; + $osppDescriptionCn[] = '显示当前已安装的所有许可证信息'; -$osppOption[] = '/inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'; -$osppDescription[] = 'Installs a product key with a user-provided product key.'; -$osppDescriptionCn[] = '安装产品密钥'; + $osppOption[] = '/unpkey:XXXXX'; + $osppDescription[] = 'Uninstalls an product key with the last five digits of it.'; + $osppDescriptionCn[] = '卸载已安装的产品密钥(最后5位)'; -$osppOption[] = '/sethst:kms.xxx.xx'; -$osppDescription[] = 'Sets a KMS host name with a user-provided host name.'; -$osppDescriptionCn[] = '设置 KMS 主机名'; + $osppOption[] = '/inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'; + $osppDescription[] = 'Installs a product key with a user-provided product key.'; + $osppDescriptionCn[] = '安装产品密钥'; -$osppOption[] = '/remhst'; -$osppDescription[] = 'Removes KMS host name and sets port to default.'; -$osppDescriptionCn[] = '删除 KMS 主机名'; + $osppOption[] = '/sethst:' . $webSite; + $osppDescription[] = 'Sets a KMS host name with a user-provided host name.'; + $osppDescriptionCn[] = '设置 KMS 主机名'; -$osppOption[] = '/act'; -$osppDescription[] = 'Activates installed Office product keys.'; -$osppDescriptionCn[] = '激活 Office'; + $osppOption[] = '/remhst'; + $osppDescription[] = 'Removes KMS host name and sets port to default.'; + $osppDescriptionCn[] = '删除 KMS 主机名'; + + $osppOption[] = '/act'; + $osppDescription[] = 'Activates installed Office product keys.'; + $osppDescriptionCn[] = '激活 Office'; +} function loadOfficeCmd() { // 初始化Office激活命令 global $webSite, $office; @@ -54,6 +59,7 @@ function loadOfficeCmd() { // 初始化Office激活命令 } function showOfficeHelp() { // 命令行输出Office激活帮助 + loadOsppInfo(); loadOfficeCmd(); global $office, $osppOption, $osppDescription, $osppDescriptionCn; foreach ($office as $index => $officeKmsCmd) { @@ -84,6 +90,7 @@ function showOfficeHelp() { // 命令行输出Office激活帮助 } function webOfficeHelp() { // 网页输出Office激活帮助 + loadOsppInfo(); loadOfficeCmd(); global $office, $osppOption, $osppDescription, $osppDescriptionCn; echo '';