@@ -70,23 +70,15 @@ function onShowNew() {
7070 }
7171
7272 parent ::onShowNew ();
73+ }
7374
74- $ soa = $ app ->db ->queryOneRecord ("SELECT * FROM dns_soa WHERE id = ? AND " . $ app ->tform ->getAuthSQL ('r ' ), $ _GET ['zone ' ]);
75- $ sql =$ app ->db ->queryOneRecord ("SELECT domain, dkim_public, dkim_selector, dkim FROM mail_domain WHERE domain = ? AND " . $ app ->tform ->getAuthSQL ('r ' ), substr_replace ($ soa ['origin ' ],'' ,-1 ));
76- if (isset ($ sql ['domain ' ]) && $ sql ['domain ' ] != '' ) {
77- if ($ sql ['dkim ' ] == 'y ' ) {
78- $ public_key =str_replace (array ('-----BEGIN PUBLIC KEY----- ' ,'-----END PUBLIC KEY----- ' ,"\r" ,"\n" ),'' ,$ sql ['dkim_public ' ]);
79- $ app ->tpl ->setVar ('public_key ' , $ public_key , true );
80- $ app ->tpl ->setVar ('selector ' , $ sql ['dkim_selector ' ], true );
81- } else {
82- //TODO: show warning - use mail_domain for dkim and enabled dkim
83- }
84- $ app ->tpl ->setVar ('edit_disabled ' , 1 );
85- } else {
86- $ app ->tpl ->setVar ('edit_disabled ' , 0 );
87- }
88- $ app ->tpl ->setVar ('name ' , $ soa ['origin ' ], true );
75+ function onShowEnd () {
76+ global $ app , $ conf ;
77+
78+ $ app ->tpl ->setVar ("selector " , str_replace ('._domainkey ' , '' , $ this ->dataRecord ['name ' ]), true );
79+ $ app ->tpl ->setVar ("public_key " , str_replace ('v=DKIM1; t=s; p= ' , '' , $ this ->dataRecord ['data ' ]), true );
8980
81+ parent ::onShowEnd ();
9082 }
9183
9284 function onSubmit () {
@@ -117,7 +109,7 @@ function onSubmit() {
117109 // add dkim-settings to the public-key in the txt-record
118110 if (!empty ($ this ->dataRecord ['data ' ])) {
119111 $ this ->dataRecord ['data ' ]='v=DKIM1; t=s; p= ' .$ this ->dataRecord ['data ' ];
120- $ this ->dataRecord ['name ' ]=$ this ->dataRecord ['selector ' ].'._domainkey. ' . $ this -> dataRecord [ ' name ' ] ;
112+ $ this ->dataRecord ['name ' ]=$ this ->dataRecord ['selector ' ].'._domainkey ' ;
121113// $this->dataRecord['ttl']=60;
122114 }
123115 // Update the serial number and timestamp of the RR record
0 commit comments