示例#1
0
 /**
  * Assign global template vars, based on the ACP config of the extension
  */
 public function global_style_append()
 {
     $pbwow_config = $this->pbwow_config;
     if (isset($pbwow_config) && is_array($pbwow_config)) {
         extract($pbwow_config);
     } else {
         return;
     }
     $tpl_vars = array();
     $body_class = ' pbwow-ext';
     // Logo
     if ($logo_enable && isset($logo_src) && isset($logo_size_width) && isset($logo_size_height) && $logo_size_width > 1 && $logo_size_height > 1) {
         $tpl_vars += array('S_PBLOGO' => true, 'PBLOGO_SRC' => $this->path_helper->update_web_root_path($this->root_path . html_entity_decode($logo_src)), 'PBLOGO_WIDTH' => $logo_size_width, 'PBLOGO_HEIGHT' => $logo_size_height, 'PBLOGO_WIDTH_MOB' => floor($logo_size_width * 0.8), 'PBLOGO_HEIGHT_MOB' => floor($logo_size_height * 0.8), 'PBLOGO_MARGINS' => $logo_margins);
         if (isset($logo_margins) && strlen($logo_margins) > 0) {
             $tpl_vars += array('PBLOGO_MARGINS' => $logo_margins);
         }
     }
     // Top-bar
     if ($topbar_enable && isset($topbar_code)) {
         $tpl_vars += array('TOPBAR_CODE' => str_replace('&', '&', html_entity_decode($topbar_code)));
         $body_class .= ' topbar';
         if ($topbar_fixed) {
             $tpl_vars += array('S_TOPBAR_FIXED' => true);
             $body_class .= ' topbar-fixed';
         }
     }
     // Video BG
     if ($videobg_enable) {
         $tpl_vars += array('S_VIDEOBG' => true);
         $body_class .= ' videobg';
         if ($videobg_allpages) {
             $tpl_vars += array('S_VIDEOBG_ALL' => true);
             $body_class .= ' videobg-all';
         }
     }
     // Fixed BG
     if ($fixedbg) {
         $tpl_vars += array('S_FIXEDBG' => true);
         $body_class .= ' fixedbg';
         if ($topbar_enable && !$topbar_fixed) {
             // if we don't do this, scrolling down will look weird
             $body_class .= ' topbar-fixed';
         }
     }
     // Misc
     $tpl_vars += array('HEADERLINKS_CODE' => $headerlinks_enable && isset($headerlinks_code) ? str_replace('&', '&', html_entity_decode($headerlinks_code)) : false, 'ADS_INDEX_CODE' => $ads_index_enable && isset($ads_index_code) ? str_replace('&', '&', html_entity_decode($ads_index_code)) : false, 'S_PBWOW_AVATARS' => isset($avatars_enable) ? $avatars_enable : false, 'S_SMALL_RANKS' => isset($smallranks_enable) && $this->avatars_enabled ? $smallranks_enable : false);
     // Assign vars
     $this->template->assign_vars($tpl_vars);
     $this->template->append_var('BODY_CLASS', $body_class);
 }
 /**
  * Constructor
  *
  * @param \phpbb\config\config			$config				Config object
  * @param \phpbb\controller\helper		$helper				Controller helper object
  * @param \phpbb\cache\service			$cache				Cache object
  * @param \phpbb\db\driver\driver		$db					Database object
  * @param \phpbb\template\template		$template			Template object
  * @param \phpbb\user					$user				User object
  * @param string						$flags_table		Name of the table used to store flag data
  * @param \phpbb\extension\manager		$ext_manager		Extension manager object
  * @param \phpbb\path_helper			$path_helper		Path helper object
  */
 public function __construct(\phpbb\config\config $config, \phpbb\controller\helper $helper, \phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, $flags_table, \phpbb\extension\manager $ext_manager, \phpbb\path_helper $path_helper)
 {
     $this->config = $config;
     $this->helper = $helper;
     $this->cache = $cache;
     $this->db = $db;
     $this->template = $template;
     $this->user = $user;
     $this->flags_table = $flags_table;
     $this->ext_manager = $ext_manager;
     $this->path_helper = $path_helper;
     $this->ext_path = $this->ext_manager->get_extension_path('rmcgirr83/nationalflags', true);
     $this->ext_path_web = $this->path_helper->update_web_root_path($this->ext_path);
 }
示例#3
0
 /**
  * Constructor
  *
  * @param template		$template
  * @param user			$user
  * @param db_driver		$db
  * @param auth			$auth
  * @param request		$request
  * @param helper		$helper
  * @param db			$config
  * @param manager		$ext_manager
  * @param path_helper	$path_helper
  * @param Container		$container
  * @param string		$table_prefix
  * @param string		$root_path
  * @param string		$php_ext
  */
 public function __construct(template $template, user $user, db_driver $db, auth $auth, request $request, helper $helper, db $config, manager $ext_manager, path_helper $path_helper, Container $container, $table_prefix, $root_path, $php_ext)
 {
     $this->template = $template;
     $this->user = $user;
     $this->db = $db;
     $this->auth = $auth;
     $this->request = $request;
     $this->helper = $helper;
     $this->config = $config;
     $this->root_path = $root_path;
     $this->php_ext = $php_ext;
     $this->ext_manager = $ext_manager;
     $this->path_helper = $path_helper;
     $this->container = $container;
     $this->table_prefix = $table_prefix;
     $this->user->add_lang('posting');
     $this->user->add_lang_ext('spaceace/ajaxchat', 'ajax_chat');
     // sets desired status times
     $this->times = ['online' => $this->config['status_online_chat'], 'idle' => $this->config['status_idle_chat'], 'offline' => $this->config['status_offline_chat']];
     //set delay for each status
     $this->delay = ['online' => $this->config['delay_online_chat'], 'idle' => $this->config['delay_idle_chat'], 'offline' => $this->config['delay_offline_chat']];
     if (!defined('CHAT_TABLE')) {
         $chat_table = $this->table_prefix . 'ajax_chat';
         define('CHAT_TABLE', $chat_table);
     }
     if (!defined('CHAT_SESSIONS_TABLE')) {
         $chat_session_table = $this->table_prefix . 'ajax_chat_sessions';
         define('CHAT_SESSIONS_TABLE', $chat_session_table);
     }
     include $this->root_path . 'includes/functions_posting.' . $this->php_ext;
     include $this->root_path . 'includes/functions_display.' . $this->php_ext;
     $this->ext_path = $this->ext_manager->get_extension_path('spaceace/ajaxchat', true);
     $this->ext_path_web = $this->path_helper->update_web_root_path($this->ext_path);
     $this->post = $this->request->get_super_global(\phpbb\request\request_interface::POST);
 }
示例#4
0
 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']));
 }
示例#5
0
文件: thing.php 项目: tas2580/usermap
    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'])));
    }
示例#6
0
    public function index()
    {
        if (!$this->auth->acl_get('u_usermap_view')) {
            trigger_error('NOT_AUTHORISED');
        }
        $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\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&amp;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' => $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_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()), 'U_GET_MARKER' => $this->helper->route('tas2580_usermap_get_marker', array()), 'MAP_TYPE' => $this->config['tas2580_usermap_map_type'], 'GOOGLE_API_KEY' => $this->config['tas2580_usermap_google_api_key'], 'U_USERMAP_SEARCH' => $this->helper->route('tas2580_usermap_search', array()), 'L_MENU_SEARCH' => $this->user->lang('MENU_SEARCH', $this->config['tas2580_usermap_search_distance'])));
        return $this->helper->render('usermap_body.html', $this->user->lang('USERMAP_TITLE'));
    }
示例#7
0
    /**
     * 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'];
        $this->user->add_lang_ext('tas2580/usermap', 'controller');
        $distance = $this->get_distance($this->user->data['user_usermap_lon'], $this->user->data['user_usermap_lat'], $data['user_usermap_lon'], $data['user_usermap_lat']);
        // Center the map to user
        $this->template->assign_vars(array('S_IN_USERMAP' => true, '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' => $distance, 'MARKER_PATH' => $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker'), 'MAP_TYPE' => $this->config['tas2580_usermap_map_type'], 'GOOGLE_API_KEY' => $this->config['tas2580_usermap_google_api_key']));
        $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']));
    }
 /**
  * Constructor
  *
  * @param \phpbb\cache\service					$cache				Cache object
  * @param \phpbb\config\config					$config				Config object
  * @param \phpbb\db\driver\driver_interface		$db					Database object
  * @param \phpbb\pagination						$pagination			Pagination object
  * @param \phpbb\controller\helper           	$helper     	    Controller helper object
  * @param \phpbb\request\request					$request			Request object
  * @param \phpbb\template\template				$template			Template object
  * @param \phpbb\user							$user				User object
  * @param \phpbb\log								$log				Log object
  * @param \phpbb\extension\manager				$ext_manager		Extension manager object
  * @param \phpbb\path_helper						$path_helper		Path helper object
  * @param string                             	$root_path      	phpBB root path
  * @param string                             	$php_ext        	phpEx
  * @param string									$flags_table		Name of the table used to store flag data
  * @param \rmcgirr83\nationalflags\core\nationalflags	$functions	Functions for the extension
  * @return \rmcgirr83\nationalflags\controller\admin_controller
  * @access public
  */
 public function __construct(\phpbb\cache\service $cache, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\pagination $pagination, \phpbb\controller\helper $helper, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \phpbb\log\log $log, \phpbb\extension\manager $ext_manager, \phpbb\path_helper $path_helper, $root_path, $php_ext, $flags_table, \rmcgirr83\nationalflags\core\nationalflags $functions)
 {
     $this->cache = $cache;
     $this->config = $config;
     $this->db = $db;
     $this->pagination = $pagination;
     $this->helper = $helper;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->log = $log;
     $this->ext_manager = $ext_manager;
     $this->path_helper = $path_helper;
     $this->root_path = $root_path;
     $this->php_ext = $php_ext;
     $this->flags_table = $flags_table;
     $this->functions = $functions;
     $this->ext_path = $this->ext_manager->get_extension_path('rmcgirr83/nationalflags', true);
     $this->ext_path_web = $this->path_helper->update_web_root_path($this->ext_path);
 }
示例#9
0
 /**
  * Rewrite links to forums and subforums in forum index
  * also correct the path of the forum images if we are in a forum
  *
  * @param	object	$event	The event object
  * @return	null
  * @access	public
  */
 public function display_forums_modify_template_vars($event)
 {
     $subforums_row = $event['subforums_row'];
     $forum_row = $event['forum_row'];
     // Rewrite URLs of sub forums
     foreach ($subforums_row as $i => $subforum) {
         // A little bit a dirty way, but there is no better solution
         $query = str_replace('&amp;', '&', parse_url($subforum['U_SUBFORUM'], PHP_URL_QUERY));
         parse_str($query, $id);
         $subforums_row[$i]['U_SUBFORUM'] = append_sid($this->base->generate_forum_link($id['f'], $subforum['SUBFORUM_NAME']));
     }
     // Update the image source in forums
     $img = $this->path_helper->update_web_root_path($forum_row['FORUM_IMAGE_SRC']);
     $forum_row['FORUM_IMAGE'] = preg_replace('#img src=\\"(.*)\\" alt#', 'img src="' . $img . '" alt', $forum_row['FORUM_IMAGE']);
     // Rewrite links to topics, posts and forums
     $replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1;
     $url = $this->base->generate_topic_link($event['row']['forum_id_last_post'], $event['row']['forum_name_last_post'], $event['row']['topic_id_last_post'], $event['row']['topic_title_last_post']);
     $forum_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($replies, $url) . '#p' . $event['row']['forum_last_post_id']);
     $forum_row['U_VIEWFORUM'] = append_sid($this->base->generate_forum_link($forum_row['FORUM_ID'], $forum_row['FORUM_NAME']));
     $event['subforums_row'] = $subforums_row;
     $event['forum_row'] = $forum_row;
 }
示例#10
0
 private function marker_image_select($marker)
 {
     $path = $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker/');
     $imglist = filelist($path);
     $edit_img = $filename_list = '';
     foreach ($imglist as $path => $img_ary) {
         sort($img_ary);
         foreach ($img_ary as $img) {
             $img = $path . $img;
             if ($img == $marker) {
                 $selected = ' selected="selected"';
                 $edit_img = $img;
             } else {
                 $selected = '';
             }
             if (strlen($img) > 255) {
                 continue;
             }
             $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>';
         }
     }
     return '<option value=""' . ($edit_img == '' ? ' selected="selected"' : '') . '>----------</option>' . $filename_list;
 }
示例#11
0
 /**
  * @dataProvider basic_update_web_root_path_data
  */
 public function test_basic_update_web_root_path($input, $expected)
 {
     $this->assertEquals($expected, $this->path_helper->update_web_root_path($input));
 }
 /**
  * Get URL
  *
  * @return string URL
  */
 public function get_url()
 {
     return $this->path_helper->update_web_root_path($this->join_url($this->components));
 }