chatsigma.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 254 行

PHP
254
字号
<?php/*+--------------------------------------------------------------------------|   Invision Power Board v2.1.5|   =============================================|   by Matthew Mecham|   (c) 2001 - 2005 Invision Power Services, Inc.|   |   =============================================|   Web: |   Time: Wed, 01 Mar 2006 19:11:28 GMT|   Release: |   Licence Info: +---------------------------------------------------------------------------|   > $Date: 2005-10-11 13:14:29 +0100 (Tue, 11 Oct 2005) $|   > $Revision: 38 $|   > $Author: matt $+---------------------------------------------------------------------------||   > MODULE PUBLIC FILE: EXAMPLE|   > Module written by Matt Mecham|   > Date started: Fri 12th August 2005 (17:16)|+--------------------------------------------------------------------------*//*** MODULE: Public Example File (IPB 3.0 Methods)* "modules" is depreciated in IPB 3.0** @package		InvisionPowerBoard* @subpackage	Components* @author  		Matt Mecham* @version		2.1*/if ( ! defined( 'IN_IPB' ) ){	print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";	exit();}/*** MODULE: Public Example File (IPB 3.0 Methods)** This class must ALWAYS be called "component_public"** @package		InvisionPowerBoard* @subpackage	Components* @author  		Matt Mecham* @version		2.1*/class component_public{	/**	* IPSclass object	*	* @var object	*/	var $ipsclass;			/**	* Main function that's run from index.php	*	*/	function run_component()	{		switch( $this->ipsclass->input['code'] )		{			case 'show':				$this->display_chat();				break;			case 'update':				$this->update_session();				break;			default:				$this->display_chat();				break;		}	}		/*-------------------------------------------------------------------------*/	// Update user's session	/*-------------------------------------------------------------------------*/		function update_session()	{		//-----------------------------------------		// Make sure we have a last click		//-----------------------------------------				$this->ipsclass->lastclick = $this->ipsclass->lastclick ? $this->ipsclass->lastclick : time();				//-----------------------------------------		// Got sess ID and mem ID?		//-----------------------------------------				if ( ! $this->ipsclass->member['id'] )		{			print "no";			exit();		}				//-----------------------------------------		// Two hours of not doing anything...		//-----------------------------------------				if ( $this->ipsclass->lastclick < ( time() - 7200 ) )		{			print "no";			exit();		}				$tmp_cache = $this->ipsclass->cache['chatting'];				$this->ipsclass->cache['chatting'] = array();				//-----------------------------------------		// Goforit		//-----------------------------------------				if ( is_array( $tmp_cache ) and count( $tmp_cache ) )		{			foreach( $tmp_cache as $id => $data )			{				//-----------------------------------------				// Not hit in 2 mins?				//-----------------------------------------								if ( $data['updated'] < ( time() - 120 ) )				{					continue;				}								if ( $id == $this->ipsclass->member['id'] )				{					continue;				}								$this->ipsclass->cache['chatting'][ $id ] = $data;			}		}				//-----------------------------------------		// Add in us		//-----------------------------------------				$this->ipsclass->cache['chatting'][ $this->ipsclass->member['id'] ] = array( 'updated' => time(), 'name' => $this->ipsclass->member['members_display_name'] );				//-----------------------------------------		// Update cache		//-----------------------------------------														  		$this->ipsclass->update_cache( array( 'name' => 'chatting', 'deletefirst' => 1, 'donow' => 1, 'array' => 1 ) );				//-----------------------------------------		// Something to return		//-----------------------------------------				print "ok";		exit();	}		/*-------------------------------------------------------------------------*/	// Display chat	/*-------------------------------------------------------------------------*/		function display_chat()	{		//-----------------------------------------		// Load HTML and LANG		//-----------------------------------------				$this->ipsclass->load_language('lang_chatsigma');		$this->ipsclass->load_template('skin_chatsigma');				if ( ! $this->ipsclass->vars['chat_account_no'] )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );		}				//-----------------------------------------		// Get extra settings		//-----------------------------------------				$this->ipsclass->DB->simple_construct( array( 'select' => 'conf_key,conf_value,conf_default', 'from' => 'conf_settings', 'where' => "conf_key LIKE 'chat%'" ) );    	$this->ipsclass->DB->simple_exec();    	    	while( $r = $this->ipsclass->DB->fetch_row() )    	{    		$value = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default'];    		    		$this->ipsclass->vars[ $r['conf_key'] ] = $value;    	}				//-----------------------------------------		// Got address?		//-----------------------------------------				if ( ! $this->ipsclass->vars['chat_server_addr'] )		{			$this->ipsclass->vars['chat_server_addr'] = 'client1.invisionchat.com';		}				//-----------------------------------------		// Server		//-----------------------------------------				$this->ipsclass->vars['chat_server_addr'] = str_replace( 'http://', '', $this->ipsclass->vars['chat_server_addr'] );				//-----------------------------------------		// Details		//-----------------------------------------				$width  = $this->ipsclass->vars['chat_width']    ? $this->ipsclass->vars['chat_width']  : 600;		$height = $this->ipsclass->vars['chat_height']   ? $this->ipsclass->vars['chat_height'] : 350;				$lang   = $this->ipsclass->vars['chat_language'] ? $this->ipsclass->vars['chat_language'] : 'en';				$user = "";		$pass = "";				//-----------------------------------------		// Got ID?		//-----------------------------------------				if ( $this->ipsclass->member['id'] )		{			$user            = $this->ipsclass->member['name'];						$converge_member = $this->ipsclass->converge->converge_load_member_by_id($this->ipsclass->member['id']);			$pass            = $this->ipsclass->converge->member['converge_pass_hash'];		}				$this->output .= $this->ipsclass->compiled_templates['skin_chatsigma']->chat_inline( $this->ipsclass->vars['chat_server_addr'], $this->ipsclass->vars['chat_account_no'], $lang, $width, $height, $user, $pass);				if ( ! $this->ipsclass->input['pop'] )		{			$this->nav[]	  = $this->ipsclass->lang['live_chat'];			$this->page_title = $this->ipsclass->lang['live_chat'];						$this->ipsclass->print->add_output( $this->output );			$this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );        }        else        {        	$this->ipsclass->print->pop_up_window( 'Chat', $this->output );        }	}}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?