Disallow changing the package update server URL
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 19 Aug 2020 12:44:11 +0000 (14:44 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 19 Aug 2020 13:07:49 +0000 (15:07 +0200)
wcfsetup/install/files/acp/templates/packageUpdateServerAdd.tpl
wcfsetup/install/files/lib/acp/form/PackageUpdateServerEditForm.class.php

index 0f05d9920221e6b454f207addfae423e85d7de14..e3fa4271451966d2a0ebe127cda10f6362af7cbd 100644 (file)
@@ -25,7 +25,7 @@
                <dl{if $errorField == 'serverURL'} class="formError"{/if}>
                        <dt><label for="serverURL">{lang}wcf.acp.updateServer.serverURL{/lang}</label></dt>
                        <dd>
-                               <input type="url" id="serverURL" name="serverURL" value="{$serverURL}" required autofocus class="long">
+                               <input type="url" id="serverURL" name="serverURL" value="{$serverURL}" required autofocus class="long"{if $action != 'add'} readonly{/if}>
                                {if $errorField == 'serverURL'}
                                        <small class="innerError">
                                                {if $errorType == 'empty'}
index 7c0d4d15ba0febe58edadd6c623bf0d12c4cd7a8..7da86b669bff8c52a6d5e2fd250a266e05636c6a 100755 (executable)
@@ -51,9 +51,7 @@ class PackageUpdateServerEditForm extends PackageUpdateServerAddForm {
        public function save() {
                AbstractForm::save();
                
-               $data = [
-                       'serverURL' => $this->serverURL,
-               ];
+               $data = [];
                if ($this->loginUsername != $this->updateServer->loginUsername || $this->loginPassword) {
                        $data['loginUsername'] = $this->loginUsername;
                        $data['loginPassword'] = $this->loginPassword;
@@ -74,8 +72,8 @@ class PackageUpdateServerEditForm extends PackageUpdateServerAddForm {
        public function readData() {
                parent::readData();
                
+               $this->serverURL = $this->updateServer->serverURL;
                if (empty($_POST)) {
-                       $this->serverURL = $this->updateServer->serverURL;
                        $this->loginUsername = $this->updateServer->loginUsername;
                }
        }