Output Error - Navigator GPS - Javascript PHP JQuery

Output Error - Navigator GPS - Javascript PHP JQuery

CMS Redaxo 4.6

Source is a module for proximity search, and to issue coming from a database

Hello,

I get the error message JQuery not go with PHP , maybe can have someone help me.

The positioning and the query from the database with display of results within works .

If the location can not be determined , to the " Ajax Loader Big Icon " will be hidden from Line 151 and the text will be displayed on line 156 with the corresponding error code.


Thanks for help Andy


  1. <?php
    do {
  2. if(!function_exists('removeMC'))
    {
      function removeMC($marker,$data,$item)
      {
        if(strcmp($data,'')!=0)
        {
       $item = preg_replace("/<!--".$marker."/",'',$item);
          $item = preg_replace("/".$marker."-->/",'',$item);
          $item = preg_replace("/---".$marker."---/",$data,$item);
        }
       
        return $item;
     }
    }
  3. $position = array(
      'lat' => rex_get('lat', 'float'), // Latitude
      'lon' => rex_get('lon', 'float'), // Longitude
      'acc' => rex_get('acc', 'float'), // Genauigkeit in Metern
    );
  4. $error = rex_get('error');
    $distance = rex_get('distance', 'int', 5);
    $distances = array(5,10,25,50);
  5. if(!empty($position['lat'] AND !empty($position['lon'])))
    {
      // Selectbox zur Auswahl der Distanz
    ?>
    <div id="div_content" align="center" class="ui-content ui-body-a" style="padding-left: 10px; padding-right: 10px;"> 
      <form action="<?php echo rex_geturl(); ?>" method="get">
      <fieldset style="border: none;">
        <div class="ui-btn ui-shadow ui-btn-corner-all ui-submit ui-btn-up-a">
     <span class="ui-btn-inner ui-btn-corner-all">
      <span class="ui-btn-text">Umkreis wählen</span>
      </span>
        </div>
        <div class="ui-select">
     <div class="ui-btn ui-shadow ui-btn-corner-all ui-btn-icon-right ui-btn-up-a" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-icon="arrow-d" data-iconpos="right" data-theme="a">
     <span class="ui-btn-inner ui-btn-corner-all">
     <span class="ui-btn-text">
     <span>5</span>
     </span>
     </span>
        <select name="distance" id="distance" data-native-menu="true">
        <?php
        foreach($distances as $d)
        {
          $selected = '';
          if($d == $distance)
            $selected = 'selected';
         
          printf('<option value="%d"%s>%d&nbsp;km</option>', $d, $selected, $d);
        }
    ?>
        </select>
        </div>
        </div>
      </fieldset>
    </form>
    </div>
    <script type="text/javascript">/* <![CDATA[ */
        document.getElementById('distance').onchange = function (e)
        {
          location.href = '<?php echo rex_geturl('', '', array('lat' => number_format($position['lat'], 10, '.', ''),'lon' => number_format($position['lon'], 10, '.', ''),'acc' => $position['acc']), '&'); ?>&distance=' + this.value;
        }
    /* ]]> */</script><?php
      /* Umkreissuche
       * Die Genauigkeit der Position wird in die Umkreissuche mit eingeschlossen, wenn diese ein Fünftel der Distanz nicht überschreitet.
       * Bispiel: Genauigkeit ist 1km, Umkreis ist 5km: Es wird effektiv im Umkreis von 5 + 1 = 6km gesucht.
       * Beispiel: Genauigkeit ist 10km, Umkreis ist 25km: Genauigkeit ist zu unsicher, deshalb wird im Umkreis von 25km gesucht.
      */
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
     
      $sql = rex_sql::factory(2);
      //$sql->setDebug();
      $sql->setQuery("
        SELECT
          *,
          (
              6371 * acos(
                  cos(
                      radians(".number_format($position['lat'], 10, '.', '').")
                  ) * cos(
                      radians( lat )
                  ) * cos(
                      radians( lon ) - radians(".number_format($position['lon'], 10, '.', '').")
                  ) + sin(
                      radians(".number_format($position['lat'], 10, '.', '').")
                  ) * sin(
                      radians( lat )
                  )
              )
          ) AS distance
        FROM `".$sql->escape($REX['TABLE_PREFIX'].'sedcards')."`
        WHERE 1
          AND status='1'
          AND (displaybegin < '".date('Y.m.d H:i',time())."' AND (displayend IS NULL OR displayend = '' OR displayend > '".date('Y.m.d H:i',time())."'))
        HAVING 1
          AND distance <= ".($distance + (($position['acc'] / 1000) <= ($distance / 5) ? ($position['acc'] / 1000) : 0))."
        ORDER BY
          distance, datum ASC
      ");//*/
     
      //$sql->setQuery("SELECT * FROM `".$sql->escape($REX['TABLE_PREFIX'].'sedcards')."` WHERE displaybegin != ''");
         
      if(!$sql->getRows())
      {
        // Keine Datensätze im Umkreis gefunden
        break;
      }
     
      // Ausgabe aller Datensätze in der Nähe
      include_once($REX["INCLUDE_PATH"]."/addons/sedcard_admin/libs/stdlib.php");
     
      $vl = '<div style="padding-top: 0px; overflow: hidden;"><ul class="ui-listview"><li class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-li-has-thumb ui-btn-hover-a ui-btn-up-a ui-li-has-count ui-li-count"><div class="ui-btn-inner ui-li"><div class="ui-btn-text"><a class="ui-link-inherit" href="'.rex_getUrl(5,$REX["CUR_CLANG"]).'?id=---ID---"><span class="lady img" style="float: left;"><img class="ui-li-thumb" style="border: 0px;" src="http://www.erotik-leipzig.com/sedcards/---VERZEICHNIS---/img/---BILD---" alt="---NAME" title="---NAME---"></span><p class="ui-li-desc"><strong>---ORT--- ---STADTTEIL---</strong></p><p class="ui-li-desc">---STRASSE---</p><h4 class="ui-li-heading">---NAME---</h4><p class="ui-li-desc"><!--ALTER ---ALTER--- Jahre, ALTER--><!--BH ---BH---, BH--><!--KONFEKTION KF ---KONFEKTION---, KONFEKTION--><!--GROESSE ---GROESSE--- cm, GROESSE--><!--GEWICHT ---GEWICHT--- kg, GEWICHT--><!--INTIMRASUR ---INTIMRASUR---, INTIMRASUR--><!--NATIONALITAET ---NATIONALITAET--- NATIONALITAET--></p></a></div><span class="ui-icon ui-icon-arrow-r ui-icon-shadow"> </span></div></li></ul><div class="clear"></div></div>';
     
      $out = '';
      foreach($sql->getArray() as $lady)
      {
        $item = $vl;
        $bild = '01k.jpg';
        $item = str_replace("---VERZEICHNIS---",$lady['verzeichnis'],$item);
        $item = str_replace("---NAME---",strtoupper($lady['name']),$item);
        $item = str_replace("---STRASSE---",strtoupper($lady['strasse']),$item);
        $item = str_replace("---BILD---",$bild,$item);
        $item = str_replace("---ID---",$lady["id"],$item);
        $item = str_replace("---STADTTEIL---",strtoupper(join(", ",preg_split("/\|/",$lady['stadtteil'],-1,PREG_SPLIT_NO_EMPTY))),$item);
        $item = str_replace("---ORT---",strtoupper(join(", ",preg_split("/\|/",$lady['ort'],-1,PREG_SPLIT_NO_EMPTY))),$item);
        $item = removeMC("ALTER",$lady["alter"],$item);
        $item = removeMC("BH",$lady["bh"],$item);
        $item = removeMC("KONFEKTION",$lady["konfektion"],$item);
        $item = removeMC("GROESSE",$lady["groesse"],$item);
        $item = removeMC("GEWICHT",$lady["gewicht"],$item);
        $item = removeMC("INTIMRASUR",$lady["intimrasur"],$item);
        $item = removeMC("NATIONALITAET",$lady["nationalitaet"],$item);
        $out .= $item;
      }
      echo $out;
     
      // Hier das Modul beenden, weil der Standort schon bekannt ist
      break;
    }
  6. // Standortbestimmung
    ?>
    <div align="center" class="ui-content ui-body-a">
      <div id="wait_msg" style="width: 100%; height: 80px; text-align: center;"><img style="margin-top: 20px" src="../files/images/ajax-loader-big.gif"> <br />
        Bitte warten</div>
    </div>
    <div align="center" class="ui-content ui-body-a">
        <?php if($error): ?>
      <div id="error_msg" style="width: 96%; margin: 2% 0 2% 2%; text-align: left; float: left; border: 1px solid #f7c942; color: #333; text-shadow: 0 1px 0 #fff; background: #faeb9e; background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#faeb9e) ); background-image: -webkit-linear-gradient(top, #fff, #faeb9e); background-image: -moz-linear-gradient(top, #fff, #faeb9e); background-image: -ms-linear-gradient(top, #fff, #faeb9e); background-image: -o-linear-gradient(top, #fff, #faeb9e); background-image: linear-gradient(top, #fff, #faeb9e); padding: 0.4em 0 0 0; font-size: 18px;">
        <div style="padding: 8px;">Für diese Funktion benötigen Sie die Standorterkennung oder den Ortungsdienst (GPS) ihres Mobiltelefons! <br /><br />
          Bitte aktivieren Sie diesen in ihren Einstellungen und rufen Sie die Seite erneut auf. <br />
          Genaue Informationen erhalten Sie von ihrem jeweiligen Telefonhersteller. <br />
        </div>
        <?php endif; ?>
      </div>
    </div>
    <?php
  7. // Script zur Standortbestimmung nur ausführen, wenn Standort noch nicht bekannt ist und auch kein Fehler aufgetreten ist
    if(empty($_GET))
    {
    ?>
    <script type="text/javascript">/* <![CDATA[ */
  8. if(!navigator.geolocation)
    {
      location.href = '<?php echo rex_geturl('', '', array('error' => 'geo'), '&'); ?>';
    }
    else
      {
        navigator.geolocation.getCurrentPosition(function(position)
        {
            // Position konnte ermittelt werden
            location.href = '<?php echo rex_geturl(); ?>?lat=' + position.coords.latitude + '&lon=' + position.coords.longitude;
        },  function()
        {
            // Position konnte nicht ermittelt werden
            location.href = '<?php echo rex_geturl('', '', array('error' => 'pos'), '&'); ?>';
        },
        {
            enableHighAccuracy: true,
            timeout: 5000,
            maximumAge: 0
        });
     navigator.geolocation.getCurrentPosition(
     function(pos){
     },
     function(error){
      var msg = "";
      switch (error.code){
       case error.PERMISSION_DENIED:
        //msg = "User denied the request for Geolocation."
        msg += 'CODE = ' + error.PERMISSION_DENIED | 1;
        msg += '<br/>\nBenutzer hat die Anfrage zur Standorterkennung verweigert.';
        break;
       case error.POSITION_UNAVAILABLE:
        //msg = "Location information is unavailable.";
        msg += 'CODE = ' + error.POSITION_UNAVAILABLE;
        msg += '<br/>\nStandorterkennung nicht verfügbar.';
        break;
       case error.TIMEOUT:
        //msg = "The request to get user location timed out.";
        msg += 'CODE = ' + error.TIMEOUT;
        msg += '<br/>\nStandorterkennung Timeout.';
        break;
       case error.UNKNOWN_ERROR:
        //msg = "An unknown error occurred.";
        msg += 'CODE = ' + error.UNKNOWN_ERROR;
        msg += '<br/>\nUnbekannter Fehler ist aufgetreten.';
        break;
      }
      alert(msg);
     }
    )
    }
    /* ]]> */</script>
    <?php
    }
  9. } while(false);
    ?>