mirror of
https://github.com/Mibew/java.git
synced 2025-01-23 01:50:34 +03:00
[1.5.1] update from branch
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@317 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
0f8c51fa9a
commit
113dc1955a
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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_once(dirname(__FILE__).'/converter.php');
|
||||
require_once(dirname(__FILE__).'/config.php');
|
||||
|
||||
$version = '1.5.0';
|
||||
$version = '1.5.1';
|
||||
|
||||
function myiconv($in_enc, $out_enc, $string) {
|
||||
global $_utf8win1251, $_win1251utf8;
|
||||
@ -64,12 +64,33 @@ function debugexit_print( $var ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$locale_pattern = "/^[\w-]{2,5}$/";
|
||||
|
||||
function locale_exists($locale) {
|
||||
return file_exists(dirname(__FILE__)."/../locales/$locale/properties");
|
||||
}
|
||||
|
||||
function get_available_locales() {
|
||||
global $locale_pattern;
|
||||
$list = array();
|
||||
$folder = dirname(__FILE__)."/../locales";
|
||||
if($handle = opendir($folder)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (preg_match($locale_pattern, $file) && $file != 'names' && is_dir("$folder/$file")) {
|
||||
$list[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
function get_user_locale() {
|
||||
global $available_locales, $default_locale;
|
||||
global $default_locale;
|
||||
|
||||
if( isset($_COOKIE['webim_locale']) ) {
|
||||
$requested_lang = $_COOKIE['webim_locale'];
|
||||
if( in_array($requested_lang,$available_locales) )
|
||||
if( locale_exists($requested_lang) )
|
||||
return $requested_lang;
|
||||
}
|
||||
|
||||
@ -79,30 +100,30 @@ function get_user_locale() {
|
||||
if( strlen($requested_lang) > 2 )
|
||||
$requested_lang = substr($requested_lang,0,2);
|
||||
|
||||
if( in_array($requested_lang,$available_locales) )
|
||||
if( locale_exists($requested_lang) )
|
||||
return $requested_lang;
|
||||
}
|
||||
}
|
||||
|
||||
if( in_array($default_locale,$available_locales) )
|
||||
if( locale_exists($default_locale) )
|
||||
return $default_locale;
|
||||
|
||||
return 'en';
|
||||
}
|
||||
|
||||
function get_locale() {
|
||||
global $available_locales, $webimroot;
|
||||
global $webimroot, $locale_pattern;
|
||||
|
||||
$locale = verifyparam("locale", "/^[\w-]{2,5}$/", "");
|
||||
$locale = verifyparam("locale", $locale_pattern, "");
|
||||
|
||||
if( $locale && in_array($locale,$available_locales) ) {
|
||||
if( $locale && locale_exists($locale) ) {
|
||||
$_SESSION['locale'] = $locale;
|
||||
setcookie('webim_locale', $locale, time()+60*60*24*1000, "$webimroot/");
|
||||
} else if( isset($_SESSION['locale']) ){
|
||||
$locale = $_SESSION['locale'];
|
||||
}
|
||||
|
||||
if( !$locale || !in_array($locale,$available_locales) )
|
||||
if( !$locale || !locale_exists($locale) )
|
||||
$locale = get_user_locale();
|
||||
return $locale;
|
||||
}
|
||||
@ -113,9 +134,10 @@ $messages = array();
|
||||
$output_encoding = array();
|
||||
|
||||
function get_locale_links($href) {
|
||||
global $available_locales, $current_locale;
|
||||
global $current_locale;
|
||||
$localeLinks = "";
|
||||
foreach($available_locales as $k) {
|
||||
$allLocales = get_available_locales();
|
||||
foreach($allLocales as $k) {
|
||||
if( strlen($localeLinks) > 0 )
|
||||
$localeLinks .= " • ";
|
||||
if( $k == $current_locale )
|
||||
@ -449,6 +471,8 @@ $settings = array(
|
||||
'chattitle' => 'Live Support',
|
||||
'geolink' => 'http://api.hostip.info/get_html.php?ip={ip}',
|
||||
'geolinkparams' => 'width=440,height=100,toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1',
|
||||
'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */
|
||||
'max_uploaded_file_size' => 100000,
|
||||
);
|
||||
$settingsloaded = false;
|
||||
$settings_in_db = array();
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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
|
||||
@ -58,8 +58,7 @@ $webim_messages_locale = "en";
|
||||
/*
|
||||
* Locales
|
||||
*/
|
||||
$available_locales = array("en", "ru" /* preliminary: "sp", "fr" */);
|
||||
$home_locale = "ru"; /* native name will be used in this locale */
|
||||
$home_locale = "en"; /* native name will be used in this locale */
|
||||
$default_locale = "en"; /* if user does not provide known lang */
|
||||
|
||||
/*
|
||||
@ -68,14 +67,4 @@ $default_locale = "en"; /* if user does not provide known lang */
|
||||
*/
|
||||
$remote_visitor = 'visitor_from_request';
|
||||
|
||||
/*
|
||||
* Timeout (in seconds) when online operator becomes offline.
|
||||
*/
|
||||
$online_timeout = 30;
|
||||
|
||||
/*
|
||||
* Maximum uploaded file size.
|
||||
*/
|
||||
$max_uploaded_file_size = 100000;
|
||||
|
||||
?>
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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
|
||||
@ -44,6 +44,8 @@ function expand_var($matches) {
|
||||
return $webimroot;
|
||||
} else if($var == 'tplroot') {
|
||||
return "$webimroot/styles/$current_style";
|
||||
} else if($var == 'styleid') {
|
||||
return $current_style;
|
||||
} else if($var == 'pagination') {
|
||||
return generate_pagination($page['pagination']);
|
||||
} else if($var == 'errors' || $var == 'harderrors') {
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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
|
||||
@ -109,11 +109,12 @@ function notify_operator_alive($operatorid) {
|
||||
}
|
||||
|
||||
function has_online_operators() {
|
||||
global $online_timeout;
|
||||
global $settings;
|
||||
loadsettings();
|
||||
$link = connect();
|
||||
$row = select_one_row("select min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time from chatoperator",$link);
|
||||
mysql_close($link);
|
||||
return $row['time'] < $online_timeout;
|
||||
return $row['time'] < $settings['online_timeout'];
|
||||
}
|
||||
|
||||
function get_operator_name($operator) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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
|
||||
@ -32,6 +32,7 @@ function setup_settings_tabs($active) {
|
||||
getlocal("page_settings.tab.main") => $active != 0 ? "$webimroot/operator/settings.php" : "",
|
||||
getlocal("page_settings.tab.features") => $active != 1 ? "$webimroot/operator/features.php" : "",
|
||||
getlocal("page_settings.tab.departments") => $active != 2 ? "$webimroot/operator/departments.php" : "",
|
||||
getlocal("page_settings.tab.themes") => $active != 3 ? "$webimroot/operator/preview.php" : "",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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
|
||||
@ -36,10 +36,12 @@ if( !$op ) {
|
||||
$orig_filename = $_FILES['avatarFile']['name'];
|
||||
$tmp_file_name = $_FILES['avatarFile']['tmp_name'];
|
||||
|
||||
$ext = substr($orig_filename, 1 + strrpos($orig_filename, "."));
|
||||
$ext = strtolower(substr($orig_filename, 1 + strrpos($orig_filename, ".")));
|
||||
$new_file_name = "$opId.$ext";
|
||||
loadsettings();
|
||||
|
||||
if ($_FILES['avatarFile']['size'] > $max_uploaded_file_size) {
|
||||
$file_size = $_FILES['avatarFile']['size'];
|
||||
if ($file_size == 0 || $file_size > $settings['max_uploaded_file_size']) {
|
||||
$errors[] = failed_uploading_file($orig_filename, "errors.file.size.exceeded");
|
||||
} elseif(!in_array($ext, $valid_types)) {
|
||||
$errors[] = failed_uploading_file($orig_filename, "errors.invalid.file.type");
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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,7 +18,8 @@ require_once('../libs/operator.php');
|
||||
$operator = check_login();
|
||||
|
||||
$imageLocales = array();
|
||||
foreach($available_locales as $curr) {
|
||||
$allLocales = get_available_locales();
|
||||
foreach($allLocales as $curr) {
|
||||
$imagesDir = "../locales/$curr/button";
|
||||
if($handle = opendir($imagesDir)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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,6 +17,7 @@ require_once('../libs/chat.php');
|
||||
require_once('../libs/pagination.php');
|
||||
require_once('../libs/operator.php');
|
||||
require_once('../libs/expand.php');
|
||||
require_once('../libs/settings.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
@ -118,5 +119,6 @@ foreach($templateList as $tpl) {
|
||||
}
|
||||
|
||||
start_html_output();
|
||||
setup_settings_tabs(3);
|
||||
require('../view/preview.php');
|
||||
?>
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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
|
||||
@ -112,7 +112,8 @@ if($stringid) {
|
||||
}
|
||||
|
||||
$localesList = array();
|
||||
foreach($available_locales as $loc) {
|
||||
$allLocales = get_available_locales();
|
||||
foreach($allLocales as $loc) {
|
||||
$localesList[] = array("id" => $loc, "name" => getlocal_("localeid", $loc));
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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-2008 Web Messenger Community
|
||||
* Copyright (c) 2005-2009 Web Messenger Community
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user