Code Duplication    Length = 29-30 lines in 2 locations

htdocs/search.php 2 locations

@@ 655-683 (lines=29) @@
652
                     WHERE `loc_id`='&1' AND coord_type=200100000",
653
                    $locid
654
                );
655
                if (isset($rs) && $r = sql_fetch_array($rs)) {
656
                    // ok ... wir haben koordinaten ...
657
                    $lat = $r['lat'] + 0;
658
                    $lon = $r['lon'] + 0;
659
                    sql_free_result($rs);
660
661
                    $lon_rad = $lon * 3.14159 / 180;
662
                    $lat_rad = $lat * 3.14159 / 180;
663
664
                    if (isset($options['distance'])) {
665
                        $distance = $options['distance'];
666
                    } else {
667
                        $distance = DEFAULT_SEARCH_DISTANCE;
668
                    }
669
                    if (isset($options['unit'])) {
670
                        $distance_unit = $options['unit'];
671
                    } else {
672
                        $distance_unit = DEFAULT_DISTANCE_UNIT;
673
                    }
674
675
                    sqlStringbySearchradius($distance, $lat, $lon, $multiplier, $distance_unit);
676
                } else {
677
                    if (isset($rs)) {
678
                        sql_free_result($rs);
679
                    }
680
                    $options['error_locidnocoords'] = true;
681
                    outputSearchForm($options);
682
                    exit;
683
                }
684
            } else {
685
                if ($options['searchtype'] == 'byort') {
686
                    if ($locid == 0) {
@@ 845-874 (lines=30) @@
842
                        "SELECT `lon`, `lat` FROM `gns_locations` WHERE `uni`='&1' LIMIT 1",
843
                        $locid
844
                    );
845
                    if (isset($rs) && $r = sql_fetch_array($rs)) {
846
                        // ok ... wir haben koordinaten ...
847
848
                        $lat = $r['lat'] + 0;
849
                        $lon = $r['lon'] + 0;
850
                        sql_free_result($rs);
851
852
                        $lon_rad = $lon * 3.14159 / 180;
853
                        $lat_rad = $lat * 3.14159 / 180;
854
855
                        if (isset($options['distance'])) {
856
                            $distance = $options['distance'];
857
                        } else {
858
                            $distance = DEFAULT_SEARCH_DISTANCE;
859
                        }
860
                        if (isset($options['unit'])) {
861
                            $distance_unit = $options['unit'];
862
                        } else {
863
                            $distance_unit = DEFAULT_DISTANCE_UNIT;
864
                        }
865
866
                        sqlStringbySearchradius($distance, $lat, $lon, $multiplier, $distance_unit);
867
                    } else {
868
                        if (isset($rs)) {
869
                            sql_free_result($rs);
870
                        }
871
                        $options['error_locidnocoords'] = true;
872
                        outputSearchForm($options);
873
                        exit;
874
                    }
875
                }
876
            }
877
        } elseif ($options['searchtype'] == 'bywaypoint') {