[Windows Mobile Development and Hacking General] _LEM_:
Plugins

1. TrackMe (NMEA records) to OziExplorer (.plt) converter by tahdor

Description:

Simple perl script which takes the TrackMe (NMEA records) and put them as OziExplorer (.plt) format. Then you can open the .plf record in GpsVp to view the track.

# TrackMe.To.GpsVp.pl
#

$pll_ifname = "/Program Files/TrackMe/gpspositions.txt";
$pll_ofpath = "/Storage Card/Maps gpxVPTracks/";
#$pll_ifname = "gpspositions.txt";
#$pll_ofpath = "";

$pll_ofname = "gpspositions.plt";
$pll_ofname_date = "";
$maxtrack = 12;

sub pls_open_infile {
local ($pll_ifname, *PLL_F_IN_FPTR) = @_;
if (! open (PLL_F_IN_FPTR, "$pll_ifname")) {
warn "$pll_ifname: $!\n";
return -1;
}
return 0;
}

sub pls_open_outfile_overwrite {
local ($pll_outfname, *PLL_F_OUT_FPTR) = @_;
if (!open (PLL_F_OUT_FPTR, ">$pll_outfname")) {
warn "$pll_outfname: $!\n";
# die "$pll_outfname: $!\n";
return -1;
}
return 0;
}

sub pls_open_outfile_append {
local ($pll_outfname, *PLL_F_OUT_FPTR) = @_;
if (!open (PLL_F_OUT_FPTR, ">>$pll_outfname")) {
warn "$pll_outfname: $!\n";
# die "$pll_outfname: $!\n";
return -1;
}
return 0;
}

if (&pls_open_infile($pll_ifname, PLL_F_IN_FPTR) < 0) {
die "couldn't open output file $pll_ifname\n";
}
if (&pls_open_outfile_overwrite($pll_ofname, PLL_F_OUT_FPTR) < 0) {
die "couldn't open output file $pll_ofname\n";
}

sub output {
if ("$lat_rmc" ne "0") {
print PLL_F_OUT_FPTR sprintf ("%2.7f,%2.7f,0,%3.1f,%d,%s,%s\n", $lat_rmc,
$long_rmc, $alt_gga * 3.2808399, 0, $date, $time_rmc);
}
}

sub latitude {
my ($deg, $min) = unpack "a2a*", $_[0];
my $lat = $deg + $min / 60;
$lat = - $lat if $_[1] =~ /[Ss]/;
return $lat;
}

sub longitude {
my ($deg, $min) = unpack "a3a*", $_[0];
my $long = $deg + $min / 60;
$long = - $long if $_[1] =~ /[Ww]/;
return $long;
}

while ($line = <PLL_F_IN_FPTR>) {
chomp($line);
@field = split /[,*]/, $line;
SWITCH: {

# recommended minimum specific GPS/Transit data
if ($field[0] =~ /GPRMC/) {

# $time_rmc = join ':', unpack "a2" x 3, $field[1];
$time_rmc = join '.', unpack "a2" x 3, $field[1];
$ok_rmc = $field[2];
$lat_rmc = latitude(@field[3..4]);
$long_rmc = longitude(@field[5..6]);
$speed = $field[7];
$cmg = $field[8];
#$date = join '-', unpack "a2" x 3, $field[9];
$date = substr($field[9],4,2) .'-'. substr($field[9],2,2) .'-'. substr($field[9],0,2);
$mvar = $field[10] . $field[11];
# field[12] is checksum

if ($date ne $pll_ofname_date) {
$pll_ofname = $pll_ofpath . "Tm.$date.$time_rmc.plt";
$pll_ofname_date = $date;
if (&pls_open_outfile_overwrite($pll_ofname, PLL_F_OUT_FPTR) < 0) {
die "couldn't open output file $pll_ofname\n";
}
print PLL_F_OUT_FPTR "OziExplorer Track Point File Version 2.1\n";
print PLL_F_OUT_FPTR "WGS 84\n";
print PLL_F_OUT_FPTR "Altitude is in Feet\n";
print PLL_F_OUT_FPTR "Reserved\n";
print PLL_F_OUT_FPTR "0,2,128,,0,0,2,0\n";
print PLL_F_OUT_FPTR "1\n";
}

output();
last SWITCH;
}

# GPS fix data
if ($field[0] =~ /GPGGA/) {
$time_gga = join ':', unpack "a2" x 3, $field[1];
$lat_gga = latitude(@field[2..3]);
$long_gga = longitude(@field[4..5]);
$fixqual = $field[6];
$nsat = $field[7];
$hdop_gga = $field[8];
$alt_gga = $field[9];
# $field[10] is altitude units (always M)
$gheight = $field[11];
# $field[12] is geoid height units (always M)
$DGPS_age = $field[13];
$DGPS_ID = $field[14];
# field[15] is checksum;
last SWITCH;
}
}
}

2. User limitation for web viewer access by Real_Justus

Description:

Limit access to Web viewer for servers running in public mode

I was wondering how I could limit the access to my server. I wanted a group of users to be able to track all TrackMe clients via GoogleMaps.

The attached three files will enable a simple authorization for users. The server has to be installed accessable for everyone (public).

To create the authorziation, you have to edit .htaccess and htpasswd from the ZIP attached as follows:

1: Open .htaccess with the texteditor.

2: In the line "AuthUserFile" you have to add the WHOLE path to .htpasswd.

3: .htpasswd contains the users. The username is just plain text. The password is ht-encrypted. You can encrypt passwords here.

4: When both files are modifyed for your needs, upload them to the TrackMe directory on your server. If this is done correctly, a simple authorization is required for opening the webinterface for your TrackMe-server. All valid users can Track all clients.

If you don´t know the exactly path, upload phpinfo.php from the ZIP attached to the TrackMe directory on your server and open the file in your browser. (http://www.yourserver.com/TrackMe/phpinfo.php). Search for "Document_ Root" The path might be something like: /var/www/user/html/YourTrackMe/Directory. Insert the path in .htaccess

!!!Make sure to delete the phpinfo.php after use!!!

Files: Download

3. Plugin that allows you to assign multiple pictures to a single position by ElHozo

Description:

I've made a change in tod files of the server to allow view of multiple pictures in on dialog ballon. This (at least for me) is very usefull when you want to take many pictures from one place (no position change)

You have to edit to files

in request.php make this change to allow having multiples images in one single position record

if($action=="updateimageurl")
{
$imageurl = urldecode($_GET["imageurl"]);
$id = urldecode($_GET["id"]);

$iconid='null';
$result=mysql_query("Select ID FROM icons WHERE name = 'Camera'");
if ( $row=mysql_fetch_array($result) )
$iconid=$row['ID'];

/* HOZO 20/Jun/2009 : Esta es la modficacion que permite poner mas de una
* imagen en un solo punto, pone las url una atras de otra saparadas por un
* espacio. la linea que queda comentada es la original.
* Ver en index.php el cambio que las muestra en el globo del dialogo */
// BEGIN ORIGINAL CODE - MUST BE COMMENTED
//mysql_query("update positions set imageurl='$imageurl',fk_icons_id=$iconid where id=$id");
// END ORIGINAL CODE
// BEGIN NEW CODE
mysql_query("update positions set imageurl=CONCAT_WS(' ', imageurl, TRIM('".$imageurl."')), fk_icons_id='".$iconid."' where id='".$id."'");
// END NEW CODE

echo "Result:0";
die();
}

in index.php change this to show multiple images in one dialog balloon

if($row['ImageURL'])
{
/* HOZO 20/Jul/2009 : Agregar este pedazo de codigo en reemplazo del orginal,
* la ultima linea que esta comentada es la orgiinal.*/
// BEGIN NEW CODE

// Por las dudas me aseguro de eliminar espacios duplicados
$row['ImageURL'] = eregi_replace (" ", " ", $row['ImageURL']);
$row['ImageURL'] = eregi_replace (" ", " ", $row['ImageURL']);
$stFotos = explode (" ", trim($row['ImageURL']));

// Armo la cantidad de columnas y tamaño de la imagen del globo
// de acuerdo a la cantidad de fotos que haya para mostrar
if (count ($stFotos) == 1)
{
$inFotosCols = 1;
$inImgWidth = 200;
}
else
{
$inFotosCols = count ($stFotos);
if ($inFotosCols > 16)
$inFotosCols = 5;
else if ($inFotosCols > 9)
$inFotosCols = 4;
else if ($inFotosCols > 3)
$inFotosCols = 3;
$inImgWidth = ( 400 / $inFotosCols ) - 5;
}

$html .= "<tr><td>";
$html .= "<table>";
$inFotoIndex = 0;
while (list ($inKey, $szData) = each ($stFotos))
{
if ( ($inFotoIndex % $inFotosCols) == 0)
$html .= "<tr>";
$inFotoIndex++;
$html .= "<td><a><img></a></td>";
if ( ($inFotoIndex % $inF";
}
$html .= "</tr>";
$html .= "</table>";
$html .= "</td>";
$html .= "</tr>";
// END NEW CODE
// La que sigue es la linea orignal de codigo
// BEGIN ORIGINAL CODE - MUST BE COMMENTED
//$html .= " <tr><td><a><img></a></td></tr>";
// END ORIGINAL CODE
}

Know issues : The filed imgeurl in DB is limited to 255 chars, is better if you change this value to something bigger to fit more images urls.

I have included a ZIP with the two modified files

Files: Download