/[smecontribs]/rpms/smeserver-xt_geoip/contribs9/smeserver-xt_geoip-1.0.1-bz10760-per_serv2.patch
ViewVC logotype

Diff of /rpms/smeserver-xt_geoip/contribs9/smeserver-xt_geoip-1.0.1-bz10760-per_serv2.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.2 by jpp, Tue Jul 23 02:00:08 2019 UTC Revision 1.3 by jpp, Tue Jul 23 22:45:49 2019 UTC
# Line 326  diff -Nur smeserver-xt_geoip-1.0.1.old/r Line 326  diff -Nur smeserver-xt_geoip-1.0.1.old/r
326              <label>LABEL_SERV_BADCOUNTRIES_STATUS</label>              <label>LABEL_SERV_BADCOUNTRIES_STATUS</label>
327          </field>          </field>
328    
329    diff -Nur smeserver-xt_geoip-1.0.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm smeserver-xt_geoip-1.0.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm
330    --- smeserver-xt_geoip-1.0.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm   2019-07-24 00:42:22.094158127 +0200
331    +++ smeserver-xt_geoip-1.0.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm       2019-07-23 02:49:15.000000000 +0200
332    @@ -23,6 +23,7 @@
333         get_value
334         get_badcountries
335         get_geoip
336    +    get_reverse
337         print_service_table
338         get_stat_geoip
339         print_custom_button
340    @@ -139,7 +140,12 @@
341    
342     sub get_badcountries
343     {
344    -        return $db->get_prop("masq", "BadCountries");
345    +    my $self = shift;
346    +    my $full = shift;
347    +    my $badc=$db->get_prop("masq", "BadCountries")||"";
348    +    return $badc unless $full ;
349    +    my $rev = (($db->get_prop("masq", "XTGeoipRev")||"disabled") eq "enabled") ? "!=" : "==";
350    +    return "$rev $badc ";
351     }
352        
353     =head2 get_geoip
354    @@ -152,6 +158,20 @@
355             return $db->get_prop("masq", "GeoIP") || 'disabled';
356     }
357    
358    +=head2 get_reverse
359    +
360    +method to retrieve the value of geoip for the form
361    +=cut
362    +
363    +sub get_reverse
364    +{
365    +    my $fm   = shift;
366    +    my $item = shift;
367    +    my $prop = shift;
368    +       $item = ($item eq 'masq') ? $item : $fm->cgi->param('name');  
369    +        return $db->get_prop("$item", "$prop") || "disabled";
370    +}
371    +
372     =head2 get_stat_geoip
373    
374     method to retrieve the status of geoip for the form
375    @@ -189,15 +209,23 @@
376            
377            my $mq_bc = get_badcountries();
378            my $mq_gp = get_geoip();
379    -       my $n_mq_bc = $q->param("masq_badcountries") || $mq_bc;
380    +       my $masq = $db->get('masq') ||  "disabled";
381    +       my $mq_rv = $masq->prop('XTGeoipRev') || 'disabled';
382    +       my $mq_ot = $masq->prop('XTGeoipOther') || 'disabled';
383    +
384    +       my $n_mq_bc = $q->param("masq_badcountries");
385            my $n_mq_gp = $q->param("masq_geoip") || $mq_gp;
386            my $n_upd_gp = $q->param("update_geoip") || '';
387    -      
388    -       if (($n_mq_bc eq $mq_bc) && ($n_mq_gp eq $mq_gp) && ($n_upd_gp eq 'NO')) {
389    +        my $n_mq_rv = $q->param("masq_reverse") || $mq_rv ;
390    +       my $n_mq_ot = $q->param("masq_others") || $mq_ot ;      
391    +
392    +       if (($n_mq_bc eq $mq_bc) && ($n_mq_gp eq $mq_gp) && ($n_upd_gp eq 'NO') && ($n_mq_rv eq $mq_rv) && ($n_mq_ot eq $mq_ot)) {
393                return $self->success("NO_CHANGE")
394            }
395            $db->set_prop("masq", "BadCountries", $n_mq_bc);
396            $db->set_prop("masq", "GeoIP", $n_mq_gp);
397    +       $db->set_prop("masq", "XTGeoipRev", $n_mq_rv);
398    +       $db->set_prop("masq", "XTGeoipOther", $n_mq_ot);
399    
400            my $eventloc = "xt_geoip-modify";
401            $eventloc = "xt_geoip-update" if $n_upd_gp eq 'YES';
402    @@ -293,9 +321,13 @@
403    
404     sub get_srv_badcountries
405     {
406    -    my ($self) = @_;
407    +    my $self = shift;
408         my $name = $self->cgi->param('name');
409    -    return $db->get_prop($name, "BadCountries");
410    +    my $full = shift;
411    +    my $badc=$db->get_prop($name, "BadCountries")||"";
412    +    return $badc unless $full ;
413    +    my $rev = (($db->get_prop($name, "XTGeoipRev")||"disabled") eq "enabled") ? "!=" : "==";
414    +    return "$rev $badc ";
415     }
416    
417     sub print_service_table {
418    @@ -338,6 +370,7 @@
419             my $status = $i->prop('status');
420             my $access = $i->prop('access');
421             my $servBC = $i->prop('BadCountries') || ' ';
422    +       my $servRev = (( $i->prop('XTGeoipRev')|| 'disabled') eq 'disabled' )? '==': '!=';
423    
424             my $params = $self->build_serv_cgi_params($servname, $i->props());
425    
426    @@ -352,13 +385,15 @@
427                       . '&nbsp';
428    
429            my $color = 'red';
430    -       if ($status eq 'disabled' || $access ne 'public') { $color = 'green'; }
431    +       my $deco= "none";
432    +       if ($servRev eq '!=' ) { $color = 'green'; }
433    +        if ($status eq 'disabled' || $access ne 'public') { $color = 'grey'; $deco= "line-through"; }
434             print $q->Tr (
435                 esmith::cgi::genSmallCell($q, $servname,"normal"),
436                 esmith::cgi::genSmallCell($q, $port,"normal"),
437    -            esmith::cgi::genSmallCell($q, $status,"header"),
438    -            esmith::cgi::genSmallCell($q, $access,"header"),
439    -            esmith::cgi::genSmallCell($q, "<font color='$color'>" . $servBC . "</font>","header"),
440    +            esmith::cgi::genSmallCell($q, $status,"normal"),
441    +            esmith::cgi::genSmallCell($q, $access,"normal"),
442    +            esmith::cgi::genSmallCell($q, "<font color='$color' style='text-decoration: $deco'>" . "$servRev $servBC" . "</font>","normal"),
443                 esmith::cgi::genSmallCell($q, $actionModify,"normal"),
444                 esmith::cgi::genSmallCell($q, $actionRemove,"normal"));
445         }
446    @@ -386,7 +421,8 @@
447         if (my $serv = $db->get($name)) {
448            my $servBC = $serv->prop('BadCountries') || '';
449             if ($servBC ne '') {
450    -           $db->set_prop($name, "BadCountries", '');
451    +           my $tps = $db->set_prop_and_delete($name, "BadCountries");
452    +            $tps = $db->get_prop_and_delete($name, "XTGeoipRev");
453                 # Untaint $name before use in system()
454                 # $name =~ /(.+)/; $name = $1;
455                 if (system ("/sbin/e-smith/signal-event", "xt_geoip-service") == 0)
456    @@ -410,14 +446,17 @@
457         my $name = $self->cgi->param('name');
458         if (my $serv = $db->get($name)) {
459            my $servBC = $serv->prop('BadCountries') || '';
460    +        my $servRev = $serv->prop('XTGeoipRev') || 'disabled';
461    
462            my $q = $self->{'cgi'};
463    -       my $n_servBC = $q->param("masq_srv_badcountries") || $servBC;
464    -      
465    -       if ($n_servBC eq $servBC) {
466    +       my $n_servBC = $q->param("masq_srv_badcountries");
467    +       my $n_servRev = $q->param("masq_srv_reverse") || $servRev;
468    +
469    +       if ($n_servBC eq $servBC && $n_servRev eq  $servRev ) {
470                return $self->success("NO_CHANGE")
471            }
472            $db->set_prop($name, "BadCountries", $n_servBC);
473    +       $db->set_prop($name, "XTGeoipRev", $n_servRev);
474    
475             if (system ( "/sbin/e-smith/signal-event",  "xt_geoip-service" ) == 0 )
476            {


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed