public function acp_manage_group_display_form($event) { $data = $event['group_row']; $data['group_usermap_marker'] = isset($data['group_usermap_marker']) ? $data['group_usermap_marker'] : ''; $data['group_usermap_legend'] = isset($data['group_usermap_legend']) ? $data['group_usermap_legend'] : ''; $path = $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker/groups/'); $this->template->assign_vars(array('USERMAP_MARKER' => !empty($data['group_usermap_marker']) ? $path . $data['group_usermap_marker'] : $this->path_helper->update_web_root_path($this->phpbb_root_path . '/images/') . 'spacer.gif', 'USERMAP_MARKER_PATH' => $path, 'USERMAP_OPTIONS' => $this->marker_image_select($data['group_usermap_marker'], 'marker/groups/'), 'USERMAP_LEGEND' => $data['group_usermap_legend'])); }
public function add_thing() { if (!$this->auth->acl_get('u_usermap_add_thing')) { trigger_error('NOT_AUTHORISED'); } include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext; include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext; $bbcode_status = $this->config['tas2580_usermap_allow_bbcode']; $url_status = $this->config['tas2580_usermap_allow_urls']; $img_status = $this->config['tas2580_usermap_allow_img']; $flash_status = $this->config['tas2580_usermap_allow_flash']; $smilies_status = $this->config['tas2580_usermap_allow_smilies']; $marker = ''; $this->user->add_lang('posting'); $submit = $this->request->is_set_post('submit'); if ($submit) { $title = $this->request->variable('title', '', true); $message = $this->request->variable('message', '', true); $marker = $this->request->variable('marker', '', true); $data = array('lon' => (double) substr($this->request->variable('lon', ''), 0, 10), 'lat' => (double) substr($this->request->variable('lat', ''), 0, 10)); $validate_array = array('lon' => array('match', false, self::REGEX_LON), 'lat' => array('match', false, self::REGEX_LAT)); if (!function_exists('validate_data')) { include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext; } $error = validate_data($data, $validate_array); if (utf8_clean_string($title) === '') { $error[] = $this->user->lang['EMPTY_SUBJECT']; } if (utf8_clean_string($message) === '') { $error[] = $this->user->lang['TOO_FEW_CHARS']; } if (empty($marker)) { $error[] = $this->user->lang['NEED_MARKER']; } if (sizeof($error)) { $this->template->assign_vars(array('ERROR' => implode('<br />', $error), 'TITLE' => $title, 'MESSAGE' => $message)); } else { generate_text_for_storage($message, $uid, $bitfield, $options, $bbcode_status, $url_status, $smilies_status); $sql_data = array('thing_title' => $title, 'thing_text' => $message, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'thing_lat' => $data['lat'], 'thing_lon' => $data['lon'], 'thing_marker' => $marker, 'thing_user_id' => $this->user->data['user_id']); $sql = 'INSERT INTO ' . $this->things_table . ' ' . $this->db->sql_build_array('INSERT', $sql_data); $this->db->sql_query($sql); $thing_id = $this->db->sql_nextid(); trigger_error($this->user->lang['THING_ADDED'] . '<br /><br />' . '<a href="' . $this->helper->route('tas2580_usermap_thing', array('id' => $thing_id)) . '">' . $this->user->lang['BACK_TO_THING'] . '</a><br /><br />' . '<a href="' . $this->helper->route('tas2580_usermap_index', array()) . '">' . $this->user->lang['BACK_TO_USERMAP'] . '</a>'); } } $path = $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker/things'); generate_smilies('inline', 0); display_custom_bbcodes(); $s_hidden_fields = build_hidden_fields(array('lon' => $this->request->variable('lon', ''), 'lat' => $this->request->variable('lat', ''))); $this->template->assign_vars(array('TITLE' => $this->request->variable('title', '', true), 'MESSAGE' => $this->request->variable('message', '', true), 'MARKER_OPTIONS' => $this->marker_image_select($marker, 'marker/things/'), 'USERMAP_MARKER_PATH' => $path, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => 1, 'BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $bbcode_status && $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'FORM_TITLE' => $this->user->lang('ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name'])))); return $this->helper->render('usermap_thing_form.html', $this->user->lang('ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name']))); }
/** * Add map to users profile * * @param object $event The event object * @return null * @access public */ public function memberlist_view_profile($event) { if ($this->config['tas2580_usermap_map_in_viewprofile'] == 0) { return false; } $data = $event['member']; if (empty($data['user_usermap_lon'])) { return false; } if ($this->user->data['user_usermap_lon'] && $this->user->data['user_id'] != $data['user_id']) { $distance = $this->get_distance($this->user->data['user_usermap_lon'], $this->user->data['user_usermap_lat'], $data['user_usermap_lon'], $data['user_usermap_lat']); } $this->user->add_lang_ext('tas2580/usermap', 'controller'); // Center the map to user $this->template->assign_vars(array('S_IN_USERMAP' => !empty($data['user_usermap_lon']) ? true : false, 'USERMAP_CONTROLS' => 'false', 'USERNAME' => get_username_string('full', $data['user_id'], $data['username'], $data['user_colour']), 'USERMAP_LON' => $data['user_usermap_lon'], 'USERMAP_LAT' => $data['user_usermap_lat'], 'USERMAP_ZOOM' => (int) 10, 'DISTANCE' => isset($distance) ? $distance : '', 'MARKER_PATH' => $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker/groups'), 'GOOGLE_API_KEY' => $this->config['tas2580_usermap_google_api_key'], 'BING_API_KEY' => $this->config['tas2580_usermap_bing_api_key'], 'DEFAULT_MAP' => $this->config['tas2580_usermap_map_type'])); $sql = 'SELECT group_id, group_usermap_marker FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . (int) $data['group_id']; $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $this->template->assign_vars(array('USERMAP_MARKER' => $row['group_usermap_marker'])); }
/** * Display the map * * @return type */ public function index() { if (!$this->auth->acl_get('u_usermap_view')) { trigger_error('NOT_AUTHORISED'); } // Add breadcrumb $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang('USERMAP_TITLE'), 'U_VIEW_FORUM' => $this->helper->route('tas2580_usermap_index', array()))); $sql = 'SELECT group_id, group_name, group_usermap_marker, group_type, group_colour FROM ' . GROUPS_TABLE . "\n\t\t\tWHERE group_usermap_marker != ''\n\t\t\t\tAND group_usermap_legend <> 0\n\t\t\tORDER BY group_name"; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { $group_name = $row['group_type'] == GROUP_SPECIAL ? $this->user->lang('G_' . $row['group_name']) : $row['group_name']; $colour_text = $row['group_colour'] ? ' style="color:#' . $row['group_colour'] . '"' : ''; if ($row['group_name'] == 'BOTS' || $this->user->data['user_id'] != ANONYMOUS && !$this->auth->acl_get('u_viewprofile')) { $legend = '<span' . $colour_text . '>' . $group_name . '</span>'; } else { $legend = '<a' . $colour_text . ' href="' . append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>'; } $this->template->assign_block_vars('group_list', array('GROUP_ID' => $row['group_id'], 'GROUP_NAME' => $legend, 'ALT' => $group_name, 'MARKER' => 'groups/' . $row['group_usermap_marker'])); } $this->template->assign_vars(array('USERMAP_CONTROLS' => 'true', 'S_IN_USERMAP' => true, 'USERMAP_LON' => empty($this->config['tas2580_usermap_lon']) ? 0 : $this->config['tas2580_usermap_lon'], 'USERMAP_LAT' => empty($this->config['tas2580_usermap_lat']) ? 0 : $this->config['tas2580_usermap_lat'], 'USERMAP_ZOOM' => (int) $this->config['tas2580_usermap_zoom'], 'MARKER_PATH' => $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker'), 'A_USERMAP_ADD' => $this->user->data['user_id'] != ANONYMOUS && $this->auth->acl_get('u_usermap_add'), 'A_USERMAP_ADD_THING' => $this->auth->acl_get('u_usermap_add_thing'), 'A_USERMAP_SEARCH' => $this->auth->acl_get('u_usermap_search'), 'S_CAN_ADD' => empty($this->user->data['user_usermap_lon']) || empty($this->user->data['user_usermap_lat']), 'U_SET_POSITON' => $this->helper->route('tas2580_usermap_position', array('p' => 'p')), 'U_USERMAP_ADD_THING' => $this->helper->route('tas2580_usermap_add_thing', array('p' => 'p')), 'U_GET_MARKER' => $this->helper->route('tas2580_usermap_get_marker', array('p' => 'p')), 'MAP_TYPE' => $this->config['tas2580_usermap_map_type'], 'GOOGLE_API_KEY' => $this->config['tas2580_usermap_google_api_key'], 'BING_API_KEY' => $this->config['tas2580_usermap_bing_api_key'], 'DEFAULT_MAP' => $this->config['tas2580_usermap_map_type'], 'U_USERMAP_SEARCH' => $this->helper->route('tas2580_usermap_search', array('p' => 'p')), 'L_MENU_SEARCH' => $this->user->lang('MENU_SEARCH', $this->config['tas2580_usermap_search_distance']), 'L_MENU_ADD_THING' => $this->user->lang('MENU_ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name'])))); return $this->helper->render('usermap_body.html', $this->user->lang('USERMAP_TITLE')); }