MyBB Community Forums

Full Version: Usermap
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
(2008-06-23, 05:54 PM)Paretje Wrote: [ -> ]
(2008-05-30, 08:25 AM)the_griffin Wrote: [ -> ]
Paretje Wrote:Run the convert system of MyBB, and it has to be fixed, normally.

Unfortunately, this did not fix the problem. I converted the table usermap_places to UTF-8 (which has not been until then), but the map still shows the �.
I deactivated the plugin and tried several options: installing 1.02 ...upgrading to 1.03. and then 1.04 and also activating 1.04 without the previous versions.

Now i run 1.02 again. However now I am not able to find "muenchen" or "munich" even. This had been working correctly before.... Sad

Thank you in advance for any help! Wink

Convert mybb_users.

mybb_users is already converted to UTF-8. ACP is showing "OK". Huh

@Mia:
can you post the lines before 155? Perhaps the syntax error is due to a 'copy&paste' problem?
<?php
/***************************************************************************
 *
 *   Usermap-system for MyBB
 *   Copyright: © 2008 Online - Urbanus
 *   
 *   Website: http://www.Online-Urbanus.be
 *   
 *   Last modified: 24/05/2008 by Paretje
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is based on the GPLed mod called "skunkmap" version 1.1, made by King Butter - NCAAbbs SkunkWorks Team <http://www.ncaabbs.com>, which was released on the MyBB Mods site on 22nd May 2007 <http://mods.mybboard.net/view/skunkmap>.
 * 
 * So, I call my special thanks to the maker(s) of that program!
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 ***************************************************************************/

//Define MyBB and includes
define("IN_MYBB", 1);

$templatelist = "usermap,usermap_form,usermap_pin,usermap_pinimgs,usermap_pinimgs_bit,usermap_pinimgs_java,usermap_pinimgs_java_bit,usermap_pinimgs_swapimg,usermap_pins,usermap_pins_bit,usermap_pinimgs_bit_user,usermap_places_bit,usermap_places_java,usermap_places_java_bit";

require_once "./global.php";

//Plugin
$plugins->run_hooks("username_start");

//Navigation
add_breadcrumb($lang->usermap, "usermap.php");

//Control if the users has the correct permissions; Additional groups
if($mybb->user['additionalgroups'] != "")
{
	$additionalgroups = ",".$mybb->user['additionalgroups'];
}

//Load permissions
$perms = $cache->read("usergroups");

//String to array
$usergroups = explode(",", $mybb->user['usergroup'].$additionalgroups);

if(is_array($usergroups))
{
	foreach($usergroups as $key => $val)
	{
		$val = trim($val);
		
		//Can view usermap permission
		if($perms[$val]['canviewusermap'] == "yes")
		{
			$permission['canviewusermap'] = "yes";
		}
	}
}

//Control permission
if($permission['canviewusermap'] != "yes")
{
	error_no_permission();
}

switch($mybb->input['action'])
{
	default:
		/***********************************
		 *   Defaults
		 ***********************************/
		$defaults = $cache->read("usermap");
		
		/***********************************
		 *   Places
		 ***********************************/
		//Selected
		$selected_place[$defaults['place']] = " selected=\"selected\"";
		
		//Loading
		$query2 = $db->query("SELECT * FROM ".TABLE_PREFIX."usermap_places ORDER BY displayorder ASC");
		while($places = $db->fetch_array($query2))
		{
			if($places['pid'] == $defaults['place'])
			{
				$default_place = array(
					"lat"		=> $places['lat'],
					"lon"		=> $places['lon'],
					"zoom"		=> $places['zoom']
				);
			}
			
			eval("\$usermap_places_bit .= \"".$templates->get("usermap_places_bit")."\";");
			eval("\$usermap_places_java_bit .= \"".$templates->get("usermap_places_java_bit")."\";");
		}
		
		//Java
		eval("\$usermap_places_java = \"".$templates->get("usermap_places_java")."\";");
		
		/***********************************
		 *   Pinimages
		 ***********************************/
		$pinimgs = $cache->read("usermap_pinimgs");
		
		//Default pin
		$default_pinimg = $pinimgs[$defaults['pinimg']];
		
		//Selected
		$selected_pinimg[$default_pinimg['file']] = " selected=\"selected\"";
		
		foreach($pinimgs as $pid => $pinimg)
		{
			$file = explode(".", $pinimg['file']);
			
			eval("\$usermap_pinimgs_bit .= \"".$templates->get("usermap_pinimgs_bit")."\";");
			eval("\$usermap_pinimgs_java_bit .= \"".$templates->get("usermap_pinimgs_java_bit")."\";");
		}
		
		//Java
		eval("\$usermap_pinimgs_swapimg = \"".$templates->get("usermap_pinimgs_swapimg")."\";");
		eval("\$usermap_pinimgs_java = \"".$templates->get("usermap_pinimgs_java")."\";");
		
		/***********************************
		 *   Load locations of users, the pins
		 ***********************************/
		$count = 0;
        
        $query2 = $db->query("SELECT * FROM ".TABLE_PREFIX."profilefields WHERE name='Location'");
        $locationfield = $db->fetch_array($query2);
        
        $query = $db->query("SELECT u.*, p.fid".$locationfield['fid']." AS location
        FROM ".TABLE_PREFIX."users u
		while($users = $db->fetch_array($query))
		{
			$count++;
			
			//Pinimg
			if(empty($users['usermap_pinimg']))

this is all before line 155
last line is line 155
You didn't copy your code correctly, look to the query:
        $query = $db->query("SELECT u.*, p.fid".$locationfield['fid']." AS location
        FROM ".TABLE_PREFIX."users u
        while($users = $db->fetch_array($query))

That has to be:
		$query = $db->query("SELECT u.*, p.fid".$locationfield['fid']." AS location
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."userfields p ON (u.uid=p.ufid)
		WHERE u.usermap_lat!='0' AND u.usermap_lon!='0'");
		while($users = $db->fetch_array($query))

And, the_griffin, ok, then do this:
Open usermap.php and find:
		//Form if logged in
		if($mybb->user['uid'] != 0)
		{
			eval("\$usermap_form = \"".$templates->get("usermap_form")."\";");
		}

Replace with:
		//Form if logged in
		if($mybb->user['uid'] != 0)
		{
			$mybb->user['usermap_adress'] = htmlentities($mybb->user['usermap_adress']);
			eval("\$usermap_form = \"".$templates->get("usermap_form")."\";");
		}
cool, thanks! now it's working! but this is th location the users entered into their profiles. is there any possibility to show up what they enteres into the "find location field" in your usermap plugin?
(2008-06-24, 02:26 PM)Paretje Wrote: [ -> ]And, the_griffin, ok, then do this:
Open usermap.php and find:
		//Form if logged in
		if($mybb->user['uid'] != 0)
		{
			eval("\$usermap_form = \"".$templates->get("usermap_form")."\";");
		}

Replace with:
		//Form if logged in
		if($mybb->user['uid'] != 0)
		{
			$mybb->user['usermap_adress'] = htmlentities($mybb->user['usermap_adress']);
			eval("\$usermap_form = \"".$templates->get("usermap_form")."\";");
		}
Hi Paretje,

Thank you! However, what has happend after changing it accordingly is strange. After replacing above lines, no city with "ü", "ö" or "ä" could been found anymore. The error-message came up telling "this coordinates can not been found".
So I canceled the replacement and.....I can not even get the result from this post. Unfortunately exchanging the file with a backup file did not help. Neither can I find cities with umlaut nor the according cities with "ue" e.g. Sad

Edit:
I do have another forum for testing only and have not changed anything since a while. The last time I checked the usermap I got the result of this post. Now, it behaves like written above. Is it worth thinking about, if Google changed something?

Edit 2:
It works. I don't know why, but I tried it again today and.....it works! ....strange Smile
So, it works? But you have still the problem with the characters in the form? Was that fixed at first? I have maybe the fix now, but it has to be a problem with the coding.

Try this:
1. Open phpMyAdmin
2. Go to mybb_users (Structure)
3. Make sure that the collation of the follow rows is utf8_general_ci:
- usermap_lat
- usermap_lon
- usermap_pinimg
- usermap_adress

Especially the last one is important.
Hi Paretje,

yes know it is working, but the I still have the problem with the characters.

I have just checked the collation of the above rows. They are already utf8_general_ci collated (esp. usermap_adress), except usermap_lat and usermap_ion as they are of type 'float' I guess.
Be sure you use Usermap 1.0.4.

If yes, try this usermap.php-file once:[attachment=9535]
I double-checked this and I use Usermap 1.0.4.

I have tried your file. Unfortunately, cities with umlaut can not be found ("error"). Sorry. Confused
Then you have to use the normal 1.0.4, and do it with that ? Sad
Maybe, it will be fixed with MyBB 1.4.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25