File tree Expand file tree Collapse file tree 3 files changed +56
-5
lines changed
Expand file tree Collapse file tree 3 files changed +56
-5
lines changed Original file line number Diff line number Diff line change 123123 $ v_val = escapeshellarg ($ _POST ['v_val ' ]);
124124 $ v_priority = escapeshellarg ($ _POST ['v_priority ' ]);
125125 $ v_ttl = escapeshellarg ($ _POST ['v_ttl ' ]);
126-
127126 // Add dns record
128127 if (empty ($ _SESSION ['error_msg ' ])) {
129128 exec (HESTIA_CMD ."v-add-dns-record " .$ user ." " .$ v_domain ." " .$ v_rec ." " .$ v_type ." " .$ v_val ." " .$ v_priority ." '' false " .$ v_ttl , $ output , $ return_var );
130129 check_return_code ($ return_var ,$ output );
131- unset($ output );
132- $ v_type = $ _POST ['v_type ' ];
130+ unset($ output );
133131 }
134-
132+ $ v_type = $ _POST ['v_type ' ];
133+
135134 // Flush field values on success
136135 if (empty ($ _SESSION ['error_msg ' ])) {
137136 $ _SESSION ['ok_msg ' ] = __ ('DNS_RECORD_CREATED_OK ' ,htmlentities ($ _POST ['v_rec ' ]),htmlentities ($ _POST ['v_domain ' ]));
179178 render_page ($ user , $ TAB , 'add_dns ' );
180179} else {
181180 // Display body for dns record
182-
183181 $ v_domain = $ _GET ['domain ' ];
184182 render_page ($ user , $ TAB , 'add_dns_rec ' );
185183}
Original file line number Diff line number Diff line change 1+ //
2+ //
3+ // Updates database dns record dynamically, showing its full domain path
4+ App . Actions . DB . update_dns_record_hint = function ( elm , hint ) {
5+ // clean hint
6+ if ( hint . trim ( ) == '' ) {
7+ $ ( elm ) . parent ( ) . find ( '.hint' ) . html ( '' ) ;
8+ }
9+
10+ // set domain name without rec in case of @ entries
11+ if ( hint == '@' ) {
12+ hint = '' ;
13+ }
14+
15+ // dont show pregix if domain name = rec value
16+ if ( hint == GLOBAL . DNS_REC_PREFIX + '.' ) {
17+ hint = '' ;
18+ }
19+
20+ // add dot at the end if needed
21+ if ( hint != '' && hint . slice ( - 1 ) != '.' ) {
22+ hint += '.' ;
23+ }
24+
25+ $ ( elm ) . parent ( ) . find ( '.hint' ) . text ( hint + GLOBAL . DNS_REC_PREFIX ) ;
26+ }
27+
28+ //
29+ // listener that triggers dns record name hint updating
30+ App . Listeners . DB . keypress_dns_rec_entry = function ( ) {
31+ var ref = $ ( 'input[name="v_rec"]' ) ;
32+ var current_rec = ref . val ( ) ;
33+ if ( current_rec . trim ( ) != '' ) {
34+ App . Actions . DB . update_dns_record_hint ( ref , current_rec ) ;
35+ }
36+
37+ ref . bind ( 'keypress input' , function ( evt ) {
38+ clearTimeout ( window . frp_usr_tmt ) ;
39+ window . frp_usr_tmt = setTimeout ( function ( ) {
40+ var elm = $ ( evt . target ) ;
41+ App . Actions . DB . update_dns_record_hint ( elm , $ ( elm ) . val ( ) ) ;
42+ } , 100 ) ;
43+ } ) ;
44+ }
45+
46+ //
47+ // Page entry point
48+ // Trigger listeners
49+ App . Listeners . DB . keypress_dns_rec_entry ( ) ;
Original file line number Diff line number Diff line change 7373 < td >
7474 < input type ="text " size ="20 " class ="vst-input " name ="v_rec " value ="<?=htmlentities(trim($v_rec, "'"))?> ">
7575 < input type ="hidden " name ="v_record_id " value ="<?=htmlentities($v_record_id)?> ">
76+ < small class ="hint "> </ small >
7677 </ td >
7778 </ tr >
7879 < tr >
156157 </ table >
157158 </ form >
158159 </ div >
160+ < script >
161+ GLOBAL . DNS_REC_PREFIX = < ?= json_encode ( $_GET [ 'domain' ] ) ?> ;
162+ </ script >
You can’t perform that action at this time.
0 commit comments