Re: Problem nach update auf 1.0.5 mit dem Usermenü..
Posted: 31. July 2010 01:06
Das SEARCH_UNREAD fehlt in deiner languages/de/common.php
Code: Select all
[phpBB Debug] PHP Notice: in file /geomap.php on line 163: in_array() [function.in-array]: Wrong datatype for second argument
Code: Select all
<?php
/**
*
* @package - GeoMap
* @version $Id: geomap.php 25 2009-02-07 14:40:21Z Frank Wiesemann $
* @copyright (c) Frank Wiesemann ( http://s50.de/ )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @package phpBB3
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path.'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_geomap.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/geomap');
// collect informations
// grab post vars
$mode = request_var('mode', '');
$post_land_id = request_var('land', 0);
$post_plz = request_var('plz', 0);
$post_distance = request_var('distance', 10);
$start = request_var('start', 0);
// define and initialize some vars
$geo_user_search_ary = $geo_user_ary = $geo_config_ary = $user_ary = $geo_map_values = $geo_user_groups = array();
$postcode_not_found = $no_own_entry = false;
$row = $pagination = $map = '';
$geo_search_count = 0;
// get land option ary
$sql = 'SELECT t2.option_id, t2.lang_value
FROM ' . PROFILE_FIELDS_TABLE . ' t1
INNER JOIN ' . PROFILE_FIELDS_LANG_TABLE . ' t2
ON t1.field_id = t2.field_id
WHERE t2.lang_id = ' . $user->get_iso_lang_id() . '
AND t1.field_name = \'land\'
ORDER BY t2.option_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$land_option_ary[$row['option_id']+1] = $row['lang_value'];
}
$db->sql_freeresult($result);
//delete the last value, "not selected"
array_pop($land_option_ary);
// read config table
$sql = 'SELECT * FROM ' . GEOMAP_CONFIG_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$geo_config_ary = array(
'user_color' => strtoupper($row['user_color']),
'admin_color' => strtoupper($row['admin_color']),
'mod_color' => strtoupper($row['mod_color']),
'admin_pixel' => $row['admin_pixel'],
'mod_pixel' => $row['mod_pixel'],
'user_pixel' => $row['user_pixel'],
'map_status' => ($row['active'] == 1 ? true : false),
'inactive_text' => $row['inactive_text'],
'max_latitude' => $row['max_latitude'],
'min_latitude' => $row['min_latitude'],
'max_longitude' => $row['max_longitude'],
'min_longitude' => $row['min_longitude'],
'refresh_interval' => $row['refresh_interval']
);
}
$db->sql_freeresult($result);
// count user
$sql = 'SELECT COUNT(t1.user_id) user_count
FROM ' . PROFILE_FIELDS_DATA_TABLE . ' t1
INNER JOIN ' . USERS_TABLE . ' t2 ON t1.user_id = t2.user_id
WHERE pf_plz > 1067 AND pf_land >0 AND user_inactive_time = 0';
$result = $db->sql_query($sql);
$geo_user_count = $db->sql_fetchfield('user_count');
$db->sql_freeresult($result);
// collect own postcode
$user->get_profile_fields($user->data['user_id']);
$own_plz = (isset($user->profile_fields['pf_plz']) ? $user->profile_fields['pf_plz'] : '');
$no_own_postcode = ($own_plz == '') ? true : false;
// no postcode insert, try to get from user's profile
if (!$post_plz && $own_plz != '')
{
$post_plz = $own_plz;
}
// collect Admins ans Mods
$user_ary_ad_mod = collect_ad_mod_ids($auth);
$admins = $user_ary_ad_mod['a_'];
$mods = $user_ary_ad_mod['m_'];
// collect group informations
$sql = 'SELECT ' . GROUPS_TABLE . '.group_id, ' . GROUPS_TABLE . '.group_name, group_type, color, pixel
FROM ' . GROUPS_TABLE . ' INNER JOIN ' . GEOMAP_GROUPS_TABLE . '
ON ' . GROUPS_TABLE . '.group_id = ' . GEOMAP_GROUPS_TABLE . '.group_id
ORDER BY group_name';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$tmp_group_members = group_memberships($row['group_id'], false);
if(!empty($tmp_group_members))
{
foreach($tmp_group_members as $key => $value)
{
$group_members[] = $tmp_group_members[$key]['user_id'];
}
}
$geo_user_groups[$row['group_id']] = array(
'name' => ($row['group_type'] == 3 ? $user->lang['G_' . $row['group_name']] : $row['group_name']),
'color' => $row['color'],
'pixel' => $row['pixel'],
'members' => $group_members,
);
$group_members = array();
}
// collect board users (width admin or mod rank)
$sql = 'SELECT user_id, username
FROM ' . USERS_TABLE . '
WHERE user_type <> 2';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if(in_array($row['user_id'], $admins))
{
$user_ary[$row['user_id']] = $row['username'] . ' [' . $user->lang['ADMIN'] . ']';
}
elseif(in_array($row['user_id'], $mods))
{
$user_ary[$row['user_id']] = $row['username'] . ' [' . $user->lang['MOD'] . ']';
}
else
{
if (!empty($geo_user_groups))
{
$is_group = false;
foreach ($geo_user_groups as $key => $values)
{
// is this user member of a geomap group?
if(in_array($row['user_id'], $geo_user_groups[$key]['members']))
{
if ($is_group)
{
$user_ary[$row['user_id']] .= ' [' . $geo_user_groups[$key]['name'] . ']';
}
else
{
$user_ary[$row['user_id']] = $row['username'] . ' [' . $geo_user_groups[$key]['name'] . ']';
}
$is_group = true;
}
}
if (!$is_group)
{
$user_ary[$row['user_id']] = $row['username'];
}
}
else
{
$user_ary[$row['user_id']] = $row['username'];
}
}
}
$db->sql_freeresult($result);
// and start
switch ($mode)
{
case 'search':
if ($post_land_id != 0 && $post_plz != 0)
{
// get postcode position
$sql = 'SELECT laenge, breite FROM ' . GEOMAP_POSTCODE_TABLE . "
WHERE plz = $post_plz
AND land = $post_land_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$position_lenght = $row['laenge'];
$position_width = $row['breite'];
$db->sql_freeresult($result);
if ($position_lenght != false && $position_width != false)
{
// get users in radius
$geo_user_search_ary = get_geomap_user($position_lenght, $position_width, $post_distance);
$geo_search_count = count($geo_user_search_ary);
if ($geo_search_count > $config['posts_per_page'])
{
$pagination = generate_pagination(append_sid("{$phpbb_root_path}geomap.$phpEx?mode=search&land=$post_land_id&plz=$post_plz&distance=$post_distance"), $geo_search_count, $config['posts_per_page'], $start);
$geo_user_search_ary = array_slice($geo_user_search_ary, $start, $config['posts_per_page']);
}
}
else
{
// postcode not found
$postcode_not_found = true;
}
}
else
{
// postcode not found
$postcode_not_found = true;
}
break;
case 'profile':
$profile_user_id = request_var('u', 0);
$geo_user_ary = get_geomap_user(false,false,10,0,$profile_user_id);
create_geo_map($geo_user_ary, true);
break;
default:
// check if map need to create new
$current_time = time();
$refresh_interval = $geo_config_ary['refresh_interval'] * 3600;
if( filemtime($phpbb_root_path . 'images/geomap/usermap.png') < ($current_time - $refresh_interval))
{
// get geomap users, sort by lenght, width
$geo_user_ary = get_geomap_user();
create_geo_map($geo_user_ary);
}
break;
}
function create_geo_map($geo_user_ary, $profile = false)
{
global $geo_config_ary, $auth, $phpbb_root_path, $user_ary, $admins, $mods, $phpEx, $db, $user, $geo_user_groups, $map;
// get image and convert it
$image = imagecreatefrompng($phpbb_root_path . 'images/geomap/karte.png');
imgtotruecolor($image);
// define some colors
$white =imagecolorallocate($image, 255, 255, 255);
$grey = imagecolorallocate($image, 50, 50, 50);
// get size of image
$scale_x = imagesx($image);
$scale_y = imagesy($image);
// get user size and color
// admin
$admin_color = hex2rgb($geo_config_ary['admin_color']);
$admin_color = imagecolorallocate($image, $admin_color[0], $admin_color[1], $admin_color[2]);
$admin_pixel_size = $geo_config_ary['admin_pixel'];
// moderator
$mod_color = hex2rgb($geo_config_ary['mod_color']);
$mod_color = imagecolorallocate($image, $mod_color[0], $mod_color[1], $mod_color[2]);
$mod_pixel_size = $geo_config_ary['mod_pixel'];
// user
$user_color = hex2rgb($geo_config_ary['user_color']);
$user_color =imagecolorallocate($image, $user_color[0], $user_color[1], $user_color[2]);
$user_pixel_size = $geo_config_ary['user_pixel'];
// create geomap values
$tmp_last_lenght = $tmp_last_width = $map_key = 0;
$is_admin = $is_mod = $is_group = false;
foreach ($geo_user_ary as $geo_user)
{
// define color and pixelsize for this user
if(in_array($geo_user['user_id'], $admins))
{
$color = $admin_color;
$pixel_size = $admin_pixel_size;
$is_admin = true;
$is_group = false;
}
elseif(in_array($geo_user['user_id'], $mods))
{
$color = $mod_color;
$pixel_size = $mod_pixel_size;
$is_mod = true;
$is_admin = false;
$is_group = false;
}
else
{
$is_group = false;
if (!empty($geo_user_groups))
{
foreach ($geo_user_groups as $key => $values)
{
// is this user member of a geomap group?
if(in_array($geo_user['user_id'], $geo_user_groups[$key]['members']))
{
$color = hex2rgb($geo_user_groups[$key]['color']);
$color = imagecolorallocate($image, $color[0], $color[1], $color[2]);
$pixel_size = $geo_user_groups[$key]['pixel'];
$is_group = true;
}
}
if (!$is_group)
{
$color = $user_color;
$pixel_size = $user_pixel_size;
}
}
else
{
$color = $user_color;
$pixel_size = $user_pixel_size;
}
$is_admin = $is_mod = false;
}
// build value array for usermap
if ($tmp_last_lenght == $geo_user['laenge'] && $tmp_last_width == $geo_user['breite'])
{
$geo_map_values[$map_key]['user_count'] = $geo_map_values[$map_key]['user_count'] + 1;
$geo_map_values[$map_key]['user_desc'] .= ', ' . $user_ary[$geo_user['user_id']] . ' (' . $geo_user['ort'] . ')';
$geo_map_values[$map_key]['pixel_size'] = (($pixel_size / 2) > $geo_map_values[$map_key]['pixel_size'] ? $pixel_size / 2 : $geo_map_values[$map_key]['pixel_size']);
$tmp_status = $geo_map_values[$map_key]['status'];
if ($is_mod && (($tmp_status == 'user') || ($tmp_status == 'ngroup')))
{
$geo_map_values[$map_key]['color'] = $color;
$geo_map_values[$map_key]['status'] = 'mod';
$geo_map_values[$map_key]['pixel_size'] = $pixel_size;
}
if ($is_admin)
{
$geo_map_values[$map_key]['color'] = $color;
$geo_map_values[$map_key]['pixel_size'] = $pixel_size;
$geo_map_values[$map_key]['status'] = 'admin';
}
//if ($is_group && ($tmp_status == 'user'))
if ($is_group && ($tmp_status == 'user') && ($tmp_status != 'admin') && ($tmp_status != 'mod'))
{
$geo_map_values[$map_key]['color'] = $color;
$geo_map_values[$map_key]['status'] = 'ngroup'; // this is a simple trick to put the group status in alphabetical order after the mods
$geo_map_values[$map_key]['pixel_size'] = $pixel_size;
}
}
else
{
$map_key++;
$geo_map_values[$map_key]['user_desc'] = $user_ary[$geo_user['user_id']] . ' (' . $geo_user['ort'] . ')';
$geo_map_values[$map_key]['user_count'] = 1;
$geo_map_values[$map_key]['plz'] = $geo_user['plz'];
$geo_map_values[$map_key]['land'] = $geo_user['land_id'];
$geo_map_values[$map_key]['latitude'] = round(($geo_user['breite'] - $geo_config_ary['max_latitude']) * $scale_y / ($geo_config_ary['min_latitude'] - $geo_config_ary['max_latitude']));
$geo_map_values[$map_key]['longitude'] = round(($geo_user['laenge'] - $geo_config_ary['min_longitude']) * $scale_x / ($geo_config_ary['max_longitude'] - $geo_config_ary['min_longitude']));
$geo_map_values[$map_key]['pixel_size'] = $pixel_size;
$geo_map_values[$map_key]['color'] = $color;
$geo_map_values[$map_key]['status'] = ($is_admin ? 'admin' : ($is_mod ? 'mod' : ($is_group ? 'ngroup' : 'user')));
$tmp_last_lenght = $geo_user['laenge'];
$tmp_last_width = $geo_user['breite'];
}
}
// caption position from left.
$caption_left = 7;
// draw caption on map
imagegradientellipse($image, $caption_left , $scale_y - ($scale_y - 20), $admin_pixel_size, $admin_pixel_size, $white, $admin_color);
imagestring($image, 2, $caption_left + 10, $scale_y - ($scale_y - (20 - $admin_pixel_size / 2)), $user->lang['ADMIN'], $grey);
imagegradientellipse($image, $caption_left , $scale_y - ($scale_y - 40), $mod_pixel_size, $mod_pixel_size, $white, $mod_color);
imagestring($image, 2, $caption_left + 10, $scale_y - ($scale_y - (40 - $mod_pixel_size / 2)), $user->lang['MOD'], $grey);
imagegradientellipse($image, $caption_left , $scale_y - ($scale_y - 60), $user_pixel_size, $user_pixel_size, $white, $user_color);
imagestring($image, 2, $caption_left + 10, $scale_y - ($scale_y - (60 - $user_pixel_size / 2)), $user->lang['USER'], $grey);
//draw groups in caption
$tmp_var = 80;
foreach($geo_user_groups as $key => $value)
{
$color = hex2rgb($geo_user_groups[$key]['color']);
$color = imagecolorallocate($image, $color[0], $color[1], $color[2]);
$pixel_size = $geo_user_groups[$key]['pixel'];
imagegradientellipse($image, $caption_left , $scale_y - ($scale_y - $tmp_var), $pixel_size, $pixel_size, $white, $color);
imagestring($image, 2, $caption_left + 10, $scale_y - ($scale_y - ($tmp_var - $pixel_size / 2)), utf8_decode($geo_user_groups[$key]['name']), $grey);
$tmp_var += 20;
}
// draw users on map
// sort the array, first draw user then mods and finaly admins, so admins are always on top
$geo_map_values = sort_ary_by_field($geo_map_values, 'status', true);
if (is_array($geo_map_values))
{
foreach ($geo_map_values as $value_ary)
{
// create "<map></map>" values
$map .= '<area shape="circle" coords="' . $value_ary['longitude'] . ',' . $value_ary['latitude'] . ', ' . ($value_ary['pixel_size'] / 2) . '" href="' . $phpbb_root_path . 'geomap.' . $phpEx . '?mode=search&land=' . $value_ary['land'] . '&plz=' . $value_ary['plz'] . '&distance=0&sid={U_SESSION_ID}" alt="' . $value_ary['user_desc'] . '" title="' . $value_ary['user_desc'] . '" onmouseover="show_geo_popup(\'' . $value_ary['plz'] . '\',\'' . $value_ary['land'] . '\')" onmouseout="close_geo_popup()" />' . "\n";
imagegradientellipse($image, $value_ary['longitude'], $value_ary['latitude'], $value_ary['pixel_size'], $value_ary['pixel_size'], $white, $value_ary['color']);
imageellipse($image, $value_ary['longitude'], $value_ary['latitude'], $value_ary['pixel_size'], $value_ary['pixel_size'], $grey);
}
// write <area />" values to file
if (!$profile)
{
$handle = fopen ($phpbb_root_path . 'images/geomap/map.html', 'w');
fwrite($handle, $map);
fclose($handle);
}
}
// convert image to palette
imagetruecolortopalette($image,false, 256);
// detect transparency color from the upper left corner and set it
$transparency_color = imagecolorat ($image, 1, 1);
imagecolortransparent($image, $transparency_color);
// save image
if ($profile)
{
imagepng($image, $phpbb_root_path . 'images/geomap/usermap_profile.png');
}
else
{
imagepng($image, $phpbb_root_path . 'images/geomap/usermap.png');
}
imagedestroy($image);
}
// define template values
$template->assign_vars(array(
'MOD_NAME' => 'GeoMap',
'U_FORM_ACTION' => $phpbb_root_path . 'geomap.php',
'RADIUS' => $post_distance,
'S_POSTCODE_NOT_FOUND' => $postcode_not_found,
'POSTCODE' => $post_plz,
'GEO_MAP_VALUES' => str_replace('{U_SESSION_ID}', $user->session_id, ($mode == 'profile' ? $map : file_get_contents($phpbb_root_path . 'images/geomap/map.html'))),
'GEO_USER_COUNT' => sprintf($user->lang['GEO_USER_COUNT'], $geo_user_count),
'S_NO_OWN_POSTCODE' => $no_own_postcode,
'S_SEARCH' => ($mode == 'search' ? true : false),
'S_PROFILE' => ($mode == 'profile' ? true : false),
'PAGINATION' => $pagination,
'GEO_SEARCH_COUNT' => $geo_search_count,
'S_ACTIVE' => $geo_config_ary['map_status'],
'INACTIVE_TEXT' => $geo_config_ary['inactive_text'],
'GEO_INFO' => sprintf($user->lang['GEO_INFO'], $geo_config_ary['refresh_interval']),
'U_SESSION_ID' => $user->session_id,
));
foreach($geo_user_search_ary as $geo_search_user)
{
if ($geo_search_user != '') $template->assign_block_vars('search_result_row', array(
'USER_ID' => $geo_search_user['user_id'],
'USER_NAME' => $user_ary[$geo_search_user['user_id']],
'PLZ' => $geo_search_user['plz'],
'TOWN' => $geo_search_user['ort'],
'LAND_ID' => $geo_search_user['land_id'],
'DISTANCE' => $geo_search_user['distance'],
'U_SEARCH_LINK' => append_sid($phpbb_root_path . 'memberlist.php?mode=viewprofile&u=' . $geo_search_user['user_id']),
));
}
foreach($land_option_ary as $land_id => $land_value)
{
$template->assign_block_vars('land_option', array(
'LAND_ID' => $land_id,
'LAND_VALUE' => $land_value,
'LAND_SELECTED' => ($post_land_id == $land_id ? true : false),
));
}
// start output
page_header('GeoMap');
$template->set_filenames(array(
'body' => 'geomap_body.html')
);
page_footer();
?>
Wie ich gesehen habe hast Du schon richtiger weise auf phpBB.de was zu Geomap geschrieben.Marc wrote:Das sind keine Fehler die durch das Portal verursacht werden.
3nV|Tr0 wrote:Hallo Hallo,
Ich habe indirekt mal wieder das gleiche Problem. Jedoch betrifft es diesmal den "neue beiträge" link.
Angenommen es gibt 3 neue nach dem ich eingelogt bin. Diese Lese ich dann natürlich eifrig. Wenn ich dann auf das Portal wieder gehe müsste eigentlich das "Neue Beiträge" auf 0 stehen, oder ? Das tut es in dem Falle nicht.
Das ist nun mal so, denn diese Funktion wurde so von phpBB übernommen und lediglich in diesen Block eingefügt mit dem Zusatz des Zählers vom Portal.3nV|Tr0 wrote:Das passiert erst dann wenn ich kA mich abgemeldet habe