mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 18:41:09 +03:00 
			
		
		
		
	code clean up, is typing started
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@57 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
		
							parent
							
								
									a74d9f219f
								
							
						
					
					
						commit
						2770759385
					
				| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -21,11 +21,11 @@ if( !$lang || !in_array($lang,$available_locales) ) | ||||
| 	$lang = $current_locale; | ||||
| 
 | ||||
| $image_postfix = has_online_operators() ? "on" : "off"; | ||||
| $name = "locales/${lang}/button/${image}_${image_postfix}.gif"; | ||||
| $filename = "locales/${lang}/button/${image}_${image_postfix}.gif"; | ||||
| 
 | ||||
| $fp = fopen($name, 'rb') or die("no image"); | ||||
| $fp = fopen($filename, 'rb') or die("no image"); | ||||
| header("Content-Type: image/gif"); | ||||
| header("Content-Length: ".filesize($name)); | ||||
| header("Content-Length: ".filesize($filename)); | ||||
| fpassthru($fp); | ||||
| exit; | ||||
| ?>
 | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -31,9 +31,9 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) { | ||||
| 		} | ||||
| 		 | ||||
| 		$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""; | ||||
| 		$remote = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $_SERVER['REMOTE_ADDR']; | ||||
| 		$remoteHost = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $_SERVER['REMOTE_ADDR']; | ||||
| 		$visitor = $remote_visitor(); | ||||
| 		$thread = create_thread($visitor['name'], $remote, $referer,$current_locale); | ||||
| 		$thread = create_thread($visitor['name'], $remoteHost, $referer,$current_locale); | ||||
| 		$_SESSION['threadid'] = $thread['threadid']; | ||||
| 		if( $referer ) { | ||||
| 			post_message($thread['threadid'],$kind_for_agent,getstring2('chat.came.from',array($referer))); | ||||
| @ -72,4 +72,4 @@ if( $pparam == "mailthread" ) { | ||||
| 	require('view/chat_oldbrowser.php'); | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
| ?>
 | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -18,36 +18,36 @@ require('libs/chat.php'); | ||||
| $errors = array(); | ||||
| $page = array(); | ||||
| 
 | ||||
| $mail = getparam('email'); | ||||
| $name = getparam('name'); | ||||
| $email = getparam('email'); | ||||
| $visitor_name = getparam('name'); | ||||
| $message = getparam('message'); | ||||
| 
 | ||||
| if( !$mail ) { | ||||
| if( !$email ) { | ||||
| 	$errors[] = no_field("form.field.email"); | ||||
| } else if( !$name ) { | ||||
| } else if( !$visitor_name ) { | ||||
| 	$errors[] = no_field("form.field.name"); | ||||
| } else if( !$message ) { | ||||
| 	$errors[] = no_field("form.field.message"); | ||||
| } else { | ||||
| 	if( !is_valid_email($mail)) { | ||||
| 	if( !is_valid_email($email)) { | ||||
| 		$errors[] = wrong_field("form.field.email"); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| if( count($errors) > 0 ) { | ||||
| 	$page['formname'] = $name; | ||||
| 	$page['formemail'] = $mail; | ||||
| 	$page['formname'] = $visitor_name; | ||||
| 	$page['formemail'] = $email; | ||||
| 	$page['formmessage'] = $message; | ||||
| 	start_html_output(); | ||||
| 	require('view/chat_leavemsg.php'); | ||||
| 	exit; | ||||
| } | ||||
| 
 | ||||
| $subject = getstring2_("leavemail.subject", array($name), $webim_messages_encoding); | ||||
| $body = getstring2_("leavemail.body", array($name,$mail,$message), $webim_messages_encoding);  | ||||
| $subject = getstring2_("leavemail.subject", array($visitor_name), $webim_messages_encoding); | ||||
| $body = getstring2_("leavemail.body", array($visitor_name,$email,$message), $webim_messages_encoding);  | ||||
| 
 | ||||
| $headers = 'From: '.$webim_from_email."\r\n" . | ||||
|    'Reply-To: '.$mail."\r\n" . | ||||
|    'Reply-To: '.$email."\r\n" . | ||||
|    'X-Mailer: PHP/'.phpversion(); | ||||
| 
 | ||||
| mail($webim_messages_mail,$subject,wordwrap($body,70),$headers); | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -13,7 +13,7 @@ | ||||
|  *    Pavel Petroshenko - history search | ||||
|  */ | ||||
| 
 | ||||
| $connection_timeout = 30; # sec
 | ||||
| $connection_timeout = 30; // sec
 | ||||
| 
 | ||||
| $namecookie = "WEBIM_Name"; | ||||
| 
 | ||||
| @ -44,7 +44,7 @@ function next_revision($link) { | ||||
| 	return $val; | ||||
| } | ||||
| 
 | ||||
| function post_message_($threadid,$kind,$message,$link,$from=null,$time=null,$opid=null) { | ||||
| function post_message_($threadid,$kind,$message,$link,$from=null,$utime=null,$opid=null) { | ||||
| 	$query = sprintf( | ||||
| 	    "insert into chatmessage (threadid,ikind,tmessage,tname,agentId,dtmcreated) values (%s, %s,'%s',%s,%s,%s)", | ||||
| 			$threadid, | ||||
| @ -52,7 +52,7 @@ function post_message_($threadid,$kind,$message,$link,$from=null,$time=null,$opi | ||||
| 			quote_smart($message,$link), | ||||
| 			$from ? "'".quote_smart($from,$link)."'" : "null", | ||||
| 			$opid ? $opid : "0", | ||||
| 			$time ? "FROM_UNIXTIME($time)" : "CURRENT_TIMESTAMP" ); | ||||
| 			$utime ? "FROM_UNIXTIME($utime)" : "CURRENT_TIMESTAMP" ); | ||||
| 
 | ||||
| 	perform_query($query,$link); | ||||
| 	return mysql_insert_id($link); | ||||
| @ -84,16 +84,16 @@ function message_to_html($msg) { | ||||
| 
 | ||||
| function message_to_text($msg) { | ||||
| 	global $kind_user, $kind_agent, $kind_info; | ||||
| 	$time = date("H:i:s ",$msg['created']); | ||||
| 	$message_time = date("H:i:s ",$msg['created']); | ||||
| 	if($msg['ikind'] == $kind_user || $msg['ikind'] == $kind_agent) { | ||||
| 		if( $msg['tname'] ) | ||||
| 			return $time.$msg['tname'].": ".$msg['tmessage']."\n"; | ||||
| 			return $message_time.$msg['tname'].": ".$msg['tmessage']."\n"; | ||||
| 		else | ||||
| 			return $time.$msg['tmessage']."\n"; | ||||
| 			return $message_time.$msg['tmessage']."\n"; | ||||
| 	} else if($msg['ikind'] == $kind_info ) { | ||||
| 		return $time.$msg['tmessage']."\n"; | ||||
| 		return $message_time.$msg['tmessage']."\n"; | ||||
| 	} else { | ||||
| 		return $time."[".$msg['tmessage']."]\n"; | ||||
| 		return $message_time."[".$msg['tmessage']."]\n"; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| @ -164,9 +164,9 @@ function print_thread_messages($threadid, $token, $lastid, $isuser,$format) { | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| function get_user_name($name, $id="") { | ||||
| function get_user_name($username, $id="") { | ||||
| 	global $presentable_name_pattern; | ||||
|        	return str_replace("{id}", $id, str_replace("{name}", $name, $presentable_name_pattern)); | ||||
|        	return str_replace("{id}", $id, str_replace("{name}", $username, $presentable_name_pattern)); | ||||
| } | ||||
| 
 | ||||
| function setup_chatview_for_user($thread,$level) { | ||||
| @ -211,27 +211,27 @@ function setup_chatview_for_operator($thread,$operator) { | ||||
| 	$page['namePostfix'] = "";	 | ||||
| } | ||||
| 
 | ||||
| function is_ajax_browser($name,$ver,$useragent) { | ||||
| 	if( $name == "opera" ) | ||||
| function is_ajax_browser($browserid,$ver,$useragent) { | ||||
| 	if( $browserid == "opera" ) | ||||
| 		return $ver >= 8.02; | ||||
| 	if( $name == "safari" ) | ||||
| 	if( $browserid == "safari" ) | ||||
| 		return $ver >= 125; | ||||
| 	if( $name == "msie" ) | ||||
| 	if( $browserid == "msie" ) | ||||
| 		return $ver >= 5.5 && !strstr($useragent, "powerpc"); | ||||
| 	if( $name == "netscape" ) | ||||
| 	if( $browserid == "netscape" ) | ||||
| 		return $ver >= 7.1; | ||||
| 	if( $name == "mozilla") | ||||
| 	if( $browserid == "mozilla") | ||||
| 		return $ver >= 1.4; | ||||
| 	if( $name == "firefox") | ||||
| 	if( $browserid == "firefox") | ||||
| 		return $ver >= 1.0; | ||||
| 
 | ||||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| function is_old_browser($name,$ver) { | ||||
| 	if( $name == "opera" ) | ||||
| function is_old_browser($browserid,$ver) { | ||||
| 	if( $browserid == "opera" ) | ||||
| 		return $ver < 7.0; | ||||
| 	if( $name == "msie" ) | ||||
| 	if( $browserid == "msie" ) | ||||
| 		return $ver < 5.0; | ||||
| 	return false;  | ||||
| } | ||||
| @ -279,7 +279,7 @@ function get_access_time($threadid, $isuser, $link) { | ||||
| 		$threadid), $link); | ||||
| } | ||||
| 
 | ||||
| function ping_thread($thread, $isuser) { | ||||
| function ping_thread($thread, $isuser,$istyping) { | ||||
| 	global $kind_for_agent, $state_chatting, $state_waiting, $kind_conn, $connection_timeout; | ||||
| 	$link = connect(); | ||||
| 	$params = array(($isuser ? "lastpinguser" : "lastpingagent") => "CURRENT_TIMESTAMP" ); | ||||
| @ -343,7 +343,7 @@ function close_thread($thread,$isuser) { | ||||
| 	post_message($thread['threadid'], $kind_events, $message); | ||||
| } | ||||
| 
 | ||||
| function create_thread($username,$remote,$referer,$lang) { | ||||
| function create_thread($username,$remoteHost,$referer,$lang) { | ||||
| 	$link = connect(); | ||||
| 
 | ||||
| 	$query = sprintf( | ||||
| @ -351,7 +351,7 @@ function create_thread($username,$remote,$referer,$lang) { | ||||
| 								 "('%s',"."%s,'%s','%s',%s,'%s',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)", | ||||
| 			mysql_real_escape_string($username), | ||||
| 			next_token(), | ||||
| 			mysql_real_escape_string($remote), | ||||
| 			mysql_real_escape_string($remoteHost), | ||||
| 			mysql_real_escape_string($referer), | ||||
| 			next_revision($link), | ||||
| 			mysql_real_escape_string($lang) ); | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -17,7 +17,7 @@ session_start(); | ||||
| require(dirname(__FILE__).'/converter.php'); | ||||
| require(dirname(__FILE__).'/config.php'); | ||||
| 
 | ||||
| $version = 'v1.0.8'; | ||||
| $version = 'v1.0.9'; | ||||
| 
 | ||||
| function myiconv($in_enc, $out_enc, $string) { | ||||
| 	global $_utf8win1251, $_win1251utf8; | ||||
| @ -44,6 +44,8 @@ function getrawparam( $name ) { | ||||
| function getparam( $name ) { | ||||
| 	if( isset($_POST[$name]) ) | ||||
| 		return $_POST[$name]; | ||||
|     if( isset($_GET[$name])) | ||||
|         return $_GET[$name]; | ||||
| 	die("no ".$name." parameter"); | ||||
| } | ||||
| 
 | ||||
| @ -140,9 +142,9 @@ function load_messages($locale) { | ||||
| 	$fp = fopen(dirname(__FILE__)."/../locales/$locale/properties","r"); | ||||
| 	while (!feof($fp)) { | ||||
|     	$line = fgets($fp, 4096); | ||||
| 		$list = split("=", $line, 2 ); | ||||
| 		if( isset($list[1]) ) { | ||||
| 			$hash[$list[0]] = str_replace("\\n", "\n",trim($list[1])); | ||||
| 		$keyval = split("=", $line, 2 ); | ||||
| 		if( isset($keyval[1]) ) { | ||||
| 			$hash[$keyval[0]] = str_replace("\\n", "\n",trim($keyval[1])); | ||||
| 		} | ||||
| 	} | ||||
| 	fclose($fp); | ||||
| @ -264,11 +266,11 @@ function get_image($href,$width,$height) { | ||||
| 	return "<img src=\"$href\" border=\"0\"/>"; | ||||
| } | ||||
| 
 | ||||
| function get_gifimage_size($file) { | ||||
| function get_gifimage_size($filename) { | ||||
| 	if( function_exists('gd_info')) { | ||||
| 		$info = gd_info(); | ||||
| 		if( isset($info['GIF Read Support']) && $info['GIF Read Support'] ) { | ||||
| 			$img = @imagecreatefromgif($file); | ||||
| 			$img = @imagecreatefromgif($filename); | ||||
| 			if($img) { | ||||
| 				$height = imagesy($img); | ||||
| 				$width = imagesx($img); | ||||
| @ -351,12 +353,10 @@ function get_form_date($day,$month) { | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| function set_form_date($time,$prefix) { | ||||
| function set_form_date($utime,$prefix) { | ||||
| 	global $page; | ||||
| 	$page["form${prefix}day"] = date("d", $time); | ||||
| 	$page["form${prefix}month"] = date("m.y", $time); | ||||
| 	$page["form${prefix}day"] = date("d", $utime); | ||||
| 	$page["form${prefix}month"] = date("m.y", $utime); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| ?>
 | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -29,7 +29,8 @@ $mysqlpass = "123"; | ||||
|  *  Localization parameters | ||||
|  */ | ||||
| 
 | ||||
| // Use CP-1251 database
 | ||||
| 
 | ||||
| /* Use CP-1251 database */ | ||||
| $dbencoding = "cp1251"; | ||||
| $webim_encoding = "cp1251"; | ||||
| $request_encoding = "utf-8"; | ||||
| @ -37,7 +38,7 @@ $output_charset = "Windows-1251"; | ||||
| $force_charset_in_connection = true; | ||||
| 
 | ||||
| 
 | ||||
| // Use UTF-8 database
 | ||||
| /* Use UTF-8 database */ | ||||
| /* | ||||
| $dbencoding = "utf8"; | ||||
| $webim_encoding = "cp1251"; | ||||
| @ -49,7 +50,7 @@ $force_charset_in_connection = true; | ||||
| /* | ||||
|  *   From field in outgoing mail. | ||||
|  */ | ||||
| $webim_from_email = "webim@yourdomain.com"; // email from field
 | ||||
| $webim_from_email = "webim@yourdomain.com"; /* email from field */ | ||||
| 
 | ||||
| /* | ||||
|  *   Inbox for left messages | ||||
| @ -71,8 +72,8 @@ $company_logo_link = ""; | ||||
|  *   Locales  | ||||
|  */ | ||||
| $available_locales = array("en", "ru"); | ||||
| $home_locale = "ru";                        // native name will be used in this locale
 | ||||
| $default_locale = "en";                     // if user does not provide known lang
 | ||||
| $home_locale = "ru";                        /* native name will be used in this locale */ | ||||
| $default_locale = "en";                     /* if user does not provide known lang */ | ||||
| 
 | ||||
| /* | ||||
|  *   Allows users to change their names | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -108,7 +108,8 @@ function get_operator_name($operator) { | ||||
| 
 | ||||
| function generate_button($title,$locale,$inner,$showhost,$forcesecure) { | ||||
| 	$link = get_app_location($showhost,$forcesecure)."/client.php". ($locale?"?locale=".$locale : ""); | ||||
| 	return "<!-- webim button -->".get_popup($link, $inner, $title, "webim", "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=600,height=420,resizable=1" )."<!-- / webim button -->"; | ||||
| 	$temp = get_popup($link, $inner, $title, "webim", "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=600,height=420,resizable=1" ); | ||||
| 	return "<!-- webim button -->".$temp."<!-- / webim button -->"; | ||||
| } | ||||
| 
 | ||||
| function check_login() { | ||||
| @ -154,4 +155,4 @@ function logout_operator() { | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
| ?>
 | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -26,17 +26,17 @@ if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) { | ||||
| 	die("wrong thread"); | ||||
| } | ||||
| 
 | ||||
| $mail = getparam('email'); | ||||
| $page['email'] = $mail; | ||||
| $email = getparam('email'); | ||||
| $page['email'] = $email; | ||||
| 
 | ||||
| if( !$mail ) { | ||||
| if( !$email ) { | ||||
| 	$errors[] = no_field("form.field.email"); | ||||
| } else if( !is_valid_email($mail)) { | ||||
| } else if( !is_valid_email($email)) { | ||||
| 	$errors[] = wrong_field("form.field.email"); | ||||
| } | ||||
| 
 | ||||
| if( count($errors) > 0 ) { | ||||
| 	$page['formemail'] = $mail; | ||||
| 	$page['formemail'] = $email; | ||||
| 	$page['ct.chatThreadId'] = $thread['threadid']; | ||||
| 	$page['ct.token'] = $thread['ltoken']; | ||||
| 	$page['level'] = ""; | ||||
| @ -59,7 +59,7 @@ $headers = 'From: '.$webim_from_email."\r\n" . | ||||
|    'Reply-To: '.$webim_from_email."\r\n" . | ||||
|    'X-Mailer: PHP/'.phpversion(); | ||||
| 
 | ||||
| mail($mail,$subject,wordwrap($body,70),$headers); | ||||
| mail($email,$subject,wordwrap($body,70),$headers); | ||||
| 
 | ||||
| start_html_output(); | ||||
| require('view/chat_mailsent.php'); | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -31,11 +31,11 @@ if( !isset($_GET['token']) ) { | ||||
| 		die("wrong thread"); | ||||
| 	} | ||||
| 
 | ||||
| 	 take_thread($thread,$operator); | ||||
|     take_thread($thread,$operator); | ||||
| 
 | ||||
| 	$token = $thread['ltoken']; | ||||
| 	header("Location: ".$_SERVER['PHP_SELF']."?thread=$threadid&token=$token"); | ||||
| 	exit; | ||||
|     $token = $thread['ltoken']; | ||||
|     header("Location: ".$_SERVER['PHP_SELF']."?thread=$threadid&token=$token"); | ||||
|     exit; | ||||
| } | ||||
| 
 | ||||
| $token = verifyparam( "token", "/^\d{1,8}$/"); | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -20,15 +20,17 @@ $operator = check_login(); | ||||
| $page = array('agentId' => ''); | ||||
| $errors = array(); | ||||
| 
 | ||||
| 
 | ||||
| if( isset($_POST['login']) && isset($_POST['password']) ) { | ||||
| 	$agentId = verifyparam( "agentId", "/^(\d{1,9})?$/", ""); | ||||
| 	$login = getparam('login'); | ||||
| 	$password = getparam('password'); | ||||
| 	$passwordConfirm = getparam('passwordConfirm'); | ||||
| 	$name = getparam('name'); | ||||
| 	$localname = getparam('name'); | ||||
| 	$commonname = getparam('commonname'); | ||||
| 
 | ||||
| 	if( !$name ) | ||||
| 
 | ||||
| 	if( !$localname ) | ||||
| 		$errors[] = no_field("form.field.agent_name"); | ||||
| 
 | ||||
| 	if( !$commonname ) | ||||
| @ -43,22 +45,22 @@ if( isset($_POST['login']) && isset($_POST['password']) ) { | ||||
| 	if( $password != $passwordConfirm ) | ||||
| 		$errors[] = getstring("my_settings.error.password_match"); | ||||
| 
 | ||||
| 	$login_operator = operator_by_login($login); | ||||
| 	if( (!$agentId && $login_operator) ||  | ||||
| 		( $agentId && $login_operator && $agentId != $login_operator['operatorid']) ) | ||||
| 	$existing_operator = operator_by_login($login); | ||||
| 	if( (!$agentId && $existing_operator) ||  | ||||
| 		( $agentId && $existing_operator && $agentId != $existing_operator['operatorid']) ) | ||||
| 		$errors[] = getstring("page_agent.error.duplicate_login"); | ||||
| 
 | ||||
| 	if( count($errors) == 0 ) { | ||||
| 		if( $agentId ) { | ||||
| 			update_operator($agentId,$login,$password,$name,$commonname); | ||||
| 		if (!$agentId) { | ||||
| 		    create_operator($login,$password,$localname,$commonname); | ||||
| 		} else { | ||||
| 			create_operator($login,$password,$name,$commonname); | ||||
| 		    update_operator($agentId,$login,$password,$localname,$commonname); | ||||
| 		} | ||||
| 		header("Location: ".dirname($_SERVER['PHP_SELF'])."/operators.php"); | ||||
| 		exit; | ||||
| 	} else { | ||||
| 		$page['formlogin'] = $login; | ||||
| 		$page['formname'] = $name; | ||||
| 		$page['formname'] = $localname; | ||||
| 		$page['formcommonname'] = $commonname; | ||||
| 		$page['agentId'] = $agentId; | ||||
| 	} | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -16,7 +16,6 @@ require('../libs/common.php'); | ||||
| require('../libs/operator.php'); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| $operator = check_login(); | ||||
| 
 | ||||
| notify_operator_alive($operator['operatorid']); | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2007 Internet Services Ltd. | ||||
|  * Copyright (c) 2005-2008 Internet Services Ltd. | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
| @ -16,15 +16,12 @@ require('libs/common.php'); | ||||
| require('libs/chat.php'); | ||||
| require('libs/operator.php'); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| $act = verifyparam( "act", "/^(refresh|post|rename|close|ping".")$/"); | ||||
| $token = verifyparam( "token", "/^\d{1,9}$/"); | ||||
| $threadid = verifyparam( "thread", "/^\d{1,9}$/"); | ||||
| $isuser = verifyparam( "user", "/^true$/", "false") == 'true'; | ||||
| $outformat = (verifyparam( "html", "/^on$/", "off") == 'on') ? "html" : "xml"; | ||||
| 
 | ||||
| 
 | ||||
| $istyping = verifyparam( "typed", "/^1$/", "") == '1'; | ||||
| 
 | ||||
| $thread = thread_by_id($threadid); | ||||
| if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) { | ||||
| @ -34,7 +31,7 @@ if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) { | ||||
| # This code helps in simulation of operator connection problems
 | ||||
| # if( !$isuser )     die("error");
 | ||||
| 
 | ||||
| ping_thread($thread, $isuser); | ||||
| ping_thread($thread, $isuser,$istyping); | ||||
| 
 | ||||
| if( !$isuser && $act != "rename" ) { | ||||
| 	$operator = check_login(); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user