1 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/dirs.txt smeserver-ddclient-1.2.1/root/etc/e-smith/web/dirs.txt |
2 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/dirs.txt 2020-06-11 09:31:35.755359875 +0100 |
3 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/dirs.txt 1970-01-01 01:00:00.000000000 +0100 |
4 |
@@ -1,4 +0,0 @@ |
5 |
-mkdir -p ./manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller |
6 |
-mkdir -p ./manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient |
7 |
-mkdir -p ./manager2/cgi-bin/srvmngr/themes/default/templates |
8 |
-mkdir -p ./manager2/cgi-bin/srvmngr/themes/default/templates/partials |
9 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Ddclient.pm smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Ddclient.pm |
10 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Ddclient.pm 2020-06-11 09:31:35.756359885 +0100 |
11 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Ddclient.pm 1970-01-01 01:00:00.000000000 +0100 |
12 |
@@ -1,772 +0,0 @@ |
13 |
-package SrvMngr::Controller::Ddclient; |
14 |
- |
15 |
-#---------------------------------------------------------------------- |
16 |
-# heading : Configuration |
17 |
-# description : Dynamic Clients |
18 |
-# navigation : 3000 3400 |
19 |
-# |
20 |
-# name : ddclient, method : get, url : /ddclient, ctlact : Ddclient#main |
21 |
-# name : ddclient3, method : post, url : /ddclient3, ctlact : Ddclient#do_updateparams |
22 |
-# name : ddclient1, method : get, url : /ddclient1, ctlact : Ddclient#do_summary_domain |
23 |
-# name : ddclient2, method : get, url : /ddclient2, ctlact : Ddclient#do_summary_custom |
24 |
-# name : ddclient4, method : post, url : /ddclient4, ctlact : Ddclient#do_delete_domain |
25 |
-# name : ddclient5, method : get, url : /ddclient5, ctlact : Ddclient#do_update_domain |
26 |
-# name : ddclient6, method : get, url : /ddclient6, ctlact : Ddclient#do_create_custom |
27 |
-# name : ddclient7, method : post, url : /ddclient7, ctlact : Ddclient#do_create_custom_actual |
28 |
-# name : ddclient8, method : post, url : /ddclient8, ctlact : Ddclient#do_update_domain |
29 |
-# |
30 |
-# routes : end |
31 |
-#---------------------------------------------------------------------- |
32 |
- |
33 |
-use strict; |
34 |
-use warnings; |
35 |
-use Mojo::Base 'Mojolicious::Controller'; |
36 |
- |
37 |
-use constant FALSE => 0; |
38 |
-use constant TRUE => 1; |
39 |
- |
40 |
-use Locale::gettext; |
41 |
-use SrvMngr::I18N; |
42 |
-use SrvMngr qw(theme_list init_session_cgi); |
43 |
- |
44 |
-use Data::Dumper; |
45 |
-use esmith::util; |
46 |
-use esmith::HostsDB; |
47 |
-use esmith::AccountsDB; |
48 |
- |
49 |
-our $db = esmith::ConfigDB->open(); |
50 |
-our $adb = esmith::AccountsDB->open(); |
51 |
- |
52 |
-our $domaindb = esmith::ConfigDB->open('/home/e-smith/db/domains') |
53 |
- or die "Unable to open domains db"; |
54 |
-our $edb; |
55 |
-$edb = esmith::ConfigDB->open('/home/e-smith/db/ddclient') |
56 |
- or $edb = esmith::ConfigDB->create('/home/e-smith/db/ddclient'); |
57 |
- |
58 |
-my %ddc_datas = (); |
59 |
- |
60 |
-sub get_dns_labels { |
61 |
- # |
62 |
- # dns service names |
63 |
- # |
64 |
- my $c = shift; |
65 |
- my $Labels = ( |
66 |
- [ |
67 |
- [ $c->l('ddc_CUSTOMDNS'), 'CUSTOMDNS' ], |
68 |
- [ $c->l('ddc_DYNDNS1'), 'DYNDNS1' ], |
69 |
- [ $c->l('ddc_DYNDNS2'), 'DYNDNS2' ], |
70 |
- [ $c->l('ddc_DYNDNS3'), 'DYNDNS3' ], |
71 |
- [ $c->l('ddc_ZONEDIT'), 'ZONEDIT' ], |
72 |
- [ $c->l('ddc_EASYDNS'), 'EASYDNS' ], |
73 |
- [ $c->l('ddc_HAMMER'), 'HAMMER' ], |
74 |
- [ $c->l('ddc_DSLREPORTS'), 'DSLREPORTS' ], |
75 |
- [ $c->l('ddc_EURODYNDNS'), 'EURODYNDNS' ], |
76 |
- [ $c->l('ddc_DTDNS'), 'DTDNS' ], |
77 |
- [ $c->l('ddc_LOOPIA'), 'LOOPIA' ], |
78 |
- [ $c->l('ddc_DNSPARK'), 'DNSPARK' ], |
79 |
- [ $c->l('ddc_DYNHOST'), 'DYNHOST' ], |
80 |
- [ $c->l('ddc_NOIP'), 'NOIP' ], |
81 |
- [ $c->l('ddc_CHANGEIP'), 'CHANGEIP' ], |
82 |
- [ $c->l('ddc_NAMECHEAP'), 'NAMECHEAP' ], |
83 |
- [ $c->l('ddc_SPDNS'), 'SPDNS' ] |
84 |
- ] |
85 |
- ); |
86 |
- return $Labels; |
87 |
-} |
88 |
- |
89 |
-sub main { |
90 |
- # |
91 |
- # Initial page - full summary of parameters etc |
92 |
- # Initial para from the Wiki. |
93 |
- # |
94 |
- my $c = shift; |
95 |
- $ddc_datas{"first"} = 'ddc_DESCRIPTION'; |
96 |
- do_display( $c, %ddc_datas ); |
97 |
-} |
98 |
- |
99 |
-sub do_display { |
100 |
- # |
101 |
- # Front Summary page |
102 |
- # |
103 |
- my $c = shift; |
104 |
- $c->app->log->info( $c->log_req ); |
105 |
- |
106 |
- my $title = $c->l('ddc_FORM_TITLE'); |
107 |
- my $modul = ''; |
108 |
- $ddc_datas{trt} = 'LIST'; |
109 |
- my $trt = "LIST"; |
110 |
- |
111 |
- $ddc_datas{"params"} = get_params($c); |
112 |
- my @domains = get_domain_table($c); |
113 |
- my @FreeDomains = get_custom_table($c); |
114 |
- |
115 |
- my $emptydom = ( scalar @domains == 0 ); |
116 |
- my $emptycust = ( scalar @FreeDomains == 0 ); |
117 |
- |
118 |
- my $Labels = ( |
119 |
- [ |
120 |
- [ $c->l('ddc_SME external Interface'), "smeIF" ], |
121 |
- [ $c->l('ddc_SME configuration DB'), "smeCMD" ], |
122 |
- [ $c->l('ddc_web'), "web" ], |
123 |
- [ $c->l('ddc_Interface'), "if" ], |
124 |
- [ $c->l('ddc_IP'), "ip" ], |
125 |
- [ $c->l('ddc_Command'), "cmd" ] |
126 |
- ] |
127 |
- ); |
128 |
- |
129 |
- $c->stash( |
130 |
- title => $title, |
131 |
- modul => $modul, |
132 |
- ddc_datas => \%ddc_datas, |
133 |
- domains => \@domains, |
134 |
- freedomains => \@FreeDomains, |
135 |
- methodlabels => $Labels, |
136 |
- emptydom => $emptydom, |
137 |
- emptycust => $emptycust |
138 |
- ); |
139 |
- $ddc_datas{'trt'} = $trt; |
140 |
- $c->stash( title => $title, modul => $modul, ddc_datas => \%ddc_datas ); |
141 |
- $c->render( template => 'ddclient' ); |
142 |
- |
143 |
-} |
144 |
- |
145 |
-sub do_updateparams { |
146 |
- # |
147 |
- # Called to update the parameters relating to the Ip address of the server |
148 |
- # |
149 |
- my $c = shift; |
150 |
- $ddc_datas{"success"} = pushParams($c); |
151 |
- do_display($c); |
152 |
-} |
153 |
- |
154 |
-sub do_update_domain { |
155 |
- # |
156 |
- #Called to update/delete the ddclient for a specific inbuilt domain |
157 |
- # |
158 |
- my $c = shift; |
159 |
- my $retmsg; |
160 |
- if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field |
161 |
- $retmsg = performModifyCustom($c); |
162 |
- } |
163 |
- else { |
164 |
- $retmsg = performModifyDomain($c); |
165 |
- } |
166 |
- if ( $retmsg eq "ok" ) { |
167 |
- my $dns = $c->param('dns'); |
168 |
- my $domain = $c->param('domainname'); |
169 |
- $ddc_datas{"success"} = |
170 |
- $c->l( "ddc_SUCCESSFULLY_MODIFIED", $domain, $c->l( 'ddc_' . $dns ) ); |
171 |
- do_display( $c, %ddc_datas ); |
172 |
- } |
173 |
- else { |
174 |
- $ddc_datas{"error"} = $retmsg; |
175 |
- |
176 |
- #Back to input panel to correct error |
177 |
- do_summary_domain($c); |
178 |
- } |
179 |
-} |
180 |
- |
181 |
-sub do_create_custom { |
182 |
- # |
183 |
- # Create custom domain |
184 |
- # |
185 |
- my $c = shift; |
186 |
- my $title = $c->l("ddc_CREATE_TITLE"); |
187 |
- my $modul = ''; |
188 |
- my $trt = "NEW"; |
189 |
- |
190 |
- $ddc_datas{trt} = $trt; |
191 |
- $c->stash( |
192 |
- title => $title, |
193 |
- modul => $modul, |
194 |
- ddc_datas => \%ddc_datas, |
195 |
- dnslabels => get_dns_labels($c) |
196 |
- ); |
197 |
- $c->render( template => 'ddclient' ); |
198 |
-} |
199 |
- |
200 |
-sub do_create_custom_actual { |
201 |
- my $c = shift; |
202 |
- my $retmsg = performCreateCustom($c); |
203 |
- if ( $retmsg eq "ok" ) { |
204 |
- my $dns = $c->param('dns'); |
205 |
- my $domain = $c->param('domainname'); |
206 |
- $ddc_datas{"success"} = |
207 |
- $c->l( "ddc_SUCCESSFULLY_DELETED", $domain, $c->l( 'ddc_' . $dns ) ); |
208 |
- do_display( $c, %ddc_datas ); |
209 |
- } |
210 |
- else { |
211 |
- $ddc_datas{"error"} = $retmsg; |
212 |
- #Back to input panel to correct error |
213 |
- do_createcustom($c); |
214 |
- } |
215 |
- |
216 |
-} |
217 |
- |
218 |
-sub do_summary_custom { |
219 |
- # |
220 |
- # Display delete or modify panel for custom domain |
221 |
- # |
222 |
- my $c = shift; |
223 |
- my $title = $c->l("ddc_MODIFY_TITLE"); |
224 |
- my $modul = ''; |
225 |
- my $trt = $c->param("trt"); |
226 |
- |
227 |
- #Extract domain stuff from DB |
228 |
- my @results = |
229 |
- get_custom_table( $c, $c->param("Domain") ); #Returns just one row |
230 |
- |
231 |
- $ddc_datas{"Domain_details"} = $results[0]; |
232 |
- |
233 |
- $ddc_datas{'trt'} = $trt; |
234 |
- $c->stash( |
235 |
- title => $title, |
236 |
- modul => $modul, |
237 |
- ddc_datas => \%ddc_datas, |
238 |
- dnslabels => get_dns_labels($c) |
239 |
- ); |
240 |
- $c->render( template => 'ddclient' ); |
241 |
-} |
242 |
- |
243 |
-sub do_summary_domain { |
244 |
- # |
245 |
- # Display delete or modify panel for inbuilt domain |
246 |
- # param trt = MOD or DEL |
247 |
- # |
248 |
- my $c = shift; |
249 |
- my $title = $c->l("ddc_MODIFY_TITLE"); |
250 |
- my $modul = ''; |
251 |
- my $trt = $c->param("trt"); |
252 |
- |
253 |
- #Extract domain stuff from DB |
254 |
- my @results = |
255 |
- get_domain_table( $c, $c->param("Domain") ); #Returns just one row |
256 |
- $ddc_datas{"Domain_details"} = $results[0]; |
257 |
- |
258 |
- $ddc_datas{'trt'} = $trt; |
259 |
- $c->stash( |
260 |
- title => $title, |
261 |
- modul => $modul, |
262 |
- ddc_datas => \%ddc_datas, |
263 |
- dnslabels => get_dns_labels($c) |
264 |
- ); |
265 |
- $c->render( template => 'ddclient' ); |
266 |
-} |
267 |
- |
268 |
-sub do_delete_domain { |
269 |
- # |
270 |
- # Actually clearout the inbuilt domain |
271 |
- # Return to initial page with message at the top. |
272 |
- # |
273 |
- my $c = shift; |
274 |
- my $route = $c->current_route; |
275 |
- my $title = $c->l("ddc_REMOVE_TITLE"); |
276 |
- my $modul = ''; |
277 |
- my $retmsg = ""; |
278 |
- my $domain = $c->param("Domain"); |
279 |
- |
280 |
- #Delete it and return to front summary panel - depends on route domain or custom |
281 |
- if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field |
282 |
- $retmsg = performDeleteCustom( $c, $domain ); |
283 |
- } |
284 |
- else { |
285 |
- $retmsg = performDeleteDomain( $c, $domain ); |
286 |
- } |
287 |
- |
288 |
- if ( $retmsg eq "ok" ) { |
289 |
- $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain, |
290 |
- $c->l( 'ddc_' . $c->param("dns") ) ); |
291 |
- } |
292 |
- else { $ddc_datas{"error"} = $retmsg; } |
293 |
- do_display( $c, %ddc_datas ); |
294 |
- |
295 |
-} |
296 |
- |
297 |
-sub do_delete_custom { |
298 |
- # |
299 |
- # Actually delete the custom domain |
300 |
- # Return to initial page with message at the top. |
301 |
- # |
302 |
- my $c = shift; |
303 |
- my $route = $c->current_route; |
304 |
- my $title = $c->l("ddc_REMOVE_TITLE"); |
305 |
- my $modul = ''; |
306 |
- my $retmsg = ""; |
307 |
- my $domain = $c->param("Domain"); |
308 |
- |
309 |
- #Delete it and return to front summary panel - depends on route domain or custom |
310 |
- $retmsg = performDeleteCustom( $c, $domain ); |
311 |
- if ( $retmsg eq "ok" ) { |
312 |
- $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain ); |
313 |
- } |
314 |
- else { $ddc_datas{"error"} = $retmsg; } |
315 |
- do_display( $c, %ddc_datas ); |
316 |
- |
317 |
-} |
318 |
- |
319 |
-sub performDeleteDomain { |
320 |
- my ( $c, $domain ) = @_; |
321 |
- |
322 |
- #------------------------------------------------------------ |
323 |
- # Attempt to delete domain |
324 |
- #------------------------------------------------------------ |
325 |
- |
326 |
- if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
327 |
- $domain = $1; |
328 |
- } |
329 |
- else { |
330 |
- return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain ); |
331 |
- } |
332 |
- |
333 |
- my $value = $domaindb->get($domain); |
334 |
- unless ($value) { |
335 |
- return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain ); |
336 |
- } |
337 |
- |
338 |
- my %properties = $value->props; |
339 |
- my $type = $properties{'type'}; |
340 |
- if ( $type ne 'domain' ) { |
341 |
- return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain ); |
342 |
- } |
343 |
- |
344 |
- my $evalue = $domaindb->get($domain); |
345 |
- |
346 |
- $evalue->set_prop( 'dns' => '' ); |
347 |
- $evalue->set_prop( 'login' => '' ); |
348 |
- $evalue->set_prop( 'password' => '' ); |
349 |
- $evalue->set_prop( 'customdns' => '' ); |
350 |
- $evalue->set_prop( 'customprotocol' => '' ); |
351 |
- |
352 |
- $domaindb->reload(); |
353 |
- |
354 |
- system( "/sbin/e-smith/signal-event", "ddclient" ); |
355 |
- |
356 |
- return "ok"; |
357 |
-} |
358 |
- |
359 |
-sub performDeleteCustom { |
360 |
- my ( $c, $domain ) = @_; |
361 |
- |
362 |
- #------------------------------------------------------------ |
363 |
- # Attempt to delete domain |
364 |
- #------------------------------------------------------------ |
365 |
- |
366 |
- if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
367 |
- $domain = $1; |
368 |
- } |
369 |
- else { |
370 |
- return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain ); |
371 |
- } |
372 |
- |
373 |
- my $evalue = $edb->get($domain); |
374 |
- unless ($evalue) { |
375 |
- return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain ); |
376 |
- } |
377 |
- |
378 |
- my %properties = $evalue->props; |
379 |
- my $type = $properties{'type'}; |
380 |
- |
381 |
- if ( $type ne 'ddhost' ) { |
382 |
- return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain ); |
383 |
- |
384 |
- } |
385 |
- |
386 |
- $evalue->delete; |
387 |
- $edb->reload(); |
388 |
- |
389 |
- system( "/sbin/e-smith/signal-event", "ddclient" ); |
390 |
- return "ok"; |
391 |
-} |
392 |
- |
393 |
-sub get_domain_table { |
394 |
- # |
395 |
- # Return full table of all domains OR just the details for the specified one |
396 |
- # |
397 |
- my ( $c, $findDomain ) = @_; #$c and domain to find |
398 |
- $findDomain = FALSE if ( scalar(@_) <= 1 ); |
399 |
- my $key; |
400 |
- my @virtualDomains = (); |
401 |
- foreach my $domain ( $domaindb->get_all_by_prop( type => 'domain' ) ) { |
402 |
- $key = $domain->key; |
403 |
- push( @virtualDomains, $key ); |
404 |
- } |
405 |
- my $numDomains = @virtualDomains; |
406 |
- if ( $numDomains == 0 ) { return () } |
407 |
- else { |
408 |
- my $domain; |
409 |
- my @virtualDomains2d = (); |
410 |
- |
411 |
- foreach $domain ( sort @virtualDomains ) { |
412 |
- my %properties = $domaindb->get($domain)->props; |
413 |
- my $test = $domaindb->get_prop( $domain, "dns" ) || ''; |
414 |
- my %extraprops; |
415 |
- if ( $test ne '' ) { %extraprops = $domaindb->get($domain)->props; } |
416 |
- |
417 |
- my $content; |
418 |
- if ( $properties{'Content'} eq 'wwwpublic' ) { |
419 |
- $content = $c->l('ddc_PRIMARY_SITE'); |
420 |
- } |
421 |
- else { $content = $c->l( 'ddc_CONTENT', $properties{'Content'} ); } |
422 |
- |
423 |
- my $public; |
424 |
- my %thisrow; |
425 |
- if ( $test eq '' ) { |
426 |
- %thisrow = ( |
427 |
- "Domain" => $domain, |
428 |
- "Description" => $properties{'Description'}, |
429 |
- "Content" => $content, |
430 |
- "dns" => "", |
431 |
- "Publication" => "", |
432 |
- "customprotocol" => "", |
433 |
- "customdns" => "", |
434 |
- "login" => "", |
435 |
- "password" => "", |
436 |
- "mx" => "" |
437 |
- ); |
438 |
- push( @virtualDomains2d, \%thisrow ); |
439 |
- } |
440 |
- else { |
441 |
- %thisrow = ( |
442 |
- "Domain" => $domain, |
443 |
- "Description" => $properties{'Description'}, |
444 |
- "Content" => $content, |
445 |
- "dns" => $extraprops{'dns'}, |
446 |
- "Publication" => $c->l( 'ddc_' . $extraprops{'dns'} ), |
447 |
- "customprotocol" => $properties{"customprotocol"}, |
448 |
- "customdns" => $properties{"customdns"}, |
449 |
- "login" => $properties{"login"}, |
450 |
- "password" => $properties{"password"}, |
451 |
- "mx" => $properties{"mx"}, |
452 |
- ); |
453 |
- push( @virtualDomains2d, \%thisrow ); |
454 |
- |
455 |
- } |
456 |
- if ($findDomain) { |
457 |
- if ( $domain eq $findDomain ) { |
458 |
- @virtualDomains2d = (); #Just return matching one |
459 |
- push( @virtualDomains2d, \%thisrow ); |
460 |
- last; |
461 |
- } |
462 |
- } #Found the one needed |
463 |
- } |
464 |
- return @virtualDomains2d; #Return the lot |
465 |
- } |
466 |
-} |
467 |
- |
468 |
-sub get_custom_table { |
469 |
- # |
470 |
- # Return full table of all domains OR just the details for the specified one |
471 |
- # |
472 |
- my ( $c, $findDomain ) = @_; #$c and domain to find |
473 |
- $findDomain = FALSE if ( scalar(@_) <= 1 ); |
474 |
- my $key; |
475 |
- my @FreeDomains = (); |
476 |
- foreach my $domain ( $edb->get_all_by_prop( type => 'ddhost' ) ) { |
477 |
- $key = $domain->key; |
478 |
- push( @FreeDomains, $key ); |
479 |
- } |
480 |
- my $numDomains = @FreeDomains; |
481 |
- my @freedomains2d = (); |
482 |
- if ( $numDomains > 0 ) { |
483 |
- foreach my $domain ( sort @FreeDomains ) { |
484 |
- my $vals = $edb->get($domain); |
485 |
- my $content = $vals->prop('desc'); |
486 |
- my $publish = $vals->prop('dns'); |
487 |
- my %thisrow = ( |
488 |
- 'Domain' => $domain, |
489 |
- "Description" => $content, |
490 |
- "dns" => $publish, |
491 |
- "Publication" => |
492 |
- $c->l( 'ddc_' . $publish ), #msg ddc prefix for ddclient |
493 |
- "customprotocol" => $vals->prop("customprotocol"), |
494 |
- "customdns" => $vals->prop("customdns"), |
495 |
- "login" => $vals->prop("login"), |
496 |
- "password" => $vals->prop("password"), |
497 |
- "mx" => $vals->prop("mx"), |
498 |
- |
499 |
- ); |
500 |
- |
501 |
- push( @freedomains2d, \%thisrow ); |
502 |
- if ($findDomain) { |
503 |
- if ( $domain eq $findDomain ) { |
504 |
- @freedomains2d = (); #Just return matching one |
505 |
- push( @freedomains2d, \%thisrow ); |
506 |
- last; |
507 |
- } |
508 |
- } #Found the one needed |
509 |
- |
510 |
- } |
511 |
- } |
512 |
- return @freedomains2d; |
513 |
-} |
514 |
- |
515 |
-sub get_params { |
516 |
- my $c = shift; |
517 |
- my $ddretrieve = $db->get('ddclient'); |
518 |
- my $ExtIF = $db->get('ExternalInterface'); |
519 |
- my $DeamonUpdate = $ddretrieve->prop('DeamonUpdate') || '300'; |
520 |
- my $urlcheckip = $ddretrieve->prop('urlcheckip') || 'checkip.dyndns.org'; |
521 |
- my $ssl = $ddretrieve->prop('SSL') || 'yes'; |
522 |
- my $method = $ddretrieve->prop('method') || 'web'; |
523 |
- my $Extinterface = $ddretrieve->prop('Extinterface') || ''; |
524 |
- my $cmd = $ddretrieve->prop('cmd') || ''; |
525 |
- my $forceIP = $ddretrieve->prop('ForceIP') || ''; |
526 |
- my $res = { |
527 |
- "ssl" => $ssl, |
528 |
- "DeamonUpdate" => $DeamonUpdate, |
529 |
- "method" => $method, |
530 |
- "Extinterface" => $Extinterface, |
531 |
- "cmd" => $cmd, |
532 |
- "ForceIP" => $forceIP, |
533 |
- "urlcheckip" => $urlcheckip |
534 |
- }; |
535 |
- return $res; |
536 |
-} |
537 |
- |
538 |
-sub pushParams { |
539 |
- my $c = shift; |
540 |
- my $DeamonUpdate = $c->param('retrievedeamonupdate'); |
541 |
- my $urlcheckip = $c->param('retrieveurlcheckip'); |
542 |
- my $ssl = $c->param('retrievessl'); |
543 |
- my $retrievemethod = $c->param('retrievemethod'); |
544 |
- my $retrieveinterface = $c->param('retrieveinterface'); |
545 |
- my $retrievecmd = $c->param('retrievecmd'); |
546 |
- my $retrieveip = $c->param('retrieveip'); |
547 |
- |
548 |
- my $ddclient = $db->get('ddclient'); |
549 |
- $ddclient->set_prop( 'urlcheckip' => $urlcheckip ); |
550 |
- $ddclient->set_prop( 'DeamonUpdate' => $DeamonUpdate ); |
551 |
- $ddclient->set_prop( 'SSL' => $ssl ); |
552 |
- $ddclient->set_prop( 'method' => $retrievemethod ); |
553 |
- $ddclient->set_prop( 'Extinterface' => $retrieveinterface ); |
554 |
- $ddclient->set_prop( 'cmd' => $retrievecmd ); |
555 |
- $ddclient->set_prop( 'ForceIP' => $retrieveip ); |
556 |
- |
557 |
- $domaindb->reload(); |
558 |
- |
559 |
- system( "/sbin/e-smith/signal-event", "ddclient" ); |
560 |
- |
561 |
- return $c->l('ddc_SUCCESSFULLY_MODIFIED_RETRIEVE_IP'); |
562 |
-} |
563 |
- |
564 |
-sub performCreateCustom { |
565 |
- my ($c) = shift; |
566 |
- |
567 |
- #------------------------------------------------------------ |
568 |
- # Validate parameters and untaint them |
569 |
- #------------------------------------------------------------ |
570 |
- |
571 |
- my $domainName = $c->param('domainName'); |
572 |
- if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
573 |
- $domainName = $1; |
574 |
- } |
575 |
- else { |
576 |
- return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName ); |
577 |
- } |
578 |
- |
579 |
- foreach my $domain ( $edb->get_all_by_prop( type => 'domain' ) ) { |
580 |
- my $key = $domain->key; |
581 |
- if ( $key eq $domainName ) { |
582 |
- return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName ); |
583 |
- } |
584 |
- } |
585 |
- |
586 |
- foreach my $domain ( $domaindb->get_all_by_prop( type => 'ddhost' ) ) { |
587 |
- my $key = $domain->key; |
588 |
- if ( $key eq $domainName ) { |
589 |
- return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName ); |
590 |
- } |
591 |
- } |
592 |
- |
593 |
- my $domainDesc = $c->param('desc'); |
594 |
- my $domainLogin = $c->param('login'); |
595 |
- if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { |
596 |
- $domainLogin = $1; |
597 |
- } |
598 |
- else { |
599 |
- return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin ); |
600 |
- } |
601 |
- |
602 |
- my $domainPassword = $c->param('password'); |
603 |
- if ( $domainPassword =~ /^(.*)$/ ) { |
604 |
- $domainPassword = $1; |
605 |
- } |
606 |
- else { |
607 |
- return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword ); |
608 |
- } |
609 |
- |
610 |
- my $domainMX = $c->param('mx'); |
611 |
- my $customDNS = $c->param('customdns'); |
612 |
- my $customPROTOCOL = $c->param('customprotocol'); |
613 |
- |
614 |
- my $dns = $c->param('dns'); |
615 |
- if ( $dns eq 'CUSTOMDNS' ) { |
616 |
- if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
617 |
- $customDNS = $1; |
618 |
- } |
619 |
- else { |
620 |
- return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName ); |
621 |
- } |
622 |
- } |
623 |
- |
624 |
- #------------------------------------------------------------ |
625 |
- # Looks good. Find out if this domain has been taken |
626 |
- # or if the domain is a reserved to provide a secured webserver |
627 |
- # for a previous domain |
628 |
- #------------------------------------------------------------ |
629 |
- |
630 |
- my %properties = (); |
631 |
- $properties{'type'} = 'ddhost'; |
632 |
- $properties{'dns'} = $dns; |
633 |
- $properties{'login'} = $domainLogin; |
634 |
- $properties{'password'} = $domainPassword; |
635 |
- $properties{'mx'} = $domainMX; |
636 |
- $properties{'desc'} = $domainDesc; |
637 |
- $properties{'customdns'} = $customDNS; |
638 |
- $properties{'customprotocol'} = $customPROTOCOL; |
639 |
- $edb->new_record( $domainName, \%properties ); |
640 |
- |
641 |
- system( "/sbin/e-smith/signal-event", "ddclient" ); |
642 |
- return "ok"; |
643 |
- |
644 |
-} |
645 |
- |
646 |
-sub performModifyDomain { |
647 |
- my $c = shift; |
648 |
- |
649 |
- #------------------------------------------------------------ |
650 |
- # Validate parameters and untaint them |
651 |
- #------------------------------------------------------------ |
652 |
- |
653 |
- my $domainName = $c->param('domainName'); |
654 |
- if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
655 |
- $domainName = $1; |
656 |
- } |
657 |
- else { |
658 |
- return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName ); |
659 |
- } |
660 |
- |
661 |
- my $domainLogin = $c->param('login'); |
662 |
- if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { |
663 |
- $domainLogin = $1; |
664 |
- } |
665 |
- else { |
666 |
- return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin ); |
667 |
- } |
668 |
- |
669 |
- my $domainPassword = $c->param('password'); |
670 |
- if ( $domainPassword =~ /^(.*)$/ ) { |
671 |
- $domainPassword = $1; |
672 |
- } |
673 |
- else { |
674 |
- return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword ); |
675 |
- } |
676 |
- |
677 |
- my $domainMX = $c->param('mx'); |
678 |
- my $customDNS = $c->param('customdns'); |
679 |
- my $customPROTOCOL = $c->param('customprotocol'); |
680 |
- |
681 |
- my $dns = $c->param('dns'); |
682 |
- if ( $dns eq 'CUSTOMDNS' ) { |
683 |
- if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
684 |
- $customDNS = $1; |
685 |
- } |
686 |
- else |
687 |
- |
688 |
- { |
689 |
- return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName ); |
690 |
- } |
691 |
- } |
692 |
- |
693 |
- #------------------------------------------------------------ |
694 |
- # Looks good. Find out if this domain has been taken |
695 |
- # or if the domain is a reserved to provide a secured webserver |
696 |
- # for a previous domain |
697 |
- #------------------------------------------------------------ |
698 |
- # my $dns = $c->param ('dns'); |
699 |
- |
700 |
- my $dom = $domaindb->get($domainName); |
701 |
- |
702 |
- $dom->set_prop( 'dns' => $dns ); |
703 |
- $dom->set_prop( 'login' => $domainLogin ); |
704 |
- $dom->set_prop( 'password' => $domainPassword ); |
705 |
- $dom->set_prop( 'mx' => $domainMX ); |
706 |
- $dom->set_prop( 'customdns' => $customDNS ); |
707 |
- $dom->set_prop( 'customprotocol' => $customPROTOCOL ); |
708 |
- |
709 |
- $domaindb->reload(); |
710 |
- |
711 |
- system( "/sbin/e-smith/signal-event", "ddclient" ); |
712 |
- return "ok"; |
713 |
-} |
714 |
- |
715 |
-sub performModifyCustom { |
716 |
- my $c = shift; |
717 |
- |
718 |
- #------------------------------------------------------------ |
719 |
- # Validate parameters and untaint them |
720 |
- #------------------------------------------------------------ |
721 |
- |
722 |
- my $domainName = $c->param('domainName'); |
723 |
- if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
724 |
- $domainName = $1; |
725 |
- } |
726 |
- else { |
727 |
- return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName ); |
728 |
- } |
729 |
- |
730 |
- my $domainLogin = $c->param('login'); |
731 |
- if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { |
732 |
- $domainLogin = $1; |
733 |
- } |
734 |
- else { |
735 |
- return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin ); |
736 |
- } |
737 |
- |
738 |
- my $domainPassword = $c->param('password'); |
739 |
- if ( $domainPassword =~ /^(.*)$/ ) { |
740 |
- $domainPassword = $1; |
741 |
- } |
742 |
- else { |
743 |
- return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword ); |
744 |
- } |
745 |
- |
746 |
- my $domainMX = $c->param('mx'); |
747 |
- my $customDNS = $c->param('customdns'); |
748 |
- my $customPROTOCOL = $c->param('customprotocol'); |
749 |
- |
750 |
- my $dns = $c->param('dns'); |
751 |
- if ( $dns eq 'CUSTOMDNS' ) { |
752 |
- if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
753 |
- $customDNS = $1; |
754 |
- } |
755 |
- else |
756 |
- |
757 |
- { |
758 |
- return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName ); |
759 |
- } |
760 |
- } |
761 |
- |
762 |
- #------------------------------------------------------------ |
763 |
- # Looks good. Find out if this domain has been taken |
764 |
- # or if the domain is a reserved to provide a secured webserver |
765 |
- # for a previous domain |
766 |
- #------------------------------------------------------------ |
767 |
- # my $dns = $c->param ('dns'); |
768 |
- |
769 |
- my $dom = $edb->get($domainName); |
770 |
- |
771 |
- $dom->set_prop( 'dns' => $dns ); |
772 |
- $dom->set_prop( 'login' => $domainLogin ); |
773 |
- $dom->set_prop( 'password' => $domainPassword ); |
774 |
- $dom->set_prop( 'mx' => $domainMX ); |
775 |
- $dom->set_prop( 'customdns' => $customDNS ); |
776 |
- $dom->set_prop( 'customprotocol' => $customPROTOCOL ); |
777 |
- |
778 |
- $domaindb->reload(); |
779 |
- |
780 |
- system( "/sbin/e-smith/signal-event", "ddclient" ); |
781 |
- return "ok"; |
782 |
-} |
783 |
- |
784 |
-1; |
785 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient/en.pm smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient/en.pm |
786 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 2020-06-11 09:31:35.756359885 +0100 |
787 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 1970-01-01 01:00:00.000000000 +0100 |
788 |
@@ -1,97 +0,0 @@ |
789 |
-package SrvMngr::I18N::Modules::Ddclient::en; |
790 |
-use strict; |
791 |
-use warnings; |
792 |
-use utf8; |
793 |
-use Mojo::Base 'SrvMngr::I18N'; |
794 |
- |
795 |
-use SrvMngr::I18N::Modules::General::en; |
796 |
- |
797 |
-my %lexicon = ( |
798 |
-'ddc_FORM_TITLE' => 'Create, remove or change the publication of virtual domains', |
799 |
-'ddc_Params_for_IP_Retrieval'=>' Parameters to control how the IP of your server is found:', |
800 |
-'ddc_DESCRIPTION'=> 'Use this contrib when you have a sme server connected to a ISP service using a dynamic IP, and you wish to host multiple domains. |
801 |
-<br>ddclient is a client for updating dynamic DNS entries for domains hosted at different DNS providers. |
802 |
-<br>Configure your dynamic host domains via the ddclient server manager panel. |
803 |
-<br>ddclient can be used on servers configured in server gateway mode or in server only mode.<br><br> ', |
804 |
-'ddc_FORM_DESCRIPTION' => 'Virtual Domains for publication on the net:', |
805 |
-'ddc_NO_VIRTUAL_DOMAINS' => 'There are no virtual domains in the system.', |
806 |
-'ddc_CURRENT_LIST_OF_DOMAINS' => 'Current list of virtual domains', |
807 |
-'ddc_PUBLICATION' => 'Publication', |
808 |
-'ddc_PRIMARY_SITE' => 'Primary Site', |
809 |
-'ddc_CONTENT' => '[_1] i-bay', |
810 |
-'ddc_CREATE_TITLE' => 'Create a new publication virtual domain', |
811 |
-'ddc_SERVERS_LABEL' => 'Where to publish', |
812 |
-'ddc_MX' => 'record MX', |
813 |
-'ddc_NAME_LABEL' => 'Login to publish', |
814 |
-'ddc_PASSWORD_LABEL' => 'Password to publish', |
815 |
-'ddc_CONTENT_FIELD_DESCRIPTION' => 'For the web site, you may choose your primary web site or any i-bay as the content.', |
816 |
-'ddc_DOMAIN_NAME_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain name [_1]. The domain name should contain one or more letters, numbers, periods and minus signs. Did not create new domain.', |
817 |
-'ddc_DOMAIN_DESCRIPTION_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain description [_1]. Did not create new domain.', |
818 |
-'ddc_DOMAIN_IN_USE_ERROR' => 'Error: domain [_1] is already in use. Did not create new domain.', |
819 |
-'ddc_DOMAIN_LOGIN_VALIDATION_ERROR'=> 'Domain login must not be blank and only consist of letter, numbers, "." or "@"', |
820 |
-'ddc_RESERVED_SECURE_DOMAIN_ERROR' => 'Error: domain [_1] is reserved to provide a secured webserver for the virtual domain [_2]. Did not create new domain.', |
821 |
-'ddc_SYSTEM_DOMAIN_ERROR' => 'Error: domain [_1] is your system domain name. You cannot have a virtual domain with the same name. Did not create new domain.', |
822 |
-'ddc_RESERVED_SECURE_SYSTEM_DOMAIN_ERROR' => 'Error: domain [_1] is reserved to provide a secured webserver for your system domain name [_2]. Did not create new domain.', |
823 |
-'ddc_SUCCESSFULLY_CREATED' => 'Successfully publication domain [_1] on [_2].', |
824 |
-'ddc_MODIFY_TITLE' => 'Modify virtual domain', |
825 |
-'ddc_NONEXISTENT_DOMAIN_ERROR' => 'Error: [_1] is not an existing domain.', |
826 |
-'ddc_SUCCESSFULLY_MODIFIED' => 'Successfully modified the publication [_1] on [_2].', |
827 |
-'ddc_REMOVE_TITLE' => 'Remove publication of virtual domain', |
828 |
-'ddc_REMOVE_DESCRIPTION' => '<p>You are about to remove the publication of domain [_1] ([_2]) on [_3]. |
829 |
-</p> |
830 |
-<p> |
831 |
-<b>Are you sure you wish to remove this domain\'s publication ?</b> |
832 |
-</p> |
833 |
-', |
834 |
-'ddc_ERROR_WHILE_REMOVING_DOMAIN' => 'Error: internal failure while removing publication of [_1].', |
835 |
-'ddc_SUCCESSFULLY_DELETED' => 'Successfully deleted publication of [_1] on [_2].', |
836 |
-'ddc_DYNDNS1' => 'dyndns.org dynamic addresses', |
837 |
-'ddc_DYNDNS2' => 'dyndns.org static addresses', |
838 |
-'ddc_DYNDNS3' => 'dyndns.org custom addresses', |
839 |
-'ddc_ZONEDIT' => 'ZoneEdit (zoneedit.com)', |
840 |
-'ddc_EASYDNS' => 'EasyDNS (easydns.com)', |
841 |
-'ddc_HAMMER' => 'Hammernode (hn.org) dynamic addresses', |
842 |
-'ddc_DSLREPORTS' => 'dslreports.com dynamic-host monitoring', |
843 |
-'ddc_EURODYNDNS' => 'eurodyndns.org dynamic addresses', |
844 |
-'ddc_DTDNS' => 'DtDNS (www.dtdns.com) dynamic addresses', |
845 |
-'ddc_LOOPIA' => 'Loopia (loopia.se) dynamic addresses', |
846 |
-'ddc_DNSPARK' => ' Dnspark (dnspark.com) dynamic addresses', |
847 |
-'ddc_DYNHOST' => ' DynHost (ovh.com) dynamic addresses', |
848 |
-'ddc_NOIP' => ' NoIP (noip.com) dynamic addresses', |
849 |
-'ddc_CHANGEIP' => ' ChangeIP (changeip.com) dynamic addresses', |
850 |
-'ddc_NAMECHEAP' => ' NAMECHEAP (namecheap.com) dynamic addresses', |
851 |
-'ddc_SPDNS' => ' SPDNS (spdns.de) dynamic addresses', |
852 |
-'ddc_CUSTOMDNS' => 'Custom Dynamic DNS Provider', |
853 |
-'ddc_CUSTOMDNS_LABEL' => 'Custom server Address', |
854 |
-'ddc_CUSTOM_PROTOCOL_LABEL' => 'Custom ddclient Protocol', |
855 |
-'ddc_CUSTOM_DESCRIPTION' => 'You can use a custom dynamic dns provider if yours is not in the published list. Please fill the custom fields with the appropriate settings', |
856 |
-'ddc_CUSTOMDNS_VALIDATION_ERROR' => 'Error: unexpected or missing characters in custom server address field of domain [_1]. The server address should contain one or more letters, numbers, periods and minus signs. Did not apply the change.', |
857 |
-'ddc_ddclient' =>'Dynamic Clients', |
858 |
-'ddc_DOMAIN_NAME_ALREADY_EXIST' => 'Error: this domain:"[_1]" already exists. Please chose another.', |
859 |
-'ddc_FREE_FORM_DESCRIPTION' => 'Here you can create any domain name to publish over the net:', |
860 |
-'ddc_RETRIEVE_SSL' => 'SSL update', |
861 |
-'ddc_RETRIEVE_DEAMONUPDATE' => 'Deamon update (seconds)', |
862 |
-'ddc_RETRIEVE_URLCHECKIP' => 'Url for the external IP', |
863 |
-'ddc_APPLY' => 'Save', |
864 |
-'ddc_DOMAIN_NAME_LABEL' => 'Domain Name', |
865 |
-'ddc_DESCRIPTION_LABEL' => 'Domain description', |
866 |
-'ddc_SUCCESSFULLY_MODIFIED_RETRIEVE_IP' => 'You have successfully modified the retrieve IP options.', |
867 |
-'ddc_RETRIEVE_METHOD' => 'Method to retrieve new IP:', |
868 |
-'ddc_RETRIEVE_IF' => 'Local interface to get new IP, if selected interface method', |
869 |
-'ddc_RETRIEVE_CMD' => 'Command to execute to get IP, if selected command method', |
870 |
-'ddc_SME external Interface' => 'SME external interface', |
871 |
-'ddc_SME configuration DB' => 'SME configuration DB', |
872 |
-'ddc_web' => 'Web query', |
873 |
-'ddc_Interface' => 'IP from interface', |
874 |
-'ddc_IP' => 'Manual IP setting', |
875 |
-'ddc_Command' => 'Command to execute', |
876 |
-'ddc_RETRIEVE_IP' => 'IP to manually force' |
877 |
-); |
878 |
- |
879 |
-our %Lexicon = ( |
880 |
- %{ SrvMngr::I18N::Modules::General::en::Lexicon }, |
881 |
- %lexicon |
882 |
-); |
883 |
- |
884 |
- |
885 |
-1; |
886 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/ddclient.html.ep smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/ddclient.html.ep |
887 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/ddclient.html.ep 2020-06-11 09:31:35.756359885 +0100 |
888 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/ddclient.html.ep 1970-01-01 01:00:00.000000000 +0100 |
889 |
@@ -1,48 +0,0 @@ |
890 |
-% layout 'default', title => "Sme server 2 - Dynamic Clients", share_dir => './'; |
891 |
- |
892 |
-% content_for 'module' => begin |
893 |
-<div id="module"> |
894 |
- |
895 |
- % if ($config->{debug} == 1) { |
896 |
- <p> |
897 |
- %= dumper $c->current_route |
898 |
- </p> |
899 |
- % } |
900 |
- |
901 |
- <h1><%=$title%></h1> |
902 |
- %= $modul |
903 |
- |
904 |
- %if ($ddc_datas->{first}) { |
905 |
- <br><p> |
906 |
- %=$c->render_to_string(inline =>$c->l($ddc_datas->{first})) |
907 |
- </p> |
908 |
- |
909 |
- %} elsif ($ddc_datas->{success}) { |
910 |
- <div class='sme-border'> |
911 |
- <h2> Operation Status Report</h2><p> |
912 |
- %= $c->l($ddc_datas->{success}); |
913 |
- </p> |
914 |
- </div> |
915 |
- |
916 |
- %} elsif ($ddc_datas->{error}) { |
917 |
- <div class='sme-error'> |
918 |
- <h2> Operation Status Report - error</h2><p> |
919 |
- %= $c->l($ddc_datas->{error}); |
920 |
- </p> |
921 |
- </div> |
922 |
- %} |
923 |
- |
924 |
- % if ($ddc_datas->{trt} eq 'NEW') { |
925 |
- %= include 'partials/_ddc_create_cust' |
926 |
- %} elsif ($ddc_datas->{trt} eq 'DEL') { |
927 |
- %= include 'partials/_ddc_del' |
928 |
- %} elsif ($ddc_datas->{trt} eq 'MOD') { |
929 |
- %= include 'partials/_ddc_modify_domain' |
930 |
- %} else { #LIST |
931 |
- %= include 'partials/_ddc_paramlist' |
932 |
- %= include 'partials/_ddc_domainlist' |
933 |
- %= include 'partials/_ddc_customlist' |
934 |
- %} |
935 |
- |
936 |
-</div> |
937 |
-%end |
938 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_create_cust.html.ep smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_create_cust.html.ep |
939 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_create_cust.html.ep 2020-06-11 09:31:35.757359896 +0100 |
940 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_create_cust.html.ep 1970-01-01 01:00:00.000000000 +0100 |
941 |
@@ -1,63 +0,0 @@ |
942 |
-<div id='ddc_createcustom'> |
943 |
- <h2> |
944 |
- %= l 'ddc_CUSTOM_DESCRIPTION' |
945 |
- </h2><br> |
946 |
- % my $btn = l('ddc_APPLY'); |
947 |
- %= form_for '/ddclient7' => (method => 'POST') => begin |
948 |
- <span class=label> |
949 |
- %=l 'ddc_DOMAIN_NAME_LABEL' |
950 |
- </span><span class=data> |
951 |
- %=text_field 'domainName' |
952 |
- </span><br> |
953 |
- <span class=label> |
954 |
- %=l 'ddc_DESCRIPTION_LABEL' |
955 |
- </span><span class=data> |
956 |
- %=text_field 'desc' |
957 |
- </span><br> |
958 |
- <span class=label> |
959 |
- %=l 'ddc_SERVERS_LABEL' |
960 |
- </span><span class=data> |
961 |
- %=select_field dns=>$dnslabels |
962 |
- </span><br> |
963 |
- <span class=label> |
964 |
- %=l 'ddc_CUSTOMDNS_LABEL' |
965 |
- </span><span class=data> |
966 |
- %=text_field 'customdns' |
967 |
- </span><br> |
968 |
- <span class=label> |
969 |
- %=l 'ddc_CUSTOM_PROTOCOL_LABEL' |
970 |
- </span><span class=data> |
971 |
- %=text_field 'customprotocol' |
972 |
- </span><br> |
973 |
- <span class=label> |
974 |
- %=l 'ddc_NAME_LABEL' |
975 |
- </span><span class=data> |
976 |
- %=text_field 'login' |
977 |
- </span><br> |
978 |
- <span class=label> |
979 |
- %=l 'ddc_PASSWORD_LABEL' |
980 |
- </span><span class=data> |
981 |
- %=password_field 'password',id=>"ddcPass" |
982 |
- %=label_for show=>"Show" |
983 |
- %=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;" |
984 |
- %= javascript begin |
985 |
- function showPass() { |
986 |
- var x = document.getElementById("ddcPass"); |
987 |
- if (x.type === "password") { |
988 |
- x.type = "text"; |
989 |
- } else { |
990 |
- x.type = "password"; |
991 |
- } |
992 |
- } |
993 |
- % end |
994 |
- </span><br> |
995 |
- <span class=label> |
996 |
- %=l 'ddc_MX' |
997 |
- </span><span class=data> |
998 |
- %=text_field 'mx' |
999 |
- </span><br> |
1000 |
- %= submit_button "$btn", class => 'action' |
1001 |
- % end |
1002 |
-</div> |
1003 |
- |
1004 |
- |
1005 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_customlist.html.ep smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_customlist.html.ep |
1006 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_customlist.html.ep 2020-06-11 09:31:35.757359896 +0100 |
1007 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_customlist.html.ep 1970-01-01 01:00:00.000000000 +0100 |
1008 |
@@ -1,50 +0,0 @@ |
1009 |
-<div id='ddc_customlist'> |
1010 |
- <h2> |
1011 |
- %= l 'ddc_FREE_FORM_DESCRIPTION' |
1012 |
- </h2> |
1013 |
- |
1014 |
- %= form_for '/ddclient' => (method => 'POST') => begin |
1015 |
- |
1016 |
- <table class="sme-border"><tbody> |
1017 |
- <tr> |
1018 |
- <th class='sme-border'> |
1019 |
- %=l 'ddc_DOMAIN_NAME_LABEL' |
1020 |
- </th> |
1021 |
- <th class='sme-border'> |
1022 |
- %=l 'ddc_DESCRIPTION_LABEL' |
1023 |
- </th> |
1024 |
- <th class='sme-border'> |
1025 |
- %=l 'ddc_PUBLICATION' |
1026 |
- </th> |
1027 |
- <th class='sme-border' colspan=2> |
1028 |
- %=l 'ACTION' |
1029 |
- </th> |
1030 |
- </tr> |
1031 |
- %if (!$emptycust){ |
1032 |
- % foreach my $freeDomain (@$freedomains) { |
1033 |
- <tr> |
1034 |
- %= t td => (class => 'sme-border') => $freeDomain->{"Domain"} |
1035 |
- %= t td => (class => 'sme-border') => $freeDomain->{"Description"} |
1036 |
- %= t td => (class => 'sme-border') => $freeDomain->{"Publication"} |
1037 |
- <td class = 'sme-border'> |
1038 |
- <a href='/server-manager2/ddclient2?trt=MOD&Domain=<%= $freeDomain->{"Domain"}%>'><%=l 'MODIFY'%></a> |
1039 |
- </td><td class = 'sme-border'> |
1040 |
- <a href='/server-manager2/ddclient2?trt=DEL&Domain=<%= $freeDomain->{"Domain"}%>'><%=l 'REMOVE'%></a> |
1041 |
- </td> |
1042 |
- </td> |
1043 |
- </tr> |
1044 |
- %} |
1045 |
- %} |
1046 |
- <tr><td class='sme-border'></td> |
1047 |
- <td class='sme-border'></td> |
1048 |
- <td class='sme-border'> </td> |
1049 |
- <td class='sme-border'> </td> |
1050 |
- <td class='sme-border'> |
1051 |
- <a href="/server-manager2/ddclient6?trt=NEW"><%=l 'CREATE'%></a> |
1052 |
- </td> |
1053 |
- </tr> |
1054 |
- |
1055 |
- </tbody> |
1056 |
- </table> |
1057 |
- % end |
1058 |
-</div> |
1059 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_del.html.ep smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_del.html.ep |
1060 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_del.html.ep 2020-06-11 09:31:35.757359896 +0100 |
1061 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_del.html.ep 1970-01-01 01:00:00.000000000 +0100 |
1062 |
@@ -1,14 +0,0 @@ |
1063 |
-<div id='ddc_del'> |
1064 |
- % my $btn = l('REMOVE'); |
1065 |
- %= form_for '/ddclient4' => (method => 'POST') => begin |
1066 |
- <p> |
1067 |
- %= $c->render_to_string(inline =>l("ddc_REMOVE_DESCRIPTION",$ddc_datas->{"Domain_details"}->{"Domain"},$ddc_datas->{"Domain_details"}->{"Description"},$c->l($ddc_datas->{"Domain_details"}->{"Publication"}))) |
1068 |
- </p> |
1069 |
- % param Domain=>$ddc_datas->{"Domain_details"}->{"Domain"}; |
1070 |
- %= hidden_field Domain=>$ddc_datas->{"Domain_details"}->{"Domain"} |
1071 |
- %= hidden_field Route=>$c->current_route |
1072 |
- %= hidden_field dns=>$ddc_datas->{"Domain_details"}->{"dns"} |
1073 |
- %= hidden_field trt=>"DEL" |
1074 |
- %= submit_button "$btn", class => 'action' |
1075 |
- % end |
1076 |
-</div> |
1077 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_domainlist.html.ep smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_domainlist.html.ep |
1078 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_domainlist.html.ep 2020-06-11 09:31:35.757359896 +0100 |
1079 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_domainlist.html.ep 1970-01-01 01:00:00.000000000 +0100 |
1080 |
@@ -1,48 +0,0 @@ |
1081 |
-<div id='ddc_Domainslist'> |
1082 |
- <h2> |
1083 |
- %= l 'ddc_FORM_DESCRIPTION' |
1084 |
- </h2> |
1085 |
- %= form_for '/ddclient' => (method => 'POST') => begin |
1086 |
- |
1087 |
- % if ($emptydom){ |
1088 |
- <br><h2> |
1089 |
- %=l 'NO_VIRTUAL_DomainS' |
1090 |
- <h2> |
1091 |
- % } else { |
1092 |
- <table class="sme-border"><tbody> |
1093 |
- <tr> |
1094 |
- <th class='sme-border'> |
1095 |
- %=l 'ddc_DOMAIN_NAME_LABEL' |
1096 |
- </th> |
1097 |
- <th class='sme-border'> |
1098 |
- %=l 'ddc_DESCRIPTION_LABEL' |
1099 |
- </th> |
1100 |
- <th class='sme-border'> |
1101 |
- %=l('ddc_CONTENT',"") |
1102 |
- </th> |
1103 |
- <th class='sme-border'> |
1104 |
- %=l 'ddc_PUBLICATION' |
1105 |
- </th> |
1106 |
- |
1107 |
- <th class='sme-border' colspan=2> |
1108 |
- %=l 'ACTION' |
1109 |
- </th> |
1110 |
- </tr> |
1111 |
- % foreach my $Domain (@$domains) { |
1112 |
- <tr> |
1113 |
- %= t td => (class => 'sme-border') => $Domain->{"Domain"} |
1114 |
- %= t td => (class => 'sme-border') => $Domain->{"Description"} |
1115 |
- %= t td => (class => 'sme-border') => $Domain->{"Content"} |
1116 |
- %= t td => (class => 'sme-border') => $Domain->{"Publication"} |
1117 |
- <td class = 'sme-border'> |
1118 |
- <a href="/server-manager2/ddclient1?trt=MOD&Domain=<%= $Domain->{"Domain"}%>"><%=l 'MODIFY'%></a> |
1119 |
- </td><td class = 'sme-border'> |
1120 |
- <a href="/server-manager2/ddclient1?trt=DEL&Domain=<%= $Domain->{"Domain"}%>"><%=l 'REMOVE'%></a> |
1121 |
- </td> |
1122 |
- </tr> |
1123 |
- %} |
1124 |
- </tbody> |
1125 |
- </table> |
1126 |
- %} |
1127 |
- % end |
1128 |
-</div> |
1129 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_modify_domain.html.ep smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_modify_domain.html.ep |
1130 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_modify_domain.html.ep 2020-06-11 09:31:35.758359906 +0100 |
1131 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_modify_domain.html.ep 1970-01-01 01:00:00.000000000 +0100 |
1132 |
@@ -1,77 +0,0 @@ |
1133 |
-<div id='ddc_modifydomain'> |
1134 |
- <h2> |
1135 |
- %= l 'ddc_CUSTOM_DESCRIPTION' |
1136 |
- </h2><br> |
1137 |
- % my $btn = l('ddc_APPLY'); |
1138 |
- %= form_for '/ddclient8' => (method => 'POST') => begin |
1139 |
- <span class=label> |
1140 |
- %=l 'ddc_DOMAIN_NAME_LABEL' |
1141 |
- </span><span class=data> |
1142 |
- %= hidden_field domainName => $ddc_datas->{"Domain_details"}->{"Domain"} |
1143 |
- %= $ddc_datas->{"Domain_details"}->{"Domain"} |
1144 |
- </span><br><br> |
1145 |
- <span class=label> |
1146 |
- %=l 'ddc_DESCRIPTION_LABEL' |
1147 |
- </span><span class=data> |
1148 |
- %= $ddc_datas->{"Domain_details"}->{"Description"} |
1149 |
- </span><br><br> |
1150 |
- <span class=label> |
1151 |
- %= $ddc_datas->{"Domain_details"}->{"Content"} |
1152 |
- </span><span class=data> |
1153 |
- %= $ddc_datas->{"Domain_details"}->{"Content"} |
1154 |
- </span><br><br> |
1155 |
- <span class=label> |
1156 |
- %=l 'ddc_SERVERS_LABEL' |
1157 |
- </span><span class=data> |
1158 |
- % param dns=>$ddc_datas->{"Domain_details"}->{"dns"}; |
1159 |
- %=select_field dns=>$dnslabels |
1160 |
- </span><br> |
1161 |
- <span class=label> |
1162 |
- %=l 'ddc_CUSTOMDNS_LABEL' |
1163 |
- </span><span class=data> |
1164 |
- % param customdns=>$ddc_datas->{"Domain_details"}->{"customdns"}; |
1165 |
- %=text_field 'customdns' |
1166 |
- </span><br> |
1167 |
- <span class=label> |
1168 |
- %=l 'ddc_CUSTOM_PROTOCOL_LABEL' |
1169 |
- </span><span class=data> |
1170 |
- % param customprotocol=>$ddc_datas->{"Domain_details"}->{"customprotocol"}; |
1171 |
- %=text_field 'customprotocol' |
1172 |
- </span><br> |
1173 |
- <span class=label> |
1174 |
- %=l 'ddc_NAME_LABEL' |
1175 |
- </span><span class=data> |
1176 |
- % param login=>$ddc_datas->{"Domain_details"}->{"login"}; |
1177 |
- %=text_field 'login' |
1178 |
- </span><br> |
1179 |
- <span class=label> |
1180 |
- %=l 'ddc_PASSWORD_LABEL' |
1181 |
- </span><span class=data> |
1182 |
- % param password=>$ddc_datas->{"Domain_details"}->{"password"}; |
1183 |
- %=password_field 'password',id=>"ddcPass",value=>$ddc_datas->{"Domain_details"}->{"password"} |
1184 |
- %=label_for show=>"Show" |
1185 |
- %=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;" |
1186 |
- %= javascript begin |
1187 |
- function showPass() { |
1188 |
- var x = document.getElementById("ddcPass"); |
1189 |
- if (x.type === "password") { |
1190 |
- x.type = "text"; |
1191 |
- } else { |
1192 |
- x.type = "password"; |
1193 |
- } |
1194 |
- } |
1195 |
- % end |
1196 |
- </span><br> |
1197 |
- <span class=label> |
1198 |
- %=l 'ddc_MX' |
1199 |
- </span><span class=data> |
1200 |
- % param mx=>$ddc_datas->{"Domain_details"}->{"mx"}; |
1201 |
- %=text_field 'mx' |
1202 |
- </span><br> |
1203 |
- %= hidden_field trt=>"MOD" |
1204 |
- %= hidden_field Route=>$c->current_route |
1205 |
- %= submit_button "$btn", class => 'action' |
1206 |
- % end |
1207 |
-</div> |
1208 |
- |
1209 |
- |
1210 |
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_paramlist.html.ep smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_paramlist.html.ep |
1211 |
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_paramlist.html.ep 2020-06-11 09:31:35.758359906 +0100 |
1212 |
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_ddc_paramlist.html.ep 1970-01-01 01:00:00.000000000 +0100 |
1213 |
@@ -1,52 +0,0 @@ |
1214 |
-<div id='ddc_paramlist'> |
1215 |
- <h2> |
1216 |
- %= l 'ddc_Params_for_IP_Retrieval' |
1217 |
- </h2> |
1218 |
- % my $btn = l('ddc_APPLY'); |
1219 |
- %= form_for '/ddclient3' => (method => 'POST') => begin |
1220 |
- <span class=label> |
1221 |
- %=l 'ddc_RETRIEVE_SSL' |
1222 |
- </span><span class=data> |
1223 |
- % param retrievessl=>$ddc_datas->{"params"}->{"ssl"}; |
1224 |
- %=select_field retrievessl=>[['Yes'=>'yes'],['No'=>'no']] |
1225 |
- </span><br> |
1226 |
- <span class=label> |
1227 |
- %=l 'ddc_RETRIEVE_DEAMONUPDATE' |
1228 |
- </span><span class=data> |
1229 |
- % param retrievedeamonupdate=>$ddc_datas->{"params"}->{"DeamonUpdate"}; |
1230 |
- %=number_field 'retrievedeamonupdate',min=>0 |
1231 |
- </span><br> |
1232 |
- <span class=label> |
1233 |
- %=l 'ddc_RETRIEVE_METHOD' |
1234 |
- </span><span class=data> |
1235 |
- % param retrievemethod=>$ddc_datas->{"params"}->{"method"}; |
1236 |
- %=select_field retrievemethod=>$methodlabels |
1237 |
- </span><br> |
1238 |
- <span class=label> |
1239 |
- %=l 'ddc_RETRIEVE_IF' |
1240 |
- </span><span class=data> |
1241 |
- % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"}; |
1242 |
- %=text_field 'retrieveinterface' |
1243 |
- </span><br> |
1244 |
- <span class=label> |
1245 |
- %=l 'ddc_RETRIEVE_CMD' |
1246 |
- </span><span class=data> |
1247 |
- % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"}; |
1248 |
- %=text_field 'retrievecmd' |
1249 |
- </span><br> |
1250 |
- <span class=label> |
1251 |
- %=l 'ddc_RETRIEVE_IP' |
1252 |
- </span><span class=data> |
1253 |
- % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"}; |
1254 |
- %=text_field 'retrieveip' |
1255 |
- </span><br> |
1256 |
- <span class=label> |
1257 |
- %=l 'ddc_RETRIEVE_URLCHECKIP' |
1258 |
- </span><span class=data> |
1259 |
- % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"}; |
1260 |
- %=text_field 'retrieveurlcheckip' |
1261 |
- </span><br> |
1262 |
- |
1263 |
- %= submit_button "$btn", class => 'action' |
1264 |
- % end |
1265 |
-</div> |
1266 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm smeserver-ddclient-1.2.1/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm |
1267 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 1970-01-01 01:00:00.000000000 +0100 |
1268 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2020-06-12 08:45:00.000000000 +0100 |
1269 |
@@ -0,0 +1,772 @@ |
1270 |
+package SrvMngr::Controller::Ddclient; |
1271 |
+ |
1272 |
+#---------------------------------------------------------------------- |
1273 |
+# heading : Configuration |
1274 |
+# description : Dynamic Clients |
1275 |
+# navigation : 3000 3400 |
1276 |
+# |
1277 |
+# name : ddclient, method : get, url : /ddclient, ctlact : Ddclient#main |
1278 |
+# name : ddclient3, method : post, url : /ddclient3, ctlact : Ddclient#do_updateparams |
1279 |
+# name : ddclient1, method : get, url : /ddclient1, ctlact : Ddclient#do_summary_domain |
1280 |
+# name : ddclient2, method : get, url : /ddclient2, ctlact : Ddclient#do_summary_custom |
1281 |
+# name : ddclient4, method : post, url : /ddclient4, ctlact : Ddclient#do_delete_domain |
1282 |
+# name : ddclient5, method : get, url : /ddclient5, ctlact : Ddclient#do_update_domain |
1283 |
+# name : ddclient6, method : get, url : /ddclient6, ctlact : Ddclient#do_create_custom |
1284 |
+# name : ddclient7, method : post, url : /ddclient7, ctlact : Ddclient#do_create_custom_actual |
1285 |
+# name : ddclient8, method : post, url : /ddclient8, ctlact : Ddclient#do_update_domain |
1286 |
+# |
1287 |
+# routes : end |
1288 |
+#---------------------------------------------------------------------- |
1289 |
+ |
1290 |
+use strict; |
1291 |
+use warnings; |
1292 |
+use Mojo::Base 'Mojolicious::Controller'; |
1293 |
+ |
1294 |
+use constant FALSE => 0; |
1295 |
+use constant TRUE => 1; |
1296 |
+ |
1297 |
+use Locale::gettext; |
1298 |
+use SrvMngr::I18N; |
1299 |
+use SrvMngr qw(theme_list init_session); |
1300 |
+ |
1301 |
+use Data::Dumper; |
1302 |
+use esmith::util; |
1303 |
+use esmith::HostsDB; |
1304 |
+use esmith::AccountsDB; |
1305 |
+ |
1306 |
+our $db = esmith::ConfigDB->open(); |
1307 |
+our $adb = esmith::AccountsDB->open(); |
1308 |
+ |
1309 |
+our $domaindb = esmith::ConfigDB->open('/home/e-smith/db/domains') |
1310 |
+ or die "Unable to open domains db"; |
1311 |
+our $edb; |
1312 |
+$edb = esmith::ConfigDB->open('/home/e-smith/db/ddclient') |
1313 |
+ or $edb = esmith::ConfigDB->create('/home/e-smith/db/ddclient'); |
1314 |
+ |
1315 |
+my %ddc_datas = (); |
1316 |
+ |
1317 |
+sub get_dns_labels { |
1318 |
+ # |
1319 |
+ # dns service names |
1320 |
+ # |
1321 |
+ my $c = shift; |
1322 |
+ my $Labels = ( |
1323 |
+ [ |
1324 |
+ [ $c->l('ddc_CUSTOMDNS'), 'CUSTOMDNS' ], |
1325 |
+ [ $c->l('ddc_DYNDNS1'), 'DYNDNS1' ], |
1326 |
+ [ $c->l('ddc_DYNDNS2'), 'DYNDNS2' ], |
1327 |
+ [ $c->l('ddc_DYNDNS3'), 'DYNDNS3' ], |
1328 |
+ [ $c->l('ddc_ZONEDIT'), 'ZONEDIT' ], |
1329 |
+ [ $c->l('ddc_EASYDNS'), 'EASYDNS' ], |
1330 |
+ [ $c->l('ddc_HAMMER'), 'HAMMER' ], |
1331 |
+ [ $c->l('ddc_DSLREPORTS'), 'DSLREPORTS' ], |
1332 |
+ [ $c->l('ddc_EURODYNDNS'), 'EURODYNDNS' ], |
1333 |
+ [ $c->l('ddc_DTDNS'), 'DTDNS' ], |
1334 |
+ [ $c->l('ddc_LOOPIA'), 'LOOPIA' ], |
1335 |
+ [ $c->l('ddc_DNSPARK'), 'DNSPARK' ], |
1336 |
+ [ $c->l('ddc_DYNHOST'), 'DYNHOST' ], |
1337 |
+ [ $c->l('ddc_NOIP'), 'NOIP' ], |
1338 |
+ [ $c->l('ddc_CHANGEIP'), 'CHANGEIP' ], |
1339 |
+ [ $c->l('ddc_NAMECHEAP'), 'NAMECHEAP' ], |
1340 |
+ [ $c->l('ddc_SPDNS'), 'SPDNS' ] |
1341 |
+ ] |
1342 |
+ ); |
1343 |
+ return $Labels; |
1344 |
+} |
1345 |
+ |
1346 |
+sub main { |
1347 |
+ # |
1348 |
+ # Initial page - full summary of parameters etc |
1349 |
+ # Initial para from the Wiki. |
1350 |
+ # |
1351 |
+ my $c = shift; |
1352 |
+ $ddc_datas{"first"} = 'ddc_DESCRIPTION'; |
1353 |
+ do_display( $c, %ddc_datas ); |
1354 |
+} |
1355 |
+ |
1356 |
+sub do_display { |
1357 |
+ # |
1358 |
+ # Front Summary page |
1359 |
+ # |
1360 |
+ my $c = shift; |
1361 |
+ $c->app->log->info( $c->log_req ); |
1362 |
+ |
1363 |
+ my $title = $c->l('ddc_FORM_TITLE'); |
1364 |
+ my $modul = ''; |
1365 |
+ $ddc_datas{trt} = 'LIST'; |
1366 |
+ my $trt = "LIST"; |
1367 |
+ |
1368 |
+ $ddc_datas{"params"} = get_params($c); |
1369 |
+ my @domains = get_domain_table($c); |
1370 |
+ my @FreeDomains = get_custom_table($c); |
1371 |
+ |
1372 |
+ my $emptydom = ( scalar @domains == 0 ); |
1373 |
+ my $emptycust = ( scalar @FreeDomains == 0 ); |
1374 |
+ |
1375 |
+ my $Labels = ( |
1376 |
+ [ |
1377 |
+ [ $c->l('ddc_SME external Interface'), "smeIF" ], |
1378 |
+ [ $c->l('ddc_SME configuration DB'), "smeCMD" ], |
1379 |
+ [ $c->l('ddc_web'), "web" ], |
1380 |
+ [ $c->l('ddc_Interface'), "if" ], |
1381 |
+ [ $c->l('ddc_IP'), "ip" ], |
1382 |
+ [ $c->l('ddc_Command'), "cmd" ] |
1383 |
+ ] |
1384 |
+ ); |
1385 |
+ |
1386 |
+ $c->stash( |
1387 |
+ title => $title, |
1388 |
+ modul => $modul, |
1389 |
+ ddc_datas => \%ddc_datas, |
1390 |
+ domains => \@domains, |
1391 |
+ freedomains => \@FreeDomains, |
1392 |
+ methodlabels => $Labels, |
1393 |
+ emptydom => $emptydom, |
1394 |
+ emptycust => $emptycust |
1395 |
+ ); |
1396 |
+ $ddc_datas{'trt'} = $trt; |
1397 |
+ $c->stash( title => $title, modul => $modul, ddc_datas => \%ddc_datas ); |
1398 |
+ $c->render( template => 'ddclient' ); |
1399 |
+ |
1400 |
+} |
1401 |
+ |
1402 |
+sub do_updateparams { |
1403 |
+ # |
1404 |
+ # Called to update the parameters relating to the Ip address of the server |
1405 |
+ # |
1406 |
+ my $c = shift; |
1407 |
+ $ddc_datas{"success"} = pushParams($c); |
1408 |
+ do_display($c); |
1409 |
+} |
1410 |
+ |
1411 |
+sub do_update_domain { |
1412 |
+ # |
1413 |
+ #Called to update/delete the ddclient for a specific inbuilt domain |
1414 |
+ # |
1415 |
+ my $c = shift; |
1416 |
+ my $retmsg; |
1417 |
+ if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field |
1418 |
+ $retmsg = performModifyCustom($c); |
1419 |
+ } |
1420 |
+ else { |
1421 |
+ $retmsg = performModifyDomain($c); |
1422 |
+ } |
1423 |
+ if ( $retmsg eq "ok" ) { |
1424 |
+ my $dns = $c->param('dns'); |
1425 |
+ my $domain = $c->param('domainname'); |
1426 |
+ $ddc_datas{"success"} = |
1427 |
+ $c->l( "ddc_SUCCESSFULLY_MODIFIED", $domain, $c->l( 'ddc_' . $dns ) ); |
1428 |
+ do_display( $c, %ddc_datas ); |
1429 |
+ } |
1430 |
+ else { |
1431 |
+ $ddc_datas{"error"} = $retmsg; |
1432 |
+ |
1433 |
+ #Back to input panel to correct error |
1434 |
+ do_summary_domain($c); |
1435 |
+ } |
1436 |
+} |
1437 |
+ |
1438 |
+sub do_create_custom { |
1439 |
+ # |
1440 |
+ # Create custom domain |
1441 |
+ # |
1442 |
+ my $c = shift; |
1443 |
+ my $title = $c->l("ddc_CREATE_TITLE"); |
1444 |
+ my $modul = ''; |
1445 |
+ my $trt = "NEW"; |
1446 |
+ |
1447 |
+ $ddc_datas{trt} = $trt; |
1448 |
+ $c->stash( |
1449 |
+ title => $title, |
1450 |
+ modul => $modul, |
1451 |
+ ddc_datas => \%ddc_datas, |
1452 |
+ dnslabels => get_dns_labels($c) |
1453 |
+ ); |
1454 |
+ $c->render( template => 'ddclient' ); |
1455 |
+} |
1456 |
+ |
1457 |
+sub do_create_custom_actual { |
1458 |
+ my $c = shift; |
1459 |
+ my $retmsg = performCreateCustom($c); |
1460 |
+ if ( $retmsg eq "ok" ) { |
1461 |
+ my $dns = $c->param('dns'); |
1462 |
+ my $domain = $c->param('domainname'); |
1463 |
+ $ddc_datas{"success"} = |
1464 |
+ $c->l( "ddc_SUCCESSFULLY_DELETED", $domain, $c->l( 'ddc_' . $dns ) ); |
1465 |
+ do_display( $c, %ddc_datas ); |
1466 |
+ } |
1467 |
+ else { |
1468 |
+ $ddc_datas{"error"} = $retmsg; |
1469 |
+ #Back to input panel to correct error |
1470 |
+ do_create_custom($c); |
1471 |
+ } |
1472 |
+ |
1473 |
+} |
1474 |
+ |
1475 |
+sub do_summary_custom { |
1476 |
+ # |
1477 |
+ # Display delete or modify panel for custom domain |
1478 |
+ # |
1479 |
+ my $c = shift; |
1480 |
+ my $title = $c->l("ddc_MODIFY_TITLE"); |
1481 |
+ my $modul = ''; |
1482 |
+ my $trt = $c->param("trt"); |
1483 |
+ |
1484 |
+ #Extract domain stuff from DB |
1485 |
+ my @results = |
1486 |
+ get_custom_table( $c, $c->param("Domain") ); #Returns just one row |
1487 |
+ |
1488 |
+ $ddc_datas{"Domain_details"} = $results[0]; |
1489 |
+ |
1490 |
+ $ddc_datas{'trt'} = $trt; |
1491 |
+ $c->stash( |
1492 |
+ title => $title, |
1493 |
+ modul => $modul, |
1494 |
+ ddc_datas => \%ddc_datas, |
1495 |
+ dnslabels => get_dns_labels($c) |
1496 |
+ ); |
1497 |
+ $c->render( template => 'ddclient' ); |
1498 |
+} |
1499 |
+ |
1500 |
+sub do_summary_domain { |
1501 |
+ # |
1502 |
+ # Display delete or modify panel for inbuilt domain |
1503 |
+ # param trt = MOD or DEL |
1504 |
+ # |
1505 |
+ my $c = shift; |
1506 |
+ my $title = $c->l("ddc_MODIFY_TITLE"); |
1507 |
+ my $modul = ''; |
1508 |
+ my $trt = $c->param("trt"); |
1509 |
+ |
1510 |
+ #Extract domain stuff from DB |
1511 |
+ my @results = |
1512 |
+ get_domain_table( $c, $c->param("Domain") ); #Returns just one row |
1513 |
+ $ddc_datas{"Domain_details"} = $results[0]; |
1514 |
+ |
1515 |
+ $ddc_datas{'trt'} = $trt; |
1516 |
+ $c->stash( |
1517 |
+ title => $title, |
1518 |
+ modul => $modul, |
1519 |
+ ddc_datas => \%ddc_datas, |
1520 |
+ dnslabels => get_dns_labels($c) |
1521 |
+ ); |
1522 |
+ $c->render( template => 'ddclient' ); |
1523 |
+} |
1524 |
+ |
1525 |
+sub do_delete_domain { |
1526 |
+ # |
1527 |
+ # Actually clearout the inbuilt domain |
1528 |
+ # Return to initial page with message at the top. |
1529 |
+ # |
1530 |
+ my $c = shift; |
1531 |
+ my $route = $c->current_route; |
1532 |
+ my $title = $c->l("ddc_REMOVE_TITLE"); |
1533 |
+ my $modul = ''; |
1534 |
+ my $retmsg = ""; |
1535 |
+ my $domain = $c->param("Domain"); |
1536 |
+ |
1537 |
+ #Delete it and return to front summary panel - depends on route domain or custom |
1538 |
+ if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field |
1539 |
+ $retmsg = performDeleteCustom( $c, $domain ); |
1540 |
+ } |
1541 |
+ else { |
1542 |
+ $retmsg = performDeleteDomain( $c, $domain ); |
1543 |
+ } |
1544 |
+ |
1545 |
+ if ( $retmsg eq "ok" ) { |
1546 |
+ $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain, |
1547 |
+ $c->l( 'ddc_' . $c->param("dns") ) ); |
1548 |
+ } |
1549 |
+ else { $ddc_datas{"error"} = $retmsg; } |
1550 |
+ do_display( $c, %ddc_datas ); |
1551 |
+ |
1552 |
+} |
1553 |
+ |
1554 |
+sub do_delete_custom { |
1555 |
+ # |
1556 |
+ # Actually delete the custom domain |
1557 |
+ # Return to initial page with message at the top. |
1558 |
+ # |
1559 |
+ my $c = shift; |
1560 |
+ my $route = $c->current_route; |
1561 |
+ my $title = $c->l("ddc_REMOVE_TITLE"); |
1562 |
+ my $modul = ''; |
1563 |
+ my $retmsg = ""; |
1564 |
+ my $domain = $c->param("Domain"); |
1565 |
+ |
1566 |
+ #Delete it and return to front summary panel - depends on route domain or custom |
1567 |
+ $retmsg = performDeleteCustom( $c, $domain ); |
1568 |
+ if ( $retmsg eq "ok" ) { |
1569 |
+ $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain ); |
1570 |
+ } |
1571 |
+ else { $ddc_datas{"error"} = $retmsg; } |
1572 |
+ do_display( $c, %ddc_datas ); |
1573 |
+ |
1574 |
+} |
1575 |
+ |
1576 |
+sub performDeleteDomain { |
1577 |
+ my ( $c, $domain ) = @_; |
1578 |
+ |
1579 |
+ #------------------------------------------------------------ |
1580 |
+ # Attempt to delete domain |
1581 |
+ #------------------------------------------------------------ |
1582 |
+ |
1583 |
+ if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
1584 |
+ $domain = $1; |
1585 |
+ } |
1586 |
+ else { |
1587 |
+ return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain ); |
1588 |
+ } |
1589 |
+ |
1590 |
+ my $value = $domaindb->get($domain); |
1591 |
+ unless ($value) { |
1592 |
+ return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain ); |
1593 |
+ } |
1594 |
+ |
1595 |
+ my %properties = $value->props; |
1596 |
+ my $type = $properties{'type'}; |
1597 |
+ if ( $type ne 'domain' ) { |
1598 |
+ return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain ); |
1599 |
+ } |
1600 |
+ |
1601 |
+ my $evalue = $domaindb->get($domain); |
1602 |
+ |
1603 |
+ $evalue->set_prop( 'dns' => '' ); |
1604 |
+ $evalue->set_prop( 'login' => '' ); |
1605 |
+ $evalue->set_prop( 'password' => '' ); |
1606 |
+ $evalue->set_prop( 'customdns' => '' ); |
1607 |
+ $evalue->set_prop( 'customprotocol' => '' ); |
1608 |
+ |
1609 |
+ $domaindb->reload(); |
1610 |
+ |
1611 |
+ system( "/sbin/e-smith/signal-event", "ddclient" ); |
1612 |
+ |
1613 |
+ return "ok"; |
1614 |
+} |
1615 |
+ |
1616 |
+sub performDeleteCustom { |
1617 |
+ my ( $c, $domain ) = @_; |
1618 |
+ |
1619 |
+ #------------------------------------------------------------ |
1620 |
+ # Attempt to delete domain |
1621 |
+ #------------------------------------------------------------ |
1622 |
+ |
1623 |
+ if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
1624 |
+ $domain = $1; |
1625 |
+ } |
1626 |
+ else { |
1627 |
+ return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain ); |
1628 |
+ } |
1629 |
+ |
1630 |
+ my $evalue = $edb->get($domain); |
1631 |
+ unless ($evalue) { |
1632 |
+ return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain ); |
1633 |
+ } |
1634 |
+ |
1635 |
+ my %properties = $evalue->props; |
1636 |
+ my $type = $properties{'type'}; |
1637 |
+ |
1638 |
+ if ( $type ne 'ddhost' ) { |
1639 |
+ return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain ); |
1640 |
+ |
1641 |
+ } |
1642 |
+ |
1643 |
+ $evalue->delete; |
1644 |
+ $edb->reload(); |
1645 |
+ |
1646 |
+ system( "/sbin/e-smith/signal-event", "ddclient" ); |
1647 |
+ return "ok"; |
1648 |
+} |
1649 |
+ |
1650 |
+sub get_domain_table { |
1651 |
+ # |
1652 |
+ # Return full table of all domains OR just the details for the specified one |
1653 |
+ # |
1654 |
+ my ( $c, $findDomain ) = @_; #$c and domain to find |
1655 |
+ $findDomain = FALSE if ( scalar(@_) <= 1 ); |
1656 |
+ my $key; |
1657 |
+ my @virtualDomains = (); |
1658 |
+ foreach my $domain ( $domaindb->get_all_by_prop( type => 'domain' ) ) { |
1659 |
+ $key = $domain->key; |
1660 |
+ push( @virtualDomains, $key ); |
1661 |
+ } |
1662 |
+ my $numDomains = @virtualDomains; |
1663 |
+ if ( $numDomains == 0 ) { return () } |
1664 |
+ else { |
1665 |
+ my $domain; |
1666 |
+ my @virtualDomains2d = (); |
1667 |
+ |
1668 |
+ foreach $domain ( sort @virtualDomains ) { |
1669 |
+ my %properties = $domaindb->get($domain)->props; |
1670 |
+ my $test = $domaindb->get_prop( $domain, "dns" ) || ''; |
1671 |
+ my %extraprops; |
1672 |
+ if ( $test ne '' ) { %extraprops = $domaindb->get($domain)->props; } |
1673 |
+ |
1674 |
+ my $content; |
1675 |
+ if ( $properties{'Content'} eq 'wwwpublic' ) { |
1676 |
+ $content = $c->l('ddc_PRIMARY_SITE'); |
1677 |
+ } |
1678 |
+ else { $content = $c->l( 'ddc_CONTENT', $properties{'Content'} ); } |
1679 |
+ |
1680 |
+ my $public; |
1681 |
+ my %thisrow; |
1682 |
+ if ( $test eq '' ) { |
1683 |
+ %thisrow = ( |
1684 |
+ "Domain" => $domain, |
1685 |
+ "Description" => $properties{'Description'}, |
1686 |
+ "Content" => $content, |
1687 |
+ "dns" => "", |
1688 |
+ "Publication" => "", |
1689 |
+ "customprotocol" => "", |
1690 |
+ "customdns" => "", |
1691 |
+ "login" => "", |
1692 |
+ "password" => "", |
1693 |
+ "mx" => "" |
1694 |
+ ); |
1695 |
+ push( @virtualDomains2d, \%thisrow ); |
1696 |
+ } |
1697 |
+ else { |
1698 |
+ %thisrow = ( |
1699 |
+ "Domain" => $domain, |
1700 |
+ "Description" => $properties{'Description'}, |
1701 |
+ "Content" => $content, |
1702 |
+ "dns" => $extraprops{'dns'}, |
1703 |
+ "Publication" => $c->l( 'ddc_' . $extraprops{'dns'} ), |
1704 |
+ "customprotocol" => $properties{"customprotocol"}, |
1705 |
+ "customdns" => $properties{"customdns"}, |
1706 |
+ "login" => $properties{"login"}, |
1707 |
+ "password" => $properties{"password"}, |
1708 |
+ "mx" => $properties{"mx"}, |
1709 |
+ ); |
1710 |
+ push( @virtualDomains2d, \%thisrow ); |
1711 |
+ |
1712 |
+ } |
1713 |
+ if ($findDomain) { |
1714 |
+ if ( $domain eq $findDomain ) { |
1715 |
+ @virtualDomains2d = (); #Just return matching one |
1716 |
+ push( @virtualDomains2d, \%thisrow ); |
1717 |
+ last; |
1718 |
+ } |
1719 |
+ } #Found the one needed |
1720 |
+ } |
1721 |
+ return @virtualDomains2d; #Return the lot |
1722 |
+ } |
1723 |
+} |
1724 |
+ |
1725 |
+sub get_custom_table { |
1726 |
+ # |
1727 |
+ # Return full table of all domains OR just the details for the specified one |
1728 |
+ # |
1729 |
+ my ( $c, $findDomain ) = @_; #$c and domain to find |
1730 |
+ $findDomain = FALSE if ( scalar(@_) <= 1 ); |
1731 |
+ my $key; |
1732 |
+ my @FreeDomains = (); |
1733 |
+ foreach my $domain ( $edb->get_all_by_prop( type => 'ddhost' ) ) { |
1734 |
+ $key = $domain->key; |
1735 |
+ push( @FreeDomains, $key ); |
1736 |
+ } |
1737 |
+ my $numDomains = @FreeDomains; |
1738 |
+ my @freedomains2d = (); |
1739 |
+ if ( $numDomains > 0 ) { |
1740 |
+ foreach my $domain ( sort @FreeDomains ) { |
1741 |
+ my $vals = $edb->get($domain); |
1742 |
+ my $content = $vals->prop('desc'); |
1743 |
+ my $publish = $vals->prop('dns'); |
1744 |
+ my %thisrow = ( |
1745 |
+ 'Domain' => $domain, |
1746 |
+ "Description" => $content, |
1747 |
+ "dns" => $publish, |
1748 |
+ "Publication" => |
1749 |
+ $c->l( 'ddc_' . $publish ), #msg ddc prefix for ddclient |
1750 |
+ "customprotocol" => $vals->prop("customprotocol"), |
1751 |
+ "customdns" => $vals->prop("customdns"), |
1752 |
+ "login" => $vals->prop("login"), |
1753 |
+ "password" => $vals->prop("password"), |
1754 |
+ "mx" => $vals->prop("mx"), |
1755 |
+ |
1756 |
+ ); |
1757 |
+ |
1758 |
+ push( @freedomains2d, \%thisrow ); |
1759 |
+ if ($findDomain) { |
1760 |
+ if ( $domain eq $findDomain ) { |
1761 |
+ @freedomains2d = (); #Just return matching one |
1762 |
+ push( @freedomains2d, \%thisrow ); |
1763 |
+ last; |
1764 |
+ } |
1765 |
+ } #Found the one needed |
1766 |
+ |
1767 |
+ } |
1768 |
+ } |
1769 |
+ return @freedomains2d; |
1770 |
+} |
1771 |
+ |
1772 |
+sub get_params { |
1773 |
+ my $c = shift; |
1774 |
+ my $ddretrieve = $db->get('ddclient'); |
1775 |
+ my $ExtIF = $db->get('ExternalInterface'); |
1776 |
+ my $DeamonUpdate = $ddretrieve->prop('DeamonUpdate') || '300'; |
1777 |
+ my $urlcheckip = $ddretrieve->prop('urlcheckip') || 'checkip.dyndns.org'; |
1778 |
+ my $ssl = $ddretrieve->prop('SSL') || 'yes'; |
1779 |
+ my $method = $ddretrieve->prop('method') || 'web'; |
1780 |
+ my $Extinterface = $ddretrieve->prop('Extinterface') || ''; |
1781 |
+ my $cmd = $ddretrieve->prop('cmd') || ''; |
1782 |
+ my $forceIP = $ddretrieve->prop('ForceIP') || ''; |
1783 |
+ my $res = { |
1784 |
+ "ssl" => $ssl, |
1785 |
+ "DeamonUpdate" => $DeamonUpdate, |
1786 |
+ "method" => $method, |
1787 |
+ "Extinterface" => $Extinterface, |
1788 |
+ "cmd" => $cmd, |
1789 |
+ "ForceIP" => $forceIP, |
1790 |
+ "urlcheckip" => $urlcheckip |
1791 |
+ }; |
1792 |
+ return $res; |
1793 |
+} |
1794 |
+ |
1795 |
+sub pushParams { |
1796 |
+ my $c = shift; |
1797 |
+ my $DeamonUpdate = $c->param('retrievedeamonupdate'); |
1798 |
+ my $urlcheckip = $c->param('retrieveurlcheckip'); |
1799 |
+ my $ssl = $c->param('retrievessl'); |
1800 |
+ my $retrievemethod = $c->param('retrievemethod'); |
1801 |
+ my $retrieveinterface = $c->param('retrieveinterface'); |
1802 |
+ my $retrievecmd = $c->param('retrievecmd'); |
1803 |
+ my $retrieveip = $c->param('retrieveip'); |
1804 |
+ |
1805 |
+ my $ddclient = $db->get('ddclient'); |
1806 |
+ $ddclient->set_prop( 'urlcheckip' => $urlcheckip ); |
1807 |
+ $ddclient->set_prop( 'DeamonUpdate' => $DeamonUpdate ); |
1808 |
+ $ddclient->set_prop( 'SSL' => $ssl ); |
1809 |
+ $ddclient->set_prop( 'method' => $retrievemethod ); |
1810 |
+ $ddclient->set_prop( 'Extinterface' => $retrieveinterface ); |
1811 |
+ $ddclient->set_prop( 'cmd' => $retrievecmd ); |
1812 |
+ $ddclient->set_prop( 'ForceIP' => $retrieveip ); |
1813 |
+ |
1814 |
+ $domaindb->reload(); |
1815 |
+ |
1816 |
+ system( "/sbin/e-smith/signal-event", "ddclient" ); |
1817 |
+ |
1818 |
+ return $c->l('ddc_SUCCESSFULLY_MODIFIED_RETRIEVE_IP'); |
1819 |
+} |
1820 |
+ |
1821 |
+sub performCreateCustom { |
1822 |
+ my ($c) = shift; |
1823 |
+ |
1824 |
+ #------------------------------------------------------------ |
1825 |
+ # Validate parameters and untaint them |
1826 |
+ #------------------------------------------------------------ |
1827 |
+ |
1828 |
+ my $domainName = $c->param('domainName'); |
1829 |
+ if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
1830 |
+ $domainName = $1; |
1831 |
+ } |
1832 |
+ else { |
1833 |
+ return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName ); |
1834 |
+ } |
1835 |
+ |
1836 |
+ foreach my $domain ( $edb->get_all_by_prop( type => 'domain' ) ) { |
1837 |
+ my $key = $domain->key; |
1838 |
+ if ( $key eq $domainName ) { |
1839 |
+ return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName ); |
1840 |
+ } |
1841 |
+ } |
1842 |
+ |
1843 |
+ foreach my $domain ( $domaindb->get_all_by_prop( type => 'ddhost' ) ) { |
1844 |
+ my $key = $domain->key; |
1845 |
+ if ( $key eq $domainName ) { |
1846 |
+ return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName ); |
1847 |
+ } |
1848 |
+ } |
1849 |
+ |
1850 |
+ my $domainDesc = $c->param('desc'); |
1851 |
+ my $domainLogin = $c->param('login'); |
1852 |
+ if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { |
1853 |
+ $domainLogin = $1; |
1854 |
+ } |
1855 |
+ else { |
1856 |
+ return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin ); |
1857 |
+ } |
1858 |
+ |
1859 |
+ my $domainPassword = $c->param('password'); |
1860 |
+ if ( $domainPassword =~ /^(.*)$/ ) { |
1861 |
+ $domainPassword = $1; |
1862 |
+ } |
1863 |
+ else { |
1864 |
+ return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword ); |
1865 |
+ } |
1866 |
+ |
1867 |
+ my $domainMX = $c->param('mx'); |
1868 |
+ my $customDNS = $c->param('customdns'); |
1869 |
+ my $customPROTOCOL = $c->param('customprotocol'); |
1870 |
+ |
1871 |
+ my $dns = $c->param('dns'); |
1872 |
+ if ( $dns eq 'CUSTOMDNS' ) { |
1873 |
+ if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
1874 |
+ $customDNS = $1; |
1875 |
+ } |
1876 |
+ else { |
1877 |
+ return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName ); |
1878 |
+ } |
1879 |
+ } |
1880 |
+ |
1881 |
+ #------------------------------------------------------------ |
1882 |
+ # Looks good. Find out if this domain has been taken |
1883 |
+ # or if the domain is a reserved to provide a secured webserver |
1884 |
+ # for a previous domain |
1885 |
+ #------------------------------------------------------------ |
1886 |
+ |
1887 |
+ my %properties = (); |
1888 |
+ $properties{'type'} = 'ddhost'; |
1889 |
+ $properties{'dns'} = $dns; |
1890 |
+ $properties{'login'} = $domainLogin; |
1891 |
+ $properties{'password'} = $domainPassword; |
1892 |
+ $properties{'mx'} = $domainMX; |
1893 |
+ $properties{'desc'} = $domainDesc; |
1894 |
+ $properties{'customdns'} = $customDNS; |
1895 |
+ $properties{'customprotocol'} = $customPROTOCOL; |
1896 |
+ $edb->new_record( $domainName, \%properties ); |
1897 |
+ |
1898 |
+ system( "/sbin/e-smith/signal-event", "ddclient" ); |
1899 |
+ return "ok"; |
1900 |
+ |
1901 |
+} |
1902 |
+ |
1903 |
+sub performModifyDomain { |
1904 |
+ my $c = shift; |
1905 |
+ |
1906 |
+ #------------------------------------------------------------ |
1907 |
+ # Validate parameters and untaint them |
1908 |
+ #------------------------------------------------------------ |
1909 |
+ |
1910 |
+ my $domainName = $c->param('domainName'); |
1911 |
+ if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
1912 |
+ $domainName = $1; |
1913 |
+ } |
1914 |
+ else { |
1915 |
+ return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName ); |
1916 |
+ } |
1917 |
+ |
1918 |
+ my $domainLogin = $c->param('login'); |
1919 |
+ if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { |
1920 |
+ $domainLogin = $1; |
1921 |
+ } |
1922 |
+ else { |
1923 |
+ return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin ); |
1924 |
+ } |
1925 |
+ |
1926 |
+ my $domainPassword = $c->param('password'); |
1927 |
+ if ( $domainPassword =~ /^(.*)$/ ) { |
1928 |
+ $domainPassword = $1; |
1929 |
+ } |
1930 |
+ else { |
1931 |
+ return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword ); |
1932 |
+ } |
1933 |
+ |
1934 |
+ my $domainMX = $c->param('mx'); |
1935 |
+ my $customDNS = $c->param('customdns'); |
1936 |
+ my $customPROTOCOL = $c->param('customprotocol'); |
1937 |
+ |
1938 |
+ my $dns = $c->param('dns'); |
1939 |
+ if ( $dns eq 'CUSTOMDNS' ) { |
1940 |
+ if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
1941 |
+ $customDNS = $1; |
1942 |
+ } |
1943 |
+ else |
1944 |
+ |
1945 |
+ { |
1946 |
+ return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName ); |
1947 |
+ } |
1948 |
+ } |
1949 |
+ |
1950 |
+ #------------------------------------------------------------ |
1951 |
+ # Looks good. Find out if this domain has been taken |
1952 |
+ # or if the domain is a reserved to provide a secured webserver |
1953 |
+ # for a previous domain |
1954 |
+ #------------------------------------------------------------ |
1955 |
+ # my $dns = $c->param ('dns'); |
1956 |
+ |
1957 |
+ my $dom = $domaindb->get($domainName); |
1958 |
+ |
1959 |
+ $dom->set_prop( 'dns' => $dns ); |
1960 |
+ $dom->set_prop( 'login' => $domainLogin ); |
1961 |
+ $dom->set_prop( 'password' => $domainPassword ); |
1962 |
+ $dom->set_prop( 'mx' => $domainMX ); |
1963 |
+ $dom->set_prop( 'customdns' => $customDNS ); |
1964 |
+ $dom->set_prop( 'customprotocol' => $customPROTOCOL ); |
1965 |
+ |
1966 |
+ $domaindb->reload(); |
1967 |
+ |
1968 |
+ system( "/sbin/e-smith/signal-event", "ddclient" ); |
1969 |
+ return "ok"; |
1970 |
+} |
1971 |
+ |
1972 |
+sub performModifyCustom { |
1973 |
+ my $c = shift; |
1974 |
+ |
1975 |
+ #------------------------------------------------------------ |
1976 |
+ # Validate parameters and untaint them |
1977 |
+ #------------------------------------------------------------ |
1978 |
+ |
1979 |
+ my $domainName = $c->param('domainName'); |
1980 |
+ if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
1981 |
+ $domainName = $1; |
1982 |
+ } |
1983 |
+ else { |
1984 |
+ return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName ); |
1985 |
+ } |
1986 |
+ |
1987 |
+ my $domainLogin = $c->param('login'); |
1988 |
+ if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { |
1989 |
+ $domainLogin = $1; |
1990 |
+ } |
1991 |
+ else { |
1992 |
+ return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin ); |
1993 |
+ } |
1994 |
+ |
1995 |
+ my $domainPassword = $c->param('password'); |
1996 |
+ if ( $domainPassword =~ /^(.*)$/ ) { |
1997 |
+ $domainPassword = $1; |
1998 |
+ } |
1999 |
+ else { |
2000 |
+ return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword ); |
2001 |
+ } |
2002 |
+ |
2003 |
+ my $domainMX = $c->param('mx'); |
2004 |
+ my $customDNS = $c->param('customdns'); |
2005 |
+ my $customPROTOCOL = $c->param('customprotocol'); |
2006 |
+ |
2007 |
+ my $dns = $c->param('dns'); |
2008 |
+ if ( $dns eq 'CUSTOMDNS' ) { |
2009 |
+ if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { |
2010 |
+ $customDNS = $1; |
2011 |
+ } |
2012 |
+ else |
2013 |
+ |
2014 |
+ { |
2015 |
+ return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName ); |
2016 |
+ } |
2017 |
+ } |
2018 |
+ |
2019 |
+ #------------------------------------------------------------ |
2020 |
+ # Looks good. Find out if this domain has been taken |
2021 |
+ # or if the domain is a reserved to provide a secured webserver |
2022 |
+ # for a previous domain |
2023 |
+ #------------------------------------------------------------ |
2024 |
+ # my $dns = $c->param ('dns'); |
2025 |
+ |
2026 |
+ my $dom = $edb->get($domainName); |
2027 |
+ |
2028 |
+ $dom->set_prop( 'dns' => $dns ); |
2029 |
+ $dom->set_prop( 'login' => $domainLogin ); |
2030 |
+ $dom->set_prop( 'password' => $domainPassword ); |
2031 |
+ $dom->set_prop( 'mx' => $domainMX ); |
2032 |
+ $dom->set_prop( 'customdns' => $customDNS ); |
2033 |
+ $dom->set_prop( 'customprotocol' => $customPROTOCOL ); |
2034 |
+ |
2035 |
+ $domaindb->reload(); |
2036 |
+ |
2037 |
+ system( "/sbin/e-smith/signal-event", "ddclient" ); |
2038 |
+ return "ok"; |
2039 |
+} |
2040 |
+ |
2041 |
+1; |
2042 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm smeserver-ddclient-1.2.1/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm |
2043 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 1970-01-01 01:00:00.000000000 +0100 |
2044 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 2020-06-08 18:18:00.000000000 +0100 |
2045 |
@@ -0,0 +1,97 @@ |
2046 |
+package SrvMngr::I18N::Modules::Ddclient::en; |
2047 |
+use strict; |
2048 |
+use warnings; |
2049 |
+use utf8; |
2050 |
+use Mojo::Base 'SrvMngr::I18N'; |
2051 |
+ |
2052 |
+use SrvMngr::I18N::Modules::General::en; |
2053 |
+ |
2054 |
+my %lexicon = ( |
2055 |
+'ddc_FORM_TITLE' => 'Create, remove or change the publication of virtual domains', |
2056 |
+'ddc_Params_for_IP_Retrieval'=>' Parameters to control how the IP of your server is found:', |
2057 |
+'ddc_DESCRIPTION'=> 'Use this contrib when you have a sme server connected to a ISP service using a dynamic IP, and you wish to host multiple domains. |
2058 |
+<br>ddclient is a client for updating dynamic DNS entries for domains hosted at different DNS providers. |
2059 |
+<br>Configure your dynamic host domains via the ddclient server manager panel. |
2060 |
+<br>ddclient can be used on servers configured in server gateway mode or in server only mode.<br><br> ', |
2061 |
+'ddc_FORM_DESCRIPTION' => 'Virtual Domains for publication on the net:', |
2062 |
+'ddc_NO_VIRTUAL_DOMAINS' => 'There are no virtual domains in the system.', |
2063 |
+'ddc_CURRENT_LIST_OF_DOMAINS' => 'Current list of virtual domains', |
2064 |
+'ddc_PUBLICATION' => 'Publication', |
2065 |
+'ddc_PRIMARY_SITE' => 'Primary Site', |
2066 |
+'ddc_CONTENT' => '[_1] i-bay', |
2067 |
+'ddc_CREATE_TITLE' => 'Create a new publication virtual domain', |
2068 |
+'ddc_SERVERS_LABEL' => 'Where to publish', |
2069 |
+'ddc_MX' => 'record MX', |
2070 |
+'ddc_NAME_LABEL' => 'Login to publish', |
2071 |
+'ddc_PASSWORD_LABEL' => 'Password to publish', |
2072 |
+'ddc_CONTENT_FIELD_DESCRIPTION' => 'For the web site, you may choose your primary web site or any i-bay as the content.', |
2073 |
+'ddc_DOMAIN_NAME_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain name [_1]. The domain name should contain one or more letters, numbers, periods and minus signs. Did not create new domain.', |
2074 |
+'ddc_DOMAIN_DESCRIPTION_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain description [_1]. Did not create new domain.', |
2075 |
+'ddc_DOMAIN_IN_USE_ERROR' => 'Error: domain [_1] is already in use. Did not create new domain.', |
2076 |
+'ddc_DOMAIN_LOGIN_VALIDATION_ERROR'=> 'Domain login must not be blank and only consist of letter, numbers, "." or "@"', |
2077 |
+'ddc_RESERVED_SECURE_DOMAIN_ERROR' => 'Error: domain [_1] is reserved to provide a secured webserver for the virtual domain [_2]. Did not create new domain.', |
2078 |
+'ddc_SYSTEM_DOMAIN_ERROR' => 'Error: domain [_1] is your system domain name. You cannot have a virtual domain with the same name. Did not create new domain.', |
2079 |
+'ddc_RESERVED_SECURE_SYSTEM_DOMAIN_ERROR' => 'Error: domain [_1] is reserved to provide a secured webserver for your system domain name [_2]. Did not create new domain.', |
2080 |
+'ddc_SUCCESSFULLY_CREATED' => 'Successfully publication domain [_1] on [_2].', |
2081 |
+'ddc_MODIFY_TITLE' => 'Modify virtual domain', |
2082 |
+'ddc_NONEXISTENT_DOMAIN_ERROR' => 'Error: [_1] is not an existing domain.', |
2083 |
+'ddc_SUCCESSFULLY_MODIFIED' => 'Successfully modified the publication [_1] on [_2].', |
2084 |
+'ddc_REMOVE_TITLE' => 'Remove publication of virtual domain', |
2085 |
+'ddc_REMOVE_DESCRIPTION' => '<p>You are about to remove the publication of domain [_1] ([_2]) on [_3]. |
2086 |
+</p> |
2087 |
+<p> |
2088 |
+<b>Are you sure you wish to remove this domain\'s publication ?</b> |
2089 |
+</p> |
2090 |
+', |
2091 |
+'ddc_ERROR_WHILE_REMOVING_DOMAIN' => 'Error: internal failure while removing publication of [_1].', |
2092 |
+'ddc_SUCCESSFULLY_DELETED' => 'Successfully deleted publication of [_1] on [_2].', |
2093 |
+'ddc_DYNDNS1' => 'dyndns.org dynamic addresses', |
2094 |
+'ddc_DYNDNS2' => 'dyndns.org static addresses', |
2095 |
+'ddc_DYNDNS3' => 'dyndns.org custom addresses', |
2096 |
+'ddc_ZONEDIT' => 'ZoneEdit (zoneedit.com)', |
2097 |
+'ddc_EASYDNS' => 'EasyDNS (easydns.com)', |
2098 |
+'ddc_HAMMER' => 'Hammernode (hn.org) dynamic addresses', |
2099 |
+'ddc_DSLREPORTS' => 'dslreports.com dynamic-host monitoring', |
2100 |
+'ddc_EURODYNDNS' => 'eurodyndns.org dynamic addresses', |
2101 |
+'ddc_DTDNS' => 'DtDNS (www.dtdns.com) dynamic addresses', |
2102 |
+'ddc_LOOPIA' => 'Loopia (loopia.se) dynamic addresses', |
2103 |
+'ddc_DNSPARK' => ' Dnspark (dnspark.com) dynamic addresses', |
2104 |
+'ddc_DYNHOST' => ' DynHost (ovh.com) dynamic addresses', |
2105 |
+'ddc_NOIP' => ' NoIP (noip.com) dynamic addresses', |
2106 |
+'ddc_CHANGEIP' => ' ChangeIP (changeip.com) dynamic addresses', |
2107 |
+'ddc_NAMECHEAP' => ' NAMECHEAP (namecheap.com) dynamic addresses', |
2108 |
+'ddc_SPDNS' => ' SPDNS (spdns.de) dynamic addresses', |
2109 |
+'ddc_CUSTOMDNS' => 'Custom Dynamic DNS Provider', |
2110 |
+'ddc_CUSTOMDNS_LABEL' => 'Custom server Address', |
2111 |
+'ddc_CUSTOM_PROTOCOL_LABEL' => 'Custom ddclient Protocol', |
2112 |
+'ddc_CUSTOM_DESCRIPTION' => 'You can use a custom dynamic dns provider if yours is not in the published list. Please fill the custom fields with the appropriate settings', |
2113 |
+'ddc_CUSTOMDNS_VALIDATION_ERROR' => 'Error: unexpected or missing characters in custom server address field of domain [_1]. The server address should contain one or more letters, numbers, periods and minus signs. Did not apply the change.', |
2114 |
+'ddc_ddclient' =>'Dynamic Clients', |
2115 |
+'ddc_DOMAIN_NAME_ALREADY_EXIST' => 'Error: this domain:"[_1]" already exists. Please chose another.', |
2116 |
+'ddc_FREE_FORM_DESCRIPTION' => 'Here you can create any domain name to publish over the net:', |
2117 |
+'ddc_RETRIEVE_SSL' => 'SSL update', |
2118 |
+'ddc_RETRIEVE_DEAMONUPDATE' => 'Deamon update (seconds)', |
2119 |
+'ddc_RETRIEVE_URLCHECKIP' => 'Url for the external IP', |
2120 |
+'ddc_APPLY' => 'Save', |
2121 |
+'ddc_DOMAIN_NAME_LABEL' => 'Domain Name', |
2122 |
+'ddc_DESCRIPTION_LABEL' => 'Domain description', |
2123 |
+'ddc_SUCCESSFULLY_MODIFIED_RETRIEVE_IP' => 'You have successfully modified the retrieve IP options.', |
2124 |
+'ddc_RETRIEVE_METHOD' => 'Method to retrieve new IP:', |
2125 |
+'ddc_RETRIEVE_IF' => 'Local interface to get new IP, if selected interface method', |
2126 |
+'ddc_RETRIEVE_CMD' => 'Command to execute to get IP, if selected command method', |
2127 |
+'ddc_SME external Interface' => 'SME external interface', |
2128 |
+'ddc_SME configuration DB' => 'SME configuration DB', |
2129 |
+'ddc_web' => 'Web query', |
2130 |
+'ddc_Interface' => 'IP from interface', |
2131 |
+'ddc_IP' => 'Manual IP setting', |
2132 |
+'ddc_Command' => 'Command to execute', |
2133 |
+'ddc_RETRIEVE_IP' => 'IP to manually force' |
2134 |
+); |
2135 |
+ |
2136 |
+our %Lexicon = ( |
2137 |
+ %{ SrvMngr::I18N::Modules::General::en::Lexicon }, |
2138 |
+ %lexicon |
2139 |
+); |
2140 |
+ |
2141 |
+ |
2142 |
+1; |
2143 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/ddclient.html.ep smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/ddclient.html.ep |
2144 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/ddclient.html.ep 1970-01-01 01:00:00.000000000 +0100 |
2145 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/ddclient.html.ep 2020-06-08 18:18:00.000000000 +0100 |
2146 |
@@ -0,0 +1,48 @@ |
2147 |
+% layout 'default', title => "Sme server 2 - Dynamic Clients", share_dir => './'; |
2148 |
+ |
2149 |
+% content_for 'module' => begin |
2150 |
+<div id="module"> |
2151 |
+ |
2152 |
+ % if ($config->{debug} == 1) { |
2153 |
+ <p> |
2154 |
+ %= dumper $c->current_route |
2155 |
+ </p> |
2156 |
+ % } |
2157 |
+ |
2158 |
+ <h1><%=$title%></h1> |
2159 |
+ %= $modul |
2160 |
+ |
2161 |
+ %if ($ddc_datas->{first}) { |
2162 |
+ <br><p> |
2163 |
+ %=$c->render_to_string(inline =>$c->l($ddc_datas->{first})) |
2164 |
+ </p> |
2165 |
+ |
2166 |
+ %} elsif ($ddc_datas->{success}) { |
2167 |
+ <div class='sme-border'> |
2168 |
+ <h2> Operation Status Report</h2><p> |
2169 |
+ %= $c->l($ddc_datas->{success}); |
2170 |
+ </p> |
2171 |
+ </div> |
2172 |
+ |
2173 |
+ %} elsif ($ddc_datas->{error}) { |
2174 |
+ <div class='sme-error'> |
2175 |
+ <h2> Operation Status Report - error</h2><p> |
2176 |
+ %= $c->l($ddc_datas->{error}); |
2177 |
+ </p> |
2178 |
+ </div> |
2179 |
+ %} |
2180 |
+ |
2181 |
+ % if ($ddc_datas->{trt} eq 'NEW') { |
2182 |
+ %= include 'partials/_ddc_create_cust' |
2183 |
+ %} elsif ($ddc_datas->{trt} eq 'DEL') { |
2184 |
+ %= include 'partials/_ddc_del' |
2185 |
+ %} elsif ($ddc_datas->{trt} eq 'MOD') { |
2186 |
+ %= include 'partials/_ddc_modify_domain' |
2187 |
+ %} else { #LIST |
2188 |
+ %= include 'partials/_ddc_paramlist' |
2189 |
+ %= include 'partials/_ddc_domainlist' |
2190 |
+ %= include 'partials/_ddc_customlist' |
2191 |
+ %} |
2192 |
+ |
2193 |
+</div> |
2194 |
+%end |
2195 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep |
2196 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep 1970-01-01 01:00:00.000000000 +0100 |
2197 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep 2020-06-08 18:18:00.000000000 +0100 |
2198 |
@@ -0,0 +1,63 @@ |
2199 |
+<div id='ddc_createcustom'> |
2200 |
+ <h2> |
2201 |
+ %= l 'ddc_CUSTOM_DESCRIPTION' |
2202 |
+ </h2><br> |
2203 |
+ % my $btn = l('ddc_APPLY'); |
2204 |
+ %= form_for '/ddclient7' => (method => 'POST') => begin |
2205 |
+ <span class=label> |
2206 |
+ %=l 'ddc_DOMAIN_NAME_LABEL' |
2207 |
+ </span><span class=data> |
2208 |
+ %=text_field 'domainName' |
2209 |
+ </span><br> |
2210 |
+ <span class=label> |
2211 |
+ %=l 'ddc_DESCRIPTION_LABEL' |
2212 |
+ </span><span class=data> |
2213 |
+ %=text_field 'desc' |
2214 |
+ </span><br> |
2215 |
+ <span class=label> |
2216 |
+ %=l 'ddc_SERVERS_LABEL' |
2217 |
+ </span><span class=data> |
2218 |
+ %=select_field dns=>$dnslabels |
2219 |
+ </span><br> |
2220 |
+ <span class=label> |
2221 |
+ %=l 'ddc_CUSTOMDNS_LABEL' |
2222 |
+ </span><span class=data> |
2223 |
+ %=text_field 'customdns' |
2224 |
+ </span><br> |
2225 |
+ <span class=label> |
2226 |
+ %=l 'ddc_CUSTOM_PROTOCOL_LABEL' |
2227 |
+ </span><span class=data> |
2228 |
+ %=text_field 'customprotocol' |
2229 |
+ </span><br> |
2230 |
+ <span class=label> |
2231 |
+ %=l 'ddc_NAME_LABEL' |
2232 |
+ </span><span class=data> |
2233 |
+ %=text_field 'login' |
2234 |
+ </span><br> |
2235 |
+ <span class=label> |
2236 |
+ %=l 'ddc_PASSWORD_LABEL' |
2237 |
+ </span><span class=data> |
2238 |
+ %=password_field 'password',id=>"ddcPass" |
2239 |
+ %=label_for show=>"Show" |
2240 |
+ %=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;" |
2241 |
+ %= javascript begin |
2242 |
+ function showPass() { |
2243 |
+ var x = document.getElementById("ddcPass"); |
2244 |
+ if (x.type === "password") { |
2245 |
+ x.type = "text"; |
2246 |
+ } else { |
2247 |
+ x.type = "password"; |
2248 |
+ } |
2249 |
+ } |
2250 |
+ % end |
2251 |
+ </span><br> |
2252 |
+ <span class=label> |
2253 |
+ %=l 'ddc_MX' |
2254 |
+ </span><span class=data> |
2255 |
+ %=text_field 'mx' |
2256 |
+ </span><br> |
2257 |
+ %= submit_button "$btn", class => 'action' |
2258 |
+ % end |
2259 |
+</div> |
2260 |
+ |
2261 |
+ |
2262 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_customlist.html.ep smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_customlist.html.ep |
2263 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_customlist.html.ep 1970-01-01 01:00:00.000000000 +0100 |
2264 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_customlist.html.ep 2020-06-11 08:46:00.000000000 +0100 |
2265 |
@@ -0,0 +1,50 @@ |
2266 |
+<div id='ddc_customlist'> |
2267 |
+ <h2> |
2268 |
+ %= l 'ddc_FREE_FORM_DESCRIPTION' |
2269 |
+ </h2> |
2270 |
+ |
2271 |
+ %= form_for '/ddclient' => (method => 'POST') => begin |
2272 |
+ |
2273 |
+ <table class="sme-border"><tbody> |
2274 |
+ <tr> |
2275 |
+ <th class='sme-border'> |
2276 |
+ %=l 'ddc_DOMAIN_NAME_LABEL' |
2277 |
+ </th> |
2278 |
+ <th class='sme-border'> |
2279 |
+ %=l 'ddc_DESCRIPTION_LABEL' |
2280 |
+ </th> |
2281 |
+ <th class='sme-border'> |
2282 |
+ %=l 'ddc_PUBLICATION' |
2283 |
+ </th> |
2284 |
+ <th class='sme-border' colspan=2> |
2285 |
+ %=l 'ACTION' |
2286 |
+ </th> |
2287 |
+ </tr> |
2288 |
+ %if (!$emptycust){ |
2289 |
+ % foreach my $freeDomain (@$freedomains) { |
2290 |
+ <tr> |
2291 |
+ %= t td => (class => 'sme-border') => $freeDomain->{"Domain"} |
2292 |
+ %= t td => (class => 'sme-border') => $freeDomain->{"Description"} |
2293 |
+ %= t td => (class => 'sme-border') => $freeDomain->{"Publication"} |
2294 |
+ <td class = 'sme-border'> |
2295 |
+ <a href='/smanager/ddclient2?trt=MOD&Domain=<%= $freeDomain->{"Domain"}%>'><%=l 'MODIFY'%></a> |
2296 |
+ </td><td class = 'sme-border'> |
2297 |
+ <a href='/smanager/ddclient2?trt=DEL&Domain=<%= $freeDomain->{"Domain"}%>'><%=l 'REMOVE'%></a> |
2298 |
+ </td> |
2299 |
+ </td> |
2300 |
+ </tr> |
2301 |
+ %} |
2302 |
+ %} |
2303 |
+ <tr><td class='sme-border'></td> |
2304 |
+ <td class='sme-border'></td> |
2305 |
+ <td class='sme-border'> </td> |
2306 |
+ <td class='sme-border'> </td> |
2307 |
+ <td class='sme-border'> |
2308 |
+ <a href="/smanager/ddclient6?trt=NEW"><%=l 'CREATE'%></a> |
2309 |
+ </td> |
2310 |
+ </tr> |
2311 |
+ |
2312 |
+ </tbody> |
2313 |
+ </table> |
2314 |
+ % end |
2315 |
+</div> |
2316 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_del.html.ep smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_del.html.ep |
2317 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_del.html.ep 1970-01-01 01:00:00.000000000 +0100 |
2318 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_del.html.ep 2020-06-08 18:18:00.000000000 +0100 |
2319 |
@@ -0,0 +1,14 @@ |
2320 |
+<div id='ddc_del'> |
2321 |
+ % my $btn = l('REMOVE'); |
2322 |
+ %= form_for '/ddclient4' => (method => 'POST') => begin |
2323 |
+ <p> |
2324 |
+ %= $c->render_to_string(inline =>l("ddc_REMOVE_DESCRIPTION",$ddc_datas->{"Domain_details"}->{"Domain"},$ddc_datas->{"Domain_details"}->{"Description"},$c->l($ddc_datas->{"Domain_details"}->{"Publication"}))) |
2325 |
+ </p> |
2326 |
+ % param Domain=>$ddc_datas->{"Domain_details"}->{"Domain"}; |
2327 |
+ %= hidden_field Domain=>$ddc_datas->{"Domain_details"}->{"Domain"} |
2328 |
+ %= hidden_field Route=>$c->current_route |
2329 |
+ %= hidden_field dns=>$ddc_datas->{"Domain_details"}->{"dns"} |
2330 |
+ %= hidden_field trt=>"DEL" |
2331 |
+ %= submit_button "$btn", class => 'action' |
2332 |
+ % end |
2333 |
+</div> |
2334 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_domainlist.html.ep smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_domainlist.html.ep |
2335 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_domainlist.html.ep 1970-01-01 01:00:00.000000000 +0100 |
2336 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_domainlist.html.ep 2020-06-11 08:46:00.000000000 +0100 |
2337 |
@@ -0,0 +1,48 @@ |
2338 |
+<div id='ddc_Domainslist'> |
2339 |
+ <h2> |
2340 |
+ %= l 'ddc_FORM_DESCRIPTION' |
2341 |
+ </h2> |
2342 |
+ %= form_for '/ddclient' => (method => 'POST') => begin |
2343 |
+ |
2344 |
+ % if ($emptydom){ |
2345 |
+ <br><h2> |
2346 |
+ %=l 'NO_VIRTUAL_DomainS' |
2347 |
+ <h2> |
2348 |
+ % } else { |
2349 |
+ <table class="sme-border"><tbody> |
2350 |
+ <tr> |
2351 |
+ <th class='sme-border'> |
2352 |
+ %=l 'ddc_DOMAIN_NAME_LABEL' |
2353 |
+ </th> |
2354 |
+ <th class='sme-border'> |
2355 |
+ %=l 'ddc_DESCRIPTION_LABEL' |
2356 |
+ </th> |
2357 |
+ <th class='sme-border'> |
2358 |
+ %=l('ddc_CONTENT',"") |
2359 |
+ </th> |
2360 |
+ <th class='sme-border'> |
2361 |
+ %=l 'ddc_PUBLICATION' |
2362 |
+ </th> |
2363 |
+ |
2364 |
+ <th class='sme-border' colspan=2> |
2365 |
+ %=l 'ACTION' |
2366 |
+ </th> |
2367 |
+ </tr> |
2368 |
+ % foreach my $Domain (@$domains) { |
2369 |
+ <tr> |
2370 |
+ %= t td => (class => 'sme-border') => $Domain->{"Domain"} |
2371 |
+ %= t td => (class => 'sme-border') => $Domain->{"Description"} |
2372 |
+ %= t td => (class => 'sme-border') => $Domain->{"Content"} |
2373 |
+ %= t td => (class => 'sme-border') => $Domain->{"Publication"} |
2374 |
+ <td class = 'sme-border'> |
2375 |
+ <a href="/smanager/ddclient1?trt=MOD&Domain=<%= $Domain->{"Domain"}%>"><%=l 'MODIFY'%></a> |
2376 |
+ </td><td class = 'sme-border'> |
2377 |
+ <a href="/smanager/ddclient1?trt=DEL&Domain=<%= $Domain->{"Domain"}%>"><%=l 'REMOVE'%></a> |
2378 |
+ </td> |
2379 |
+ </tr> |
2380 |
+ %} |
2381 |
+ </tbody> |
2382 |
+ </table> |
2383 |
+ %} |
2384 |
+ % end |
2385 |
+</div> |
2386 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_modify_domain.html.ep smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_modify_domain.html.ep |
2387 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_modify_domain.html.ep 1970-01-01 01:00:00.000000000 +0100 |
2388 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_modify_domain.html.ep 2020-06-08 18:18:00.000000000 +0100 |
2389 |
@@ -0,0 +1,77 @@ |
2390 |
+<div id='ddc_modifydomain'> |
2391 |
+ <h2> |
2392 |
+ %= l 'ddc_CUSTOM_DESCRIPTION' |
2393 |
+ </h2><br> |
2394 |
+ % my $btn = l('ddc_APPLY'); |
2395 |
+ %= form_for '/ddclient8' => (method => 'POST') => begin |
2396 |
+ <span class=label> |
2397 |
+ %=l 'ddc_DOMAIN_NAME_LABEL' |
2398 |
+ </span><span class=data> |
2399 |
+ %= hidden_field domainName => $ddc_datas->{"Domain_details"}->{"Domain"} |
2400 |
+ %= $ddc_datas->{"Domain_details"}->{"Domain"} |
2401 |
+ </span><br><br> |
2402 |
+ <span class=label> |
2403 |
+ %=l 'ddc_DESCRIPTION_LABEL' |
2404 |
+ </span><span class=data> |
2405 |
+ %= $ddc_datas->{"Domain_details"}->{"Description"} |
2406 |
+ </span><br><br> |
2407 |
+ <span class=label> |
2408 |
+ %= $ddc_datas->{"Domain_details"}->{"Content"} |
2409 |
+ </span><span class=data> |
2410 |
+ %= $ddc_datas->{"Domain_details"}->{"Content"} |
2411 |
+ </span><br><br> |
2412 |
+ <span class=label> |
2413 |
+ %=l 'ddc_SERVERS_LABEL' |
2414 |
+ </span><span class=data> |
2415 |
+ % param dns=>$ddc_datas->{"Domain_details"}->{"dns"}; |
2416 |
+ %=select_field dns=>$dnslabels |
2417 |
+ </span><br> |
2418 |
+ <span class=label> |
2419 |
+ %=l 'ddc_CUSTOMDNS_LABEL' |
2420 |
+ </span><span class=data> |
2421 |
+ % param customdns=>$ddc_datas->{"Domain_details"}->{"customdns"}; |
2422 |
+ %=text_field 'customdns' |
2423 |
+ </span><br> |
2424 |
+ <span class=label> |
2425 |
+ %=l 'ddc_CUSTOM_PROTOCOL_LABEL' |
2426 |
+ </span><span class=data> |
2427 |
+ % param customprotocol=>$ddc_datas->{"Domain_details"}->{"customprotocol"}; |
2428 |
+ %=text_field 'customprotocol' |
2429 |
+ </span><br> |
2430 |
+ <span class=label> |
2431 |
+ %=l 'ddc_NAME_LABEL' |
2432 |
+ </span><span class=data> |
2433 |
+ % param login=>$ddc_datas->{"Domain_details"}->{"login"}; |
2434 |
+ %=text_field 'login' |
2435 |
+ </span><br> |
2436 |
+ <span class=label> |
2437 |
+ %=l 'ddc_PASSWORD_LABEL' |
2438 |
+ </span><span class=data> |
2439 |
+ % param password=>$ddc_datas->{"Domain_details"}->{"password"}; |
2440 |
+ %=password_field 'password',id=>"ddcPass",value=>$ddc_datas->{"Domain_details"}->{"password"} |
2441 |
+ %=label_for show=>"Show" |
2442 |
+ %=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;" |
2443 |
+ %= javascript begin |
2444 |
+ function showPass() { |
2445 |
+ var x = document.getElementById("ddcPass"); |
2446 |
+ if (x.type === "password") { |
2447 |
+ x.type = "text"; |
2448 |
+ } else { |
2449 |
+ x.type = "password"; |
2450 |
+ } |
2451 |
+ } |
2452 |
+ % end |
2453 |
+ </span><br> |
2454 |
+ <span class=label> |
2455 |
+ %=l 'ddc_MX' |
2456 |
+ </span><span class=data> |
2457 |
+ % param mx=>$ddc_datas->{"Domain_details"}->{"mx"}; |
2458 |
+ %=text_field 'mx' |
2459 |
+ </span><br> |
2460 |
+ %= hidden_field trt=>"MOD" |
2461 |
+ %= hidden_field Route=>$c->current_route |
2462 |
+ %= submit_button "$btn", class => 'action' |
2463 |
+ % end |
2464 |
+</div> |
2465 |
+ |
2466 |
+ |
2467 |
diff -urN smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep |
2468 |
--- smeserver-ddclient-1.2.1.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep 1970-01-01 01:00:00.000000000 +0100 |
2469 |
+++ smeserver-ddclient-1.2.1/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep 2020-06-08 18:18:00.000000000 +0100 |
2470 |
@@ -0,0 +1,52 @@ |
2471 |
+<div id='ddc_paramlist'> |
2472 |
+ <h2> |
2473 |
+ %= l 'ddc_Params_for_IP_Retrieval' |
2474 |
+ </h2> |
2475 |
+ % my $btn = l('ddc_APPLY'); |
2476 |
+ %= form_for '/ddclient3' => (method => 'POST') => begin |
2477 |
+ <span class=label> |
2478 |
+ %=l 'ddc_RETRIEVE_SSL' |
2479 |
+ </span><span class=data> |
2480 |
+ % param retrievessl=>$ddc_datas->{"params"}->{"ssl"}; |
2481 |
+ %=select_field retrievessl=>[['Yes'=>'yes'],['No'=>'no']] |
2482 |
+ </span><br> |
2483 |
+ <span class=label> |
2484 |
+ %=l 'ddc_RETRIEVE_DEAMONUPDATE' |
2485 |
+ </span><span class=data> |
2486 |
+ % param retrievedeamonupdate=>$ddc_datas->{"params"}->{"DeamonUpdate"}; |
2487 |
+ %=number_field 'retrievedeamonupdate',min=>0 |
2488 |
+ </span><br> |
2489 |
+ <span class=label> |
2490 |
+ %=l 'ddc_RETRIEVE_METHOD' |
2491 |
+ </span><span class=data> |
2492 |
+ % param retrievemethod=>$ddc_datas->{"params"}->{"method"}; |
2493 |
+ %=select_field retrievemethod=>$methodlabels |
2494 |
+ </span><br> |
2495 |
+ <span class=label> |
2496 |
+ %=l 'ddc_RETRIEVE_IF' |
2497 |
+ </span><span class=data> |
2498 |
+ % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"}; |
2499 |
+ %=text_field 'retrieveinterface' |
2500 |
+ </span><br> |
2501 |
+ <span class=label> |
2502 |
+ %=l 'ddc_RETRIEVE_CMD' |
2503 |
+ </span><span class=data> |
2504 |
+ % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"}; |
2505 |
+ %=text_field 'retrievecmd' |
2506 |
+ </span><br> |
2507 |
+ <span class=label> |
2508 |
+ %=l 'ddc_RETRIEVE_IP' |
2509 |
+ </span><span class=data> |
2510 |
+ % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"}; |
2511 |
+ %=text_field 'retrieveip' |
2512 |
+ </span><br> |
2513 |
+ <span class=label> |
2514 |
+ %=l 'ddc_RETRIEVE_URLCHECKIP' |
2515 |
+ </span><span class=data> |
2516 |
+ % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"}; |
2517 |
+ %=text_field 'retrieveurlcheckip' |
2518 |
+ </span><br> |
2519 |
+ |
2520 |
+ %= submit_button "$btn", class => 'action' |
2521 |
+ % end |
2522 |
+</div> |