当前位置: 首页>>代码示例>>PHP>>正文


PHP user_ipwhois函数代码示例

本文整理汇总了PHP中user_ipwhois函数的典型用法代码示例。如果您正苦于以下问题:PHP user_ipwhois函数的具体用法?PHP user_ipwhois怎么用?PHP user_ipwhois使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了user_ipwhois函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_data_for_page

    /**
     * Method to render the page data
     *
     * @var bool		Bool if the rendering is only for index
     * @return array	Data for page rendering
     */
    public function render_data_for_page($only_for_index = false)
    {
        $include_on_index = $only_for_index === true;
        // Add lang file
        $this->user->add_lang('posting');
        //chat enabled
        if (!$this->config['mchat_enable']) {
            trigger_error($this->user->lang['MCHAT_ENABLE'], E_USER_NOTICE);
        }
        //	avatars
        if (!function_exists('get_user_avatar')) {
            include $this->phpbb_root_path . 'includes/functions_display.' . $this->phpEx;
        }
        if (($this->config_mchat = $this->cache->get('_mchat_config')) === false) {
            $this->functions_mchat->mchat_cache();
        }
        $this->config_mchat = $this->cache->get('_mchat_config');
        // Access rights
        $mchat_allow_bbcode = $this->config['allow_bbcode'] && $this->auth->acl_get('u_mchat_bbcode') ? true : false;
        $mchat_smilies = $this->config['allow_smilies'] && $this->auth->acl_get('u_mchat_smilies') ? true : false;
        $mchat_urls = $this->config['allow_post_links'] && $this->auth->acl_get('u_mchat_urls') ? true : false;
        $mchat_ip = $this->auth->acl_get('u_mchat_ip') ? true : false;
        $mchat_pm = $this->auth->acl_get('u_mchat_pm') ? true : false;
        $mchat_like = $this->auth->acl_get('u_mchat_like') ? true : false;
        $mchat_quote = $this->auth->acl_get('u_mchat_quote') ? true : false;
        $mchat_add_mess = $this->auth->acl_get('u_mchat_use') ? true : false;
        $mchat_view = $this->auth->acl_get('u_mchat_view') ? true : false;
        $mchat_no_flood = $this->auth->acl_get('u_mchat_flood_ignore') ? true : false;
        $mchat_read_archive = $this->auth->acl_get('u_mchat_archive') ? true : false;
        $mchat_founder = $this->user->data['user_type'] == USER_FOUNDER ? true : false;
        $mchat_session_time = !empty($this->config_mchat['timeout']) ? $this->config_mchat['timeout'] : (!empty($this->config['load_online_time']) ? $this->config['load_online_time'] * 60 : $this->config['session_length']);
        $mchat_rules = !empty($this->config_mchat['rules']) || isset($this->user->lang[strtoupper('mchat_rules')]) ? true : false;
        $mchat_avatars = !empty($this->config_mchat['avatars']) && $this->user->optionget('viewavatars') && $this->user->data['user_mchat_avatars'] ? true : false;
        // needed variables
        // Request options.
        $mchat_mode = $this->request->variable('mode', '');
        $mchat_read_mode = $mchat_archive_mode = $mchat_custom_page = $mchat_no_message = false;
        // set redirect if on index or custom page
        $on_page = $include_on_index ? 'index' : 'mchat';
        // grab fools..uhmmm, foes the user has
        $foes_array = array();
        $sql = 'SELECT * FROM ' . ZEBRA_TABLE . '
			WHERE user_id = ' . $this->user->data['user_id'] . '	AND foe = 1';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $foes_array[] = $row['zebra_id'];
        }
        $this->db->sql_freeresult($result);
        // Request mode...
        switch ($mchat_mode) {
            // rules popup..
            case 'rules':
                // If the rules are defined in the language file use them, else just use the entry in the database
                if ($mchat_rules || isset($this->user->lang[strtoupper('mchat_rules')])) {
                    if (isset($this->user->lang[strtoupper('mchat_rules')])) {
                        $this->template->assign_var('MCHAT_RULES', $this->user->lang[strtoupper('mchat_rules')]);
                    } else {
                        $mchat_rules = $this->config_mchat['rules'];
                        $mchat_rules = explode("\n", $mchat_rules);
                        foreach ($mchat_rules as $mchat_rule) {
                            $mchat_rule = utf8_htmlspecialchars($mchat_rule);
                            $this->template->assign_block_vars('rule', array('MCHAT_RULE' => $mchat_rule));
                        }
                    }
                    // Output the page
                    // Return for: \$this->helper->render(filename, lang_title);
                    return array('filename' => 'mchat_rules.html', 'lang_title' => $this->user->lang['MCHAT_HELP']);
                } else {
                    // Show no rules
                    trigger_error('MCHAT_NO_RULES', E_USER_NOTICE);
                }
                break;
                // whois function..
            // whois function..
            case 'whois':
                // Must have auths
                if ($mchat_mode == 'whois' && $mchat_ip) {
                    // function already exists..
                    if (!function_exists('user_ipwhois')) {
                        include $this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx;
                    }
                    $this->user_ip = $this->request->variable('ip', '');
                    $this->template->assign_var('WHOIS', user_ipwhois($this->user_ip));
                    // Output the page
                    // Return for: \$this->helper->render(filename, lang_title);
                    return array('filename' => 'viewonline_whois.html', 'lang_title' => $this->user->lang['WHO_IS_ONLINE']);
                } else {
                    // Show not authorized
                    trigger_error('NO_AUTH_OPERATION', E_USER_NOTICE);
                }
                break;
                // Clean function...
            // Clean function...
            case 'clean':
//.........这里部分代码省略.........
开发者ID:ezpz-cz,项目名称:web-plugins,代码行数:101,代码来源:render_helper.php

示例2: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template;
        global $phpbb_root_path, $phpbb_admin_path, $phpEx;
        global $phpbb_dispatcher, $request;
        global $phpbb_container, $phpbb_log;
        $user->add_lang(array('posting', 'ucp', 'acp/users'));
        $this->tpl_name = 'acp_users';
        $error = array();
        $username = $request->variable('username', '', true);
        $user_id = $request->variable('u', 0);
        $action = $request->variable('action', '');
        // Get referer to redirect user to the appropriate page after delete action
        $redirect = $request->variable('redirect', '');
        $redirect_tag = "redirect={$redirect}";
        $redirect_url = append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$redirect}");
        $submit = isset($_POST['update']) && !isset($_POST['cancel']) ? true : false;
        $form_name = 'acp_users';
        add_form_key($form_name);
        // Whois (special case)
        if ($action == 'whois') {
            if (!function_exists('user_get_id_name')) {
                include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
            }
            $this->page_title = 'WHOIS';
            $this->tpl_name = 'simple_body';
            $user_ip = phpbb_ip_normalise($request->variable('user_ip', ''));
            $domain = gethostbyaddr($user_ip);
            $ipwhois = user_ipwhois($user_ip);
            $template->assign_vars(array('MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain), 'MESSAGE_TEXT' => nl2br($ipwhois)));
            return;
        }
        // Show user selection mask
        if (!$username && !$user_id) {
            $this->page_title = 'SELECT_USER';
            $template->assign_vars(array('U_ACTION' => $this->u_action, 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_USER' => true, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&form=select_user&field=username&select_single=true')));
            return;
        }
        if (!$user_id) {
            $sql = 'SELECT user_id
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_id = (int) $db->sql_fetchfield('user_id');
            $db->sql_freeresult($result);
            if (!$user_id) {
                trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
            }
        }
        // Generate content for all modes
        $sql = 'SELECT u.*, s.*
			FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
			WHERE u.user_id = ' . $user_id . '
			ORDER BY s.session_time DESC';
        $result = $db->sql_query_limit($sql, 1);
        $user_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!$user_row) {
            trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
        }
        // Generate overall "header" for user admin
        $s_form_options = '';
        // Build modes dropdown list
        $sql = 'SELECT module_mode, module_auth
			FROM ' . MODULES_TABLE . "\n\t\t\tWHERE module_basename = 'acp_users'\n\t\t\t\tAND module_enabled = 1\n\t\t\t\tAND module_class = 'acp'\n\t\t\tORDER BY left_id, module_mode";
        $result = $db->sql_query($sql);
        $dropdown_modes = array();
        while ($row = $db->sql_fetchrow($result)) {
            if (!$this->p_master->module_auth_self($row['module_auth'])) {
                continue;
            }
            $dropdown_modes[$row['module_mode']] = true;
        }
        $db->sql_freeresult($result);
        foreach ($dropdown_modes as $module_mode => $null) {
            $selected = $mode == $module_mode ? ' selected="selected"' : '';
            $s_form_options .= '<option value="' . $module_mode . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($module_mode)] . '</option>';
        }
        $template->assign_vars(array('U_BACK' => empty($redirect) ? $this->u_action : $redirect_url, 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&amp;u={$user_id}"), 'U_ACTION' => $this->u_action . '&amp;u=' . $user_id . (empty($redirect) ? '' : '&amp;' . $redirect_tag), 'S_FORM_OPTIONS' => $s_form_options, 'MANAGED_USERNAME' => $user_row['username']));
        // Prevent normal users/admins change/view founders if they are not a founder by themselves
        if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) {
            trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING);
        }
        $this->page_title = $user_row['username'] . ' :: ' . $user->lang('ACP_USER_' . strtoupper($mode));
        switch ($mode) {
            case 'overview':
                if (!function_exists('user_get_id_name')) {
                    include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                }
                $user->add_lang('acp/ban');
                $delete = $request->variable('delete', 0);
                $delete_type = $request->variable('delete_type', '');
                $ip = $request->variable('ip', 'ip');
                /**
                 * Run code at beginning of ACP users overview
                 *
                 * @event core.acp_users_overview_before
                 * @var	array   user_row    Current user data
                 * @var	string  mode        Active module
                 * @var	string  action      Module that should be run
//.........这里部分代码省略.........
开发者ID:bantu,项目名称:phpbb,代码行数:101,代码来源:acp_users.php

示例3: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $cache;
        global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
        $user->add_lang(array('posting', 'ucp', 'acp/users'));
        $this->tpl_name = 'acp_users';
        $this->page_title = 'ACP_USER_' . strtoupper($mode);
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
        $error = array();
        $username = request_var('username', '', true);
        $user_id = request_var('u', 0);
        $action = request_var('action', '');
        $submit = isset($_POST['update']) ? true : false;
        // Whois (special case)
        if ($action == 'whois') {
            $this->page_title = 'WHOIS';
            $this->tpl_name = 'simple_body';
            $user_ip = request_var('user_ip', '');
            $domain = gethostbyaddr($user_ip);
            $ipwhois = '';
            if ($ipwhois = user_ipwhois($user_ip)) {
                $ipwhois = preg_replace('#(\\s)([\\w\\-\\._\\+]+@[\\w\\-\\.]+)(\\s)#', '\\1<a href="mailto:\\2">\\2</a>\\3', $ipwhois);
                $ipwhois = preg_replace('#(\\s)(http:/{2}[^\\s]*)(\\s)#', '\\1<a href="\\2" target="_blank">\\2</a>\\3', $ipwhois);
            }
            $template->assign_vars(array('MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain), 'MESSAGE_TEXT' => nl2br($ipwhois)));
            return;
        }
        // Show user selection mask
        if (!$username && !$user_id) {
            $this->page_title = 'SELECT_USER';
            $template->assign_vars(array('U_ACTION' => $this->u_action, 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_USER' => true, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=select_user&amp;field=username')));
            return;
        }
        if (!$user_id) {
            $sql = 'SELECT user_id
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE username = '" . $db->sql_escape($username) . "'";
            $result = $db->sql_query($sql);
            $user_id = (int) $db->sql_fetchfield('user_id');
            $db->sql_freeresult($result);
            if (!$user_id) {
                trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action));
            }
        }
        // Generate content for all modes
        $sql = 'SELECT u.*, s.*
			FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
			WHERE u.user_id = ' . $user_id . '
			ORDER BY s.session_time DESC';
        $result = $db->sql_query($sql);
        $user_row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!$user_row) {
            trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action));
        }
        // Generate overall "header" for user admin
        $s_form_options = '';
        // Include info file...
        include_once $phpbb_root_path . 'includes/acp/info/acp_users.' . $phpEx;
        $forms_ary = acp_users_info::module();
        foreach ($forms_ary['modes'] as $value => $ary) {
            if (!$this->is_authed($ary['auth'])) {
                continue;
            }
            $selected = $mode == $value ? ' selected="selected"' : '';
            $s_form_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($value)] . '</option>';
        }
        $template->assign_vars(array('U_BACK' => $this->u_action, 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&amp;u={$user_id}"), 'U_ACTION' => $this->u_action . '&amp;u=' . $user_id, 'S_FORM_OPTIONS' => $s_form_options));
        // Prevent normal users/admins change/view founders if they are not a founder by themselves
        if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) {
            trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action));
        }
        switch ($mode) {
            case 'overview':
                $delete = request_var('delete', 0);
                $delete_type = request_var('delete_type', '');
                $ip = request_var('ip', 'ip');
                if ($submit) {
                    // You can't delete the founder
                    if ($delete && $user_row['user_type'] != USER_FOUNDER) {
                        if (!$auth->acl_get('a_userdel')) {
                            trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                        }
                        // Check if the user wants to remove himself or the guest user account
                        if ($user_id == ANONYMOUS) {
                            trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                        }
                        if ($user_id == $user->data['user_id']) {
                            trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
                        }
                        if (confirm_box(true)) {
                            user_delete($delete_type, $user_id);
                            add_log('admin', 'LOG_USER_DELETED', $user_row['username']);
                            trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action));
                        } else {
                            confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true, 'delete' => 1, 'delete_type' => $delete_type)));
                        }
                    }
                    // Handle quicktool actions
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:acp_users.php

示例4: array

$viewonline_helper = $phpbb_container->get('viewonline_helper');
$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_JOINED'], 'c' => $user->lang['SORT_LOCATION']);
$sort_key_sql = array('a' => 'u.username_clean', 'b' => 's.session_time', 'c' => 's.session_page');
// Sorting and order
if (!isset($sort_key_text[$sort_key])) {
    $sort_key = 'b';
}
$order_by = $sort_key_sql[$sort_key] . ' ' . ($sort_dir == 'a' ? 'ASC' : 'DESC');
// Whois requested
if ($mode == 'whois' && $auth->acl_get('a_') && $session_id) {
    include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
    $sql = 'SELECT u.user_id, u.username, u.user_type, s.session_ip
		FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . " s\n\t\tWHERE s.session_id = '" . $db->sql_escape($session_id) . "'\n\t\t\tAND\tu.user_id = s.session_user_id";
    $result = $db->sql_query($sql);
    if ($row = $db->sql_fetchrow($result)) {
        $template->assign_var('WHOIS', user_ipwhois($row['session_ip']));
    }
    $db->sql_freeresult($result);
    // Output the page
    page_header($user->lang['WHO_IS_ONLINE']);
    $template->set_filenames(array('body' => 'viewonline_whois.html'));
    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.{$phpEx}"));
    page_footer();
}
$user->update_session_infos();
// Forum info
$sql_ary = array('SELECT' => 'f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id', 'FROM' => array(FORUMS_TABLE => 'f'), 'ORDER_BY' => 'f.left_id ASC');
/**
* Modify the forum data SQL query for getting additional fields if needed
*
* @event core.viewonline_modify_forum_data_sql
开发者ID:phpbb,项目名称:phpbb,代码行数:31,代码来源:viewonline.php

示例5: main

	function main($id, $mode)
	{
		global $config, $db, $user, $auth, $template, $cache;
		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;

		$user->add_lang(array('posting', 'ucp', 'acp/users'));
		$this->tpl_name = 'acp_users';
		$this->page_title = 'ACP_USER_' . strtoupper($mode);

		$error		= array();
		$username	= utf8_normalize_nfc(request_var('username', '', true));
		$user_id	= request_var('u', 0);
		$action		= request_var('action', '');

		$submit		= (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false;

		$form_name = 'acp_users';
		add_form_key($form_name);

		// Whois (special case)
		if ($action == 'whois')
		{
			include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

			$this->page_title = 'WHOIS';
			$this->tpl_name = 'simple_body';

			$user_ip = request_var('user_ip', '');
			$domain = gethostbyaddr($user_ip);
			$ipwhois = user_ipwhois($user_ip);

			$template->assign_vars(array(
				'MESSAGE_TITLE'		=> sprintf($user->lang['IP_WHOIS_FOR'], $domain),
				'MESSAGE_TEXT'		=> nl2br($ipwhois))
			);

			return;
		}

		// Show user selection mask
		if (!$username && !$user_id)
		{
			$this->page_title = 'SELECT_USER';

			$template->assign_vars(array(
				'U_ACTION'			=> $this->u_action,
				'ANONYMOUS_USER_ID'	=> ANONYMOUS,

				'S_SELECT_USER'		=> true,
				'U_FIND_USERNAME'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=select_user&amp;field=username&amp;select_single=true'),
			));

			return;
		}

		if (!$user_id)
		{
			$sql = 'SELECT user_id
				FROM ' . USERS_TABLE . "
				WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
			$result = $db->sql_query($sql);
			$user_id = (int) $db->sql_fetchfield('user_id');
			$db->sql_freeresult($result);

			if (!$user_id)
			{
				trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
			}
		}

		// Generate content for all modes
		$sql = 'SELECT u.*, s.*
			FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
			WHERE u.user_id = ' . $user_id . '
			ORDER BY s.session_time DESC';
		$result = $db->sql_query($sql);
		$user_row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		if (!$user_row)
		{
			trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
		}

		// Generate overall "header" for user admin
		$s_form_options = '';

		// Build modes dropdown list
		$sql = 'SELECT module_mode, module_auth
			FROM ' . MODULES_TABLE . "
			WHERE module_basename = 'users'
				AND module_enabled = 1
				AND module_class = 'acp'
			ORDER BY left_id, module_mode";
		$result = $db->sql_query($sql);

		$dropdown_modes = array();
		while ($row = $db->sql_fetchrow($result))
		{
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:acp_users.php

示例6: mcp_post_details

/**
* Handling actions in post details screen
*/
function mcp_post_details($id, $mode, $action)
{
    global $phpEx, $phpbb_root_path, $config;
    global $template, $db, $user, $auth, $cache;
    $user->add_lang('posting');
    $post_id = request_var('p', 0);
    $start = request_var('start', 0);
    // Get post data
    $post_info = get_post_data(array($post_id), false, true);
    add_form_key('mcp_post_details');
    if (!sizeof($post_info)) {
        trigger_error('POST_NOT_EXIST');
    }
    $post_info = $post_info[$post_id];
    $url = append_sid("{$phpbb_root_path}mcp.{$phpEx}?" . extra_url());
    switch ($action) {
        case 'whois':
            if ($auth->acl_get('m_info', $post_info['forum_id'])) {
                $ip = request_var('ip', '');
                include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                $template->assign_vars(array('RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&amp;mode={$mode}&amp;p={$post_id}") . '">', '</a>'), 'U_RETURN_POST' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&amp;mode={$mode}&amp;p={$post_id}"), 'L_RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), 'WHOIS' => user_ipwhois($ip)));
            }
            // We're done with the whois page so return
            return;
            break;
        case 'chgposter':
        case 'chgposter_ip':
            if ($action == 'chgposter') {
                $username = request_var('username', '', true);
                $sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            } else {
                $new_user_id = request_var('u', 0);
                $sql_where = 'user_id = ' . $new_user_id;
            }
            $sql = 'SELECT *
				FROM ' . USERS_TABLE . '
				WHERE ' . $sql_where;
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$row) {
                trigger_error('NO_USER');
            }
            if ($auth->acl_get('m_chgposter', $post_info['forum_id'])) {
                if (check_form_key('mcp_post_details')) {
                    change_poster($post_info, $row);
                } else {
                    trigger_error('FORM_INVALID');
                }
            }
            break;
    }
    // Set some vars
    $users_ary = $usernames_ary = array();
    $attachments = $extensions = array();
    $post_id = $post_info['post_id'];
    $topic_tracking_info = array();
    // Get topic tracking info
    if ($config['load_db_lastread']) {
        $tmp_topic_data = array($post_info['topic_id'] => $post_info);
        $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
        unset($tmp_topic_data);
    } else {
        $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
    }
    $post_unread = isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']] ? true : false;
    // Process message, leave it uncensored
    $message = $post_info['post_text'];
    if ($post_info['bbcode_bitfield']) {
        include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
        $bbcode = new bbcode($post_info['bbcode_bitfield']);
        $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
    }
    $message = bbcode_nl2br($message);
    $message = smiley_text($message);
    if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) {
        $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
        $sql = 'SELECT *
			FROM ' . ATTACHMENTS_TABLE . '
			WHERE post_msg_id = ' . $post_id . '
				AND in_message = 0
			ORDER BY filetime DESC, post_msg_id ASC';
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $attachments[] = $row;
        }
        $db->sql_freeresult($result);
        if (sizeof($attachments)) {
            $update_count = array();
            parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
        }
        // Display not already displayed Attachments for this post, we already parsed them. ;)
        if (!empty($attachments)) {
            $template->assign_var('S_HAS_ATTACHMENTS', true);
            foreach ($attachments as $attachment) {
                $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
            }
//.........这里部分代码省略.........
开发者ID:ahmatjan,项目名称:Crimson,代码行数:101,代码来源:mcp_post.php

示例7: page_whois

 /**
  * Controller for mChat IP WHOIS
  *
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  */
 public function page_whois()
 {
     if (!$this->auth->acl_get('u_mchat_ip')) {
         throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION');
     }
     if (!function_exists('user_ipwhois')) {
         include $this->root_path . 'includes/functions_user.' . $this->php_ext;
     }
     $this->template->assign_var('WHOIS', user_ipwhois($this->request->variable('ip', '')));
     return $this->helper->render('viewonline_whois.html', $this->user->lang('WHO_IS_ONLINE'));
 }
开发者ID:EntropyRy,项目名称:mChat-Extension,代码行数:16,代码来源:mchat.php

示例8: mcp_post_details

/**
* Handling actions in post details screen
*/
function mcp_post_details($id, $mode, $action)
{
    global $phpEx, $phpbb_root_path, $config;
    global $template, $db, $user, $auth;
    $user->add_lang('posting');
    $post_id = request_var('p', 0);
    $start = request_var('start', 0);
    // Get post data
    $post_info = get_post_data(array($post_id));
    if (!sizeof($post_info)) {
        trigger_error($user->lang['POST_NOT_EXIST']);
    }
    $post_info = $post_info[$post_id];
    $url = append_sid("{$phpbb_root_path}mcp.{$phpEx}?" . extra_url());
    switch ($action) {
        case 'whois':
            $ip = request_var('ip', '');
            include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
            $whois = user_ipwhois($ip);
            $whois = preg_replace('#(\\s)([\\w\\-\\._\\+]+@[\\w\\-\\.]+)(\\s)#', '\\1<a href="mailto:\\2">\\2</a>\\3', $whois);
            $whois = preg_replace('#(\\s)(http:/{2}[^\\s]*)(\\s)#', '\\1<a href="\\2" target="_blank">\\2</a>\\3', $whois);
            $template->assign_vars(array('RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&amp;mode={$mode}&amp;p={$post_id}") . '">', '</a>'), 'WHOIS' => trim($whois)));
            // We're done with the whois page so return
            return;
            break;
        case 'chgposter':
        case 'chgposter_ip':
            if ($action == 'chgposter') {
                $username = request_var('username', '', true);
                $sql_where = "username = '" . $db->sql_escape($username) . "'";
            } else {
                $new_user_id = request_var('u', 0);
                $sql_where = 'user_id = ' . $new_user_id;
            }
            $sql = 'SELECT *
				FROM ' . USERS_TABLE . '
				WHERE ' . $sql_where;
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$row) {
                trigger_error($user->lang['NO_USER']);
            }
            if ($auth->acl_get('m_chgposter', $post_info['forum_id'])) {
                change_poster($post_info, $row);
            }
            break;
    }
    // Set some vars
    $users_ary = array();
    $post_id = $post_info['post_id'];
    $poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
    // Process message, leave it uncensored
    $message = $post_info['post_text'];
    if ($post_info['bbcode_bitfield']) {
        include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
        $bbcode = new bbcode($post_info['bbcode_bitfield']);
        $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
    }
    $message = smiley_text($message);
    $message = str_replace("\n", '<br />', $message);
    $template->assign_vars(array('U_MCP_ACTION' => "{$url}&amp;i=main&amp;quickmod=1", 'U_POST_ACTION' => "{$url}&amp;i={$id}&amp;mode=post_details", 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_CAN_CHGPOSTER' => $auth->acl_get('m_chgposter', $post_info['forum_id']), 'S_CAN_LOCK_POST' => $auth->acl_get('m_lock', $post_info['forum_id']), 'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'] ? true : false, 'S_POST_UNAPPROVED' => !$post_info['post_approved'] ? true : false, 'S_POST_LOCKED' => $post_info['post_edit_locked'] ? true : false, 'S_USER_NOTES' => true, 'S_CLEAR_ALLOWED' => $auth->acl_get('a_clearlogs') ? true : false, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_FIND_MEMBER' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=mcp_chgposter&amp;field=username'), 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $auth->acl_getf_global('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '', 'U_VIEW_PROFILE' => $post_info['user_id'] != ANONYMOUS ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&amp;u=' . $post_info['user_id']) : '', 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$post_info['forum_id']}&amp;p={$post_id}") . "#p{$post_id}\">", '</a>'), 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", "f={$post_info['forum_id']}&amp;start={$start}") . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('btn_edit', $user->lang['EDIT_POST']), 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']), 'POST_ID' => $post_info['post_id']));
    // Get User Notes
    $log_data = array();
    $log_count = 0;
    view_log('user', $log_data, $log_count, $config['posts_per_page'], 0, 0, 0, $post_info['user_id']);
    if ($log_count) {
        $template->assign_var('S_USER_NOTES', true);
        foreach ($log_data as $row) {
            $template->assign_block_vars('usernotes', array('REPORT_BY' => $row['username'], 'REPORT_AT' => $user->format_date($row['time']), 'ACTION' => $row['action'], 'ID' => $row['id']));
        }
    }
    // Get Reports
    if ($auth->acl_get('m_', $post_info['forum_id'])) {
        $sql = 'SELECT r.*, re.*, u.user_id, u.username
			FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . REPORTS_REASONS_TABLE . " re\n\t\t\tWHERE r.post_id = {$post_id}\n\t\t\t\tAND r.reason_id = re.reason_id\n\t\t\t\tAND u.user_id = r.user_id\n\t\t\tORDER BY r.report_time DESC";
        $result = $db->sql_query($sql);
        if ($row = $db->sql_fetchrow($result)) {
            $template->assign_var('S_SHOW_REPORTS', true);
            do {
                // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
                if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) {
                    $row['reson_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])];
                    $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])];
                }
                $template->assign_block_vars('reports', array('REPORT_ID' => $row['report_id'], 'REASON_TITLE' => $row['reason_title'], 'REASON_DESC' => $row['reason_description'], 'REPORTER' => $row['user_id'] != ANONYMOUS ? $row['username'] : $user->lang['GUEST'], 'U_REPORTER' => $row['user_id'] != ANONYMOUS ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&amp;u=' . $row['user_id']) : '', 'USER_NOTIFY' => $row['user_notify'] ? true : false, 'REPORT_TIME' => $user->format_date($row['report_time']), 'REPORT_TEXT' => str_replace("\n", '<br />', trim($row['report_text']))));
            } while ($row = $db->sql_fetchrow($result));
        }
        $db->sql_freeresult($result);
    }
    // Get IP
    if ($auth->acl_get('m_info', $post_info['forum_id'])) {
        $rdns_ip_num = request_var('rdns', '');
        if ($rdns_ip_num != 'all') {
            $template->assign_vars(array('U_LOOKUP_ALL' => "{$url}&amp;i=main&amp;mode=post_details&amp;rdns=all"));
        }
        // Get other users who've posted under this IP
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:mcp_post.php

示例9: trigger_error

     } else {
         // Show no rules
         trigger_error('NO_MCHAT_RULES', E_USER_NOTICE);
     }
     break;
     // whois function..
 // whois function..
 case 'whois':
     // Must have auths
     if ($mchat_mode == 'whois' && $mchat_ip) {
         // function already exists..
         if (!function_exists('user_ipwhois')) {
             include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
         }
         $user_ip = request_var('ip', '');
         $template->assign_var('WHOIS', user_ipwhois($user_ip));
         // Output the page
         page_header($user->lang['WHO_IS_ONLINE']);
         $template->set_filenames(array('body' => 'viewonline_whois.html'));
         page_footer();
     } else {
         // Show not authorized
         trigger_error('NO_AUTH_OPERATION', E_USER_NOTICE);
     }
     break;
     // Clean function...
 // Clean function...
 case 'clean':
     // User logged in?
     if (!$user->data['is_registered'] || !$mchat_founder) {
         if (!$user->data['is_registered']) {
开发者ID:RMcGirr83-30,项目名称:mChat,代码行数:31,代码来源:mchat.php

示例10: request_var

$start = request_var('start', 0);
$sort_key = request_var('sk', 'b');
$sort_dir = request_var('sd', 'd');
$show_guests = $config['load_online_guests'] ? request_var('sg', 0) : 0;
$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED']);
$sort_key_sql = array('a' => 'u.username', 'b' => 's.session_time', 'c' => 's.session_page');
// Sorting and order
$order_by = $sort_key_sql[$sort_key] . ' ' . ($sort_dir == 'a' ? 'ASC' : 'DESC');
// Whois requested
if ($mode == 'whois') {
    include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
    $sql = 'SELECT u.user_id, u.username, u.user_type, s.session_ip
		FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . " s\n\t\tWHERE s.session_id = '" . $db->sql_escape($session_id) . "'\n\t\t\tAND\tu.user_id = s.session_user_id";
    $result = $db->sql_query($sql);
    if ($row = $db->sql_fetchrow($result)) {
        $whois = user_ipwhois($row['session_ip']);
        $whois = preg_replace('#(\\s)([\\w\\-\\._\\+]+@[\\w\\-\\.]+)(\\s)#', '\\1<a href="mailto:\\2">\\2</a>\\3', $whois);
        $whois = preg_replace('#(\\s)(http:/{2}[^\\s]*)(\\s)#', '\\1<a href="\\2" target="_blank">\\2</a>\\3', $whois);
        $template->assign_vars(array('WHOIS' => trim($whois)));
    }
    $db->sql_freeresult($result);
    // Output the page
    page_header($user->lang['WHO_IS_ONLINE']);
    $template->set_filenames(array('body' => 'viewonline_whois.html'));
    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.{$phpEx}"));
    page_footer();
}
// Forum info
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
	FROM ' . FORUMS_TABLE . '
	ORDER BY left_id ASC';
开发者ID:yunsite,项目名称:gloryroad,代码行数:31,代码来源:viewonline.php

示例11: popup_ip_whois

 /**
  * IP Whois
  */
 function popup_ip_whois()
 {
     global $user, $template;
     global $phpbb_root_path, $phpEx;
     include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
     $this->page_title = 'WHOIS';
     $this->tpl_name = 'simple_body';
     $ip = request_var('ip', '');
     $ipwhois = user_ipwhois($ip);
     $template->assign_vars(array('MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $ip), 'MESSAGE_TEXT' => nl2br($ipwhois)));
 }
开发者ID:codegooglecom,项目名称:proxy-revealer,代码行数:14,代码来源:acp_proxy_revealer.php

示例12: request_var

$mode = request_var('mode', 'album');
$action = request_var('action', '');
$option_id = request_var('option_id', 0);
$image_id = request_var('image_id', 0);
$album_id = request_var('album_id', 0);
if (request_var('quickmod', 0) == 1 && $action == 'report_details') {
    $mode = 'report_details';
    $option_id = (int) $image_data['image_reported'];
} else {
    if (request_var('quickmod', 0) == 1 && $action == 'image_edit') {
        phpbb_gallery_url::redirect('posting', "mode=image&amp;submode=edit&amp;album_id={$album_id}&amp;image_id={$image_id}");
    }
}
if ($mode == 'whois' && $auth->acl_get('a_') && request_var('ip', '')) {
    phpbb_gallery_url::_include(array('functions_user'), 'phpbb');
    $template->assign_var('WHOIS', user_ipwhois(request_var('ip', '')));
    page_header($user->lang['WHO_IS_ONLINE']);
    $template->set_filenames(array('body' => 'viewonline_whois.html'));
    page_footer();
}
//Basic-Information && Permissions
if ($image_id) {
    $image_data = phpbb_gallery_image::get_info($image_id);
    $album_id = $image_data['image_album_id'];
    $user_id = $image_data['image_user_id'];
}
if ($album_id) {
    $album_data = phpbb_gallery_album::get_info($album_id);
}
// Some other variables
$submit = isset($_POST['submit']) ? true : false;
开发者ID:phpbbgallery,项目名称:phpbb-gallery,代码行数:31,代码来源:mcp.php

示例13: get_post_data

}
if ($action !== 'whois') {
    // Get post data
    $post_info = get_post_data(array($post_id));
    if (empty($post_info[$post_id])) {
        trigger_error('POST_NOT_EXIST');
    }
    $post_info = $post_info[$post_id];
    $url = 'forums&amp;file=mcp&amp;p=' . $post_info['post_id'];
    $start = get_variable('start', 'REQUEST', 0, 'int');
}
switch ($action) {
    case 'whois':
        $ip = get_variable('ip', 'REQUEST');
        require_once SITE_FILE_ROOT . 'includes/functions_user.php';
        $whois = user_ipwhois($ip);
        $whois = preg_replace('#(\\s)([\\w\\-\\._\\+]+@[\\w\\-\\.]+)(\\s)#', '\\1<a href="mailto:\\2">\\2</a>\\3', $whois);
        $whois = preg_replace('#(\\s)(http:/{2}[^\\s]*)(\\s)#', '\\1<a href="\\2" target="_blank">\\2</a>\\3', $whois);
        $_CLASS['core_template']->assign_array(array('RETURN_POST' => sprintf($_CLASS['core_user']->get_lang('RETURN_POST'), '<a href="' . generate_link("forums&amp;file=mcp&amp;mode={$mode}&amp;p={$post_id}") . '">', '</a>'), 'WHOIS' => trim($whois)));
        $_CLASS['core_display']->display($_CLASS['core_user']->get_lang('MCP'), 'modules/forums/mcp_whois.html');
        break;
    case 'chgposter':
    case 'chgposter_ip':
        if ($action == 'chgposter') {
            $username = get_variable('username', 'REQUEST', '');
            $sql_where = $username ? "username = '" . $_CLASS['core_db']->escape($username) . "'" : '';
        } else {
            $new_user_id = get_variable('u', 'REQUEST', 0, 'int');
            $sql_where = $new_user_id ? 'user_id = ' . $new_user_id : '';
        }
        if ($sql_where) {
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:mcp_post.php


注:本文中的user_ipwhois函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。