============================================================================================================================
Modification Name: Member Map v1.0

Updated: 04/02/10

DESCRIPTION: This modification allows your members to place pins on various maps of around the world showing where they live in the world.

Code Developed for XMB by: hanez
Code ported from: Carsten's Member Map mod for YaBB SP & Globalopper's php-version
http://www.yabbforum.com/ & http://www.yabbse.org/

COMPATIBILITY: XMB 1.9.5 SP1
Code Updated for XMB 1.9.5 by: WormHole @ XMB Garage
Netscape/Mozilla Fix by: Hanez

Install Note: Before adding this modification to your forum, you should back up all files related to this modification.

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Author Note:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.
============================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================
========================
Add Code and Submit Changes
========================

ALTER TABLE `$table_members` ADD `mmlocation` varchar(50) NOT NULL;
ALTER TABLE `$table_settings` ADD `membermapstatus` char(3) default 'on' NOT NULL;

============================================================================================================================
=======
Step 2:
=======
=======================
Edit File: lang/English.lang.php
=======================
=======================
Add To End Of File Above ?>
=======================

// Member Map Mod Begin
$lang['textmemmap1'] = "Member Map";
$lang['textmemmap2'] = "Place My Pin";
$lang['textmemmap3'] = "Map:";
$lang['textmemmap4'] = "Location:";
$lang['textmemmap5'] = "Region";
$lang['textmemmap6'] = "Country:";
$lang['textmemmap7'] = "Country Flag:";
$lang['textmemmap8'] = "Save";
$lang['textmemmap9'] = "Remove Pin";
$lang['textmemmap10'] = "Close";
$lang['textmemmap11'] = "Place My Pin";
$lang['textmemmap12'] = "Pinpoint your location by clicking on the map";
$lang['textmemmap13'] = "Member List:";
$lang['membermapstatus'] = "Member Map Status:";
$lang['onlinememmap'] = "Viewing Member Map";
// Member Map Mod End

============================================================================================================================
=======
Step 3:
=======
==============
Edit File: cp.php
==============
==========
Find Code:
==========

        $avataron = $avataroff = $avatarlist = '';
        if ($SETTINGS['avastatus'] == "on") {
            $avataron = $selHTML;
        } elseif ($avastatus == "list") {
            $avatarlist = $selHTML;
        } else {
            $avataroff = $selHTML;
        }

===============
Add Code Below:
===============

        // Member Map Mod Begin
        $membermapstatus_on = $membermapstatus_off = '';
        switch ($membermapstatus) {
            case 'on':
                $membermapstatus_on = $selHTML;
                break;
            default:
                $membermapstatus_off = $selHTML;
                break;
        }
        // Member Map Mod End

==========
Find Code:
==========

        printsetting1($lang['reportpoststatus'], 'reportpostnew', $reportposton, $reportpostoff);

===============
Add Code Below:
===============

        // Member Map Mod Begin
        printsetting1($lang['membermapstatus'], 'membermapstatusnew', $membermapstatus_on, $membermapstatus_off, $langfile);
        // Member Map Mod End

==========
Find Code:
==========

        $resetSigNew = ($resetSigNew == 'on') ? 'on' : 'off';

===============
Add Code Below:
===============

        // Member Map Mod Begin
        $membermapstatusnew = ($membermapstatusnew == 'on') ? 'on' : 'off';
        // Member Map Mod End

==========
Find Code:
==========

$db->query("UPDATE $table_settings SET langfile='$langfilenew',

==============================
Add To End Of Statement BEFORE  ");
==============================

, membermapstatus='$membermapstatusnew'

============================================================================================================================
=======
Step 4:
=======
=================
Edit File: member.php
=================
==========
Find Code:
==========

$db->query("INSERT INTO $table_members

================================
Add To Statement BEFORE  ) VALUES (
================================

, mmlocation

=================================
Add To End Of Statement Just BEFORE  )");
=================================

, ''

============================================================================================================================
=======
Step 5:
=======
================
Edit File: header.php
================
==========
Find Code:
==========

// 'Forum Rules'-link
if ( $SETTINGS['bbrules'] == "on") {
    $links[] = "<img src=\"$imgdir/bbrules.gif\" alt=\"$lang[altrules]\" border=\"0\" /> <a href=\"faq.php?page=forumrules\"><font class=\"navtd\">$lang[textbbrules]</font></a>";
}

===============
Add Code Below:
===============

// Member Map-link
if ($SETTINGS['membermapstatus'] == "on" && X_MEMBER) {
    $links[] = "<img src=\"$imgdir/map.jpg\" alt=\"$lang[textmemmap1]\" border=\"0\" /> <a href=\"membermap.php\"><font class=\"navtd\">$lang[textmemmap1]</font></a>";
}

============================================================================================================================
=======
Step 6:
=======
===============
Edit File: misc.php
===============
==========
Find Code:
==========

    } elseif (false !== strpos($url, "/topicadmin.php")) {
        $location = $lang['onlinetopicadmin'];

===============
Add Code Below:
===============

    // Member Map Mod Begin
    } elseif (false !== strpos($url, "/membermap.php")) {
        $location = $lang['onlinememmap'];
    // Member Map Mod End

============================================================================================================================
=======
Step 7:
=======
===============================
Go To Administration Panel --> Templates
===============================
============================
Create New Template: memmap_view
============================
========================
Add Code and Submit Changes
========================

<script language="JavaScript" type="text/javascript">
var kordval
var pinlink
var useNS6 = document.getElementById && !document.all ? 1:0;

    function memClicked() {
        kordxy=new Array;
        kordval = document.mmview.memberName.options[document.mmview.memberName.selectedIndex].value;
        kordxy = kordval.split(",",3);

        if (document.all) {
            document.all.pin.style.position = "absolute";
            document.all.pin.style.top = kordxy[1] + "px";
            document.all.pin.style.left = kordxy[0] + "px";
            document.all.pin.style.visibility = "visible";
        }
        if (useNS6) {
            document.getElementById('pin').style.position = "absolute";
            document.getElementById('pin').style.top = kordxy[1] + "px";
            document.getElementById('pin').style.left = kordxy[0] + "px";
            document.getElementById('pin').style.visibility = "visible";
        }
    }

    function  viewProfile() {
        kordxy=new Array;
        kordval = document.mmview.memberName.options[document.mmview.memberName.selectedIndex].value;
        kordxy = kordval.split(",",3);
        location.href="member.php?action=viewpro&member="+kordxy[2];
    }

    function mmeditWindow(URL,WindowName) {
    var newWindow = open(URL,WindowName,"Resizable=Yes,ScrollBars=No,MenuBar=No,Directories=No,ToolBar=No,Location=No,Status=No,Width=780,Height=550,left=0,top=0'");
    if (newWindow.opener == null)
        newWindow.opener = self;
    if (newWindow.focus)
        newWindow.focus();
    }
</script>

<table cellspacing="0" cellpadding="0" border="0" width="$tablewidth" align="center">
<tr>
<td bgcolor="$bordercolor" width="100%">
<table border="0" cellspacing="$borderwidth" cellpadding="$tablespace" width="100%">
<tr>
<td align="middle" class="header">

<form method="post" action="membermap.php?action=mmview" name="map"><table width="100%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="navtd" align="left" valign="top" width="50%">
<select name="map">$continents
</select>
&nbsp;<input type="submit" value="View" /><input type="hidden" name="memberName" /></td>

<td class="navtd" align="center"><b> $map </b></td>
</tr>
</table>

</td><td align="middle" class="navtd">$mmvedit</td></tr>

<tr class="tablerow">
<td bgcolor="$altbg2">
<table width="605" align="center" style="font-size: inherit;" cellpadding="0" cellspacing="0" border="0">
<tr><td>
<center><div style="width: 605px; height: 530px; overflow: hidden; position: relative;"><img src="$imagesdir/maps/$map.gif" width="605" height="530" style="z-index: 0; position: relative;" alt="$map">

$mmvrow 

<a href="javascript:viewProfile()"><img src="$imagesdir/$pin2" id="pin" style="z-index: $count; position: absolute; visibility: hidden; top: 10; left: 10;" border="0" alt="" /></a>	</div></center>

</td></tr></table>
</td><td width="120" bgcolor="$altbg2" class="tablerow" valign="top"><div align=center>
</form><form method="post" action="memClicked()" name="mmview">
<select size="40"  name="memberName" onChange="if(this.options[this.selectedIndex].value) memClicked()">
<option class="navtd"><b>$lang[textmemmap13]</b></option>

$mmvmlist

</select></form></div>
</td></tr></table>
</td></tr></table>

============================================================================================================================
=======
Step 8:
=======
===============================
Go To Administration Panel --> Templates
===============================
==================================
Create New Template: memmap_view_editlink
==================================
========================
Add Code and Submit Changes
========================

<a href="javascript:mmeditWindow('membermap.php?action=mmedit&username=$xmbuser')" class="navtd"><b>$lang[textmemmap2]</b></a>

============================================================================================================================
=======
Step 9:
=======
===============================
Go To Administration Panel --> Templates
===============================
================================
Create New Template: memmap_view_row
================================
========================
Add Code and Submit Changes
========================

<a href="member.php?action=viewpro&amp;member=$member_name"><img src="$imagesdir/$pin1" style="z-index:$count; position: absolute; top:$member_ycoord$px; left:$member_xcoord$px;" alt="$member_real : $member_location" title="$member_real : $member_location" border="0" /></a>

============================================================================================================================
========
Step 10:
========
===============================
Go To Administration Panel --> Templates
===============================
============================
Create New Template: memmap_edit
============================
========================
Add Code and Submit Changes
========================

<html>
<head>
<title>$lang[textmemmap1] - $lang[textmemmap2]</title>
</head>
$css
<body $bgcode text="$text" marginheight="0" marginwidth="0" spacing="0">
<style type=text/css>
body              
{ 
margin : 1px; 
font-family : $font; 
font-size : 9pt; 
}
</style>
<script language="JavaScript" type="text/javascript">
var ie = document.all ? 1 : 0;

function PlacePin(event) {
    xcoord = (event.clientX + document.body.scrollLeft);
    ycoord = (event.clientY + document.body.scrollTop);
if (ie) {
    document.all.pin.style.visibility = "visible";
    document.all.pin.style.left = xcoord - 3;
    document.all.pin.style.top = ycoord - 9;
    document.mmedit.xcoord.value = xcoord - 3;
    document.mmedit.ycoord.value = ycoord - 2;
} else {
    document.getElementById('pin').style.visibility = "visible";
    document.getElementById('pin').style.left = xcoord - 1;
    document.getElementById('pin').style.top = ycoord - 7;
    document.mmedit.xcoord.value = xcoord;
    document.mmedit.ycoord.value = ycoord;
	}
}
	
function ViewMap() {
    if (ie)
        document.all.pin.style.visibility = "hidden";
    else
        document.getElementById('pin').style.visibility = "hidden";
        document.images.mapview.src="$imagesdir/maps/" + document.mmedit.continent.options[document.mmedit.continent.selectedIndex].value + ".gif";
        document.mmedit.xcoord.value = -1;
        document.mmedit.ycoord.value = -1;
    }

function ShowFlag() {
    document.images.flag.src="$imagesdir/flags/" + document.mmedit.country.options[document.mmedit.country.selectedIndex].value + ".gif";
}
</script>
<div style="position: absolute; top: 0; left: 0;" onclick="PlacePin(event)"><img src="$imagesdir/maps/$member_map.gif" name="mapview" width="605" height="530" style="z-index: 0; position: absolute; top: 0; left: 0; cursor: crosshair;" /><img src="$imagesdir/$pin1" id="pin" style="z-index: 1; position: absolute; top: $member_ycoord2 px; left: $member_xcoord px;" />
</div>
<div style="position: absolute; left: 605px;">
<table cellspacing="0" cellpadding="0" border="0" width="100%" align="center"><tr><td bgcolor="#000000"><table border="0" cellspacing="1" cellpadding="6" width="100%"><tr class="header"><td align="center"><form method="post" action="membermap.php?action=mmedit2" name="mmedit"> <b>$lang[textmemmap2]</b></td></tr>
<tr class="tablerow"><td bgcolor="$altbg1" align="center">&#171; $row[username] &#187;</td></tr>
<tr class="tablerow"><td bgcolor="$altbg1">$lang[textmemmap3]<br /><select name="continent" onchange="ViewMap()">$continents</select></td></tr>
<tr class="tablerow"><td valign="middle" bgcolor="$altbg1">$lang[textmemmap4]<br /><input type="text" name="mlocation" value="$member_location" size="20" /></td></tr>
<tr class="tablerow"><td bgcolor="$altbg1">$lang[textmemmap6]<br /><select name="country" onchange="ShowFlag()"><option value="Noflag"></option>$countries</select></td></tr>
<tr><td class="tablerow" bgcolor="$altbg1" valign="top">$lang[textmemmap7] <img src="$imagesdir/flags/$member_flag.gif" name="flag" border="0" /></td></tr>
<tr class="tablerow"><td bgcolor="$altbg1" align="left"><b>$lang[textmemmap12]</b></td></tr>
<tr><td align="center" bgcolor="$altbg1"><input type="submit" value="$lang[textmemmap8]" style="width: 120px;" onclick="javascript:window.document.mmedit.button.value = '1';" />

$removepin 

<input type="submit" value="$lang[textmemmap10]" style="width: 120px;" onclick="javascript:window.close();" />
</td></tr>
</table>
<input type="hidden" name="button" value="0" />
<input type="hidden" name="xcoord" value="$member_xcoord" />
<input type="hidden" name="ycoord" value="$member_ycoord" />
</form></td></tr></table> 
</div>
</body>
</html>

============================================================================================================================
========
Step 11:
========
===============================
Go To Administration Panel --> Templates
===============================
=================================
Create New Template: memmap_edit_rempin
=================================
========================
Add Code and Submit Changes
========================

<input type="submit" value="$lang[textmemmap9]" style="width: 120px;" onclick="javascript:window.document.mmedit.button.value = '2';"><br />

============================================================================================================================
========
Step 12:
========
===============================
Go To Administration Panel --> Templates
===============================
=======================
Edit Template: memcp_profile
=======================
=====================
Add Code To Top Of File:
=====================

<script type="text/javascript" language="javascript">
function mmeditWindow(URL,WindowName)
{
var newWindow = open(URL,WindowName,"Resizable=Yes,ScrollBars=No,MenuBar=No,Directories=No,ToolBar=No,Location=No,Status=No,Width=780,Height=550,left=0,top=0'"); if (newWindow.opener == null)
newWindow.opener = self;
if (newWindow.focus)
newWindow.focus();
}
</script>

==========
Find Code:
==========

$dayselect
<input type="text" name="year" size="4" value="$bday[2]" /></td>
</tr>

===============
Add Code Below:
===============

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%" >$lang[textmemmap1]:</td>
<td bgcolor="$altbg2"><a href="javascript:mmeditWindow('membermap.php?action=mmedit&username=$xmbuser')" class="post"><b>$lang[textmemmap2]</b></a></td>
</tr>

============================================================================================================================
========
Step 13:
========

UPLOAD FOLDERS "membermap", "membermap/flags" & "membermap/maps" & CONTENTS INTO YOUR XMB / IMAGES DIRECTORY.

UPLOAD MAP IMAGE "map.jpg" TO YOUR FORUM THEME DIRECTORIES

UPLOAD MEMBERMAP.PHP TO YOUR "BOARD" DIRECTORY

============================================================================================================================
========
Step 14:
========
===================================================
To Change Which World Map To Display, Use The Following Forumla:
===================================================
====================
Edit File: membermap.php
====================
==========
Find Code:
==========

$defaultmap = "USA";

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Replace "USA" with your default map (spelled exactly like in the filename of the map-image which is to be found in /images/membermap/maps directory)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tip: Upload only those maps (& flags) which you want to be displayed.
You can also upload your own set of maps but make sure the size is 605px width x 530px height.
If they are of a different size you will need to change the image displaying the code slightly.
-------------------------------------------------------------------------------------------------

============================================================================================================================
Enjoy!