"; - print_r( $var ); + print_r($var); echo ""; exit; } $locale_pattern = "/^[\w-]{2,5}$/"; -function locale_exists($locale) { - return file_exists(dirname(__FILE__)."/../locales/$locale/properties"); +function locale_exists($locale) +{ + return file_exists(dirname(__FILE__) . "/../locales/$locale/properties"); } -function get_available_locales() { +function get_available_locales() +{ global $locale_pattern; $list = array(); - $folder = dirname(__FILE__)."/../locales"; - if($handle = opendir($folder)) { + $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; @@ -94,45 +99,47 @@ function get_available_locales() { return $list; } -function get_user_locale() { +function get_user_locale() +{ global $default_locale; - if( isset($_COOKIE['webim_locale']) ) { + if (isset($_COOKIE['webim_locale'])) { $requested_lang = $_COOKIE['webim_locale']; - if( locale_exists($requested_lang) ) + if (locale_exists($requested_lang)) return $requested_lang; } - if( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) { - $requested_langs = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); - foreach( $requested_langs as $requested_lang) { - if( strlen($requested_lang) > 2 ) - $requested_lang = substr($requested_lang,0,2); + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + $requested_langs = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']); + foreach ($requested_langs as $requested_lang) { + if (strlen($requested_lang) > 2) + $requested_lang = substr($requested_lang, 0, 2); - if( locale_exists($requested_lang) ) + if (locale_exists($requested_lang)) return $requested_lang; } } - if( locale_exists($default_locale) ) + if (locale_exists($default_locale)) return $default_locale; return 'en'; } -function get_locale() { +function get_locale() +{ global $webimroot, $locale_pattern; $locale = verifyparam("locale", $locale_pattern, ""); - if( $locale && locale_exists($locale) ) { + if ($locale && locale_exists($locale)) { $_SESSION['locale'] = $locale; - setcookie('webim_locale', $locale, time()+60*60*24*1000, "$webimroot/"); - } else if( isset($_SESSION['locale']) ){ + setcookie('webim_locale', $locale, time() + 60 * 60 * 24 * 1000, "$webimroot/"); + } else if (isset($_SESSION['locale'])) { $locale = $_SESSION['locale']; } - if( !$locale || !locale_exists($locale) ) + if (!$locale || !locale_exists($locale)) $locale = get_user_locale(); return $locale; } @@ -141,42 +148,44 @@ $current_locale = get_locale(); $messages = array(); $output_encoding = array(); -if(function_exists("date_default_timezone_set")) { +if (function_exists("date_default_timezone_set")) { // TODO try to get timezone from config.php/session etc. // autodetect timezone @date_default_timezone_set(function_exists("date_default_timezone_get") ? @date_default_timezone_get() : "GMT"); } -function get_locale_links($href) { +function get_locale_links($href) +{ global $current_locale; $localeLinks = array(); $allLocales = get_available_locales(); - if(count($allLocales) < 2) { + if (count($allLocales) < 2) { return null; } - foreach($allLocales as $k) { + foreach ($allLocales as $k) { $localeLinks[$k] = getlocal_($k, "names"); } return $localeLinks; } -function load_messages($locale) { +function load_messages($locale) +{ global $messages, $webim_encoding, $output_encoding; $hash = array(); $current_encoding = $webim_encoding; - $fp = fopen(dirname(__FILE__)."/../locales/$locale/properties", "r"); + $fp = fopen(dirname(__FILE__) . "/../locales/$locale/properties", "r"); while (!feof($fp)) { $line = fgets($fp, 4096); - $keyval = preg_split("/=/", $line, 2 ); - if( isset($keyval[1]) ) { - if($keyval[0] == 'encoding') { + $keyval = preg_split("/=/", $line, 2); + if (isset($keyval[1])) { + if ($keyval[0] == 'encoding') { $current_encoding = trim($keyval[1]); - } else if($keyval[0] == 'output_encoding') { + } else if ($keyval[0] == 'output_encoding') { $output_encoding[$locale] = trim($keyval[1]); - } else if( $current_encoding == $webim_encoding ) { - $hash[$keyval[0]] = str_replace("\\n", "\n",trim($keyval[1])); + } else if ($current_encoding == $webim_encoding) { + $hash[$keyval[0]] = str_replace("\\n", "\n", trim($keyval[1])); } else { - $hash[$keyval[0]] = myiconv($current_encoding, $webim_encoding, str_replace("\\n", "\n",trim($keyval[1]))); + $hash[$keyval[0]] = myiconv($current_encoding, $webim_encoding, str_replace("\\n", "\n", trim($keyval[1]))); } } } @@ -184,132 +193,146 @@ function load_messages($locale) { $messages[$locale] = $hash; } -function getoutputenc() { +function getoutputenc() +{ global $current_locale, $output_encoding, $webim_encoding, $messages; - if(!isset($messages[$current_locale])) + if (!isset($messages[$current_locale])) load_messages($current_locale); return isset($output_encoding[$current_locale]) ? $output_encoding[$current_locale] : $webim_encoding; } -function getstring_($text,$locale) { +function getstring_($text, $locale) +{ global $messages; - if(!isset($messages[$locale])) + if (!isset($messages[$locale])) load_messages($locale); $localized = $messages[$locale]; - if( isset($localized[$text]) ) + if (isset($localized[$text])) return $localized[$text]; - if( $locale != 'en' ) { - return getstring_($text,'en'); + if ($locale != 'en') { + return getstring_($text, 'en'); } - return "!".$text; + return "!" . $text; } -function getstring($text) { +function getstring($text) +{ global $current_locale; - return getstring_($text,$current_locale); + return getstring_($text, $current_locale); } -function getlocal($text) { +function getlocal($text) +{ global $current_locale, $webim_encoding; - return myiconv($webim_encoding,getoutputenc(), getstring_($text,$current_locale)); + return myiconv($webim_encoding, getoutputenc(), getstring_($text, $current_locale)); } -function getlocal_($text,$locale) { +function getlocal_($text, $locale) +{ global $webim_encoding; - return myiconv($webim_encoding,getoutputenc(), getstring_($text,$locale)); + return myiconv($webim_encoding, getoutputenc(), getstring_($text, $locale)); } -function topage($text) { +function topage($text) +{ global $webim_encoding; - return myiconv($webim_encoding,getoutputenc(), $text); + return myiconv($webim_encoding, getoutputenc(), $text); } -function getstring2_($text,$params,$locale) { - $string = getstring_($text,$locale); - for( $i = 0; $i < count($params); $i++ ) { - $string = str_replace("{".$i."}", $params[$i], $string); +function getstring2_($text, $params, $locale) +{ + $string = getstring_($text, $locale); + for ($i = 0; $i < count($params); $i++) { + $string = str_replace("{" . $i . "}", $params[$i], $string); } return $string; } -function getstring2($text,$params) { +function getstring2($text, $params) +{ global $current_locale; - return getstring2_($text,$params,$current_locale); + return getstring2_($text, $params, $current_locale); } -function getlocal2($text,$params) { +function getlocal2($text, $params) +{ global $current_locale, $webim_encoding; - $string = myiconv($webim_encoding,getoutputenc(), getstring_($text,$current_locale)); - for( $i = 0; $i < count($params); $i++ ) { - $string = str_replace("{".$i."}", $params[$i], $string); + $string = myiconv($webim_encoding, getoutputenc(), getstring_($text, $current_locale)); + for ($i = 0; $i < count($params); $i++) { + $string = str_replace("{" . $i . "}", $params[$i], $string); } return $string; } /* prepares for Javascript string */ -function getlocalforJS($text,$params) { +function getlocalforJS($text, $params) +{ global $current_locale, $webim_encoding; - $string = myiconv($webim_encoding,getoutputenc(), getstring_($text,$current_locale)); - $string = str_replace("\"", "\\\"", str_replace("\n", "\\n", $string)); - for( $i = 0; $i < count($params); $i++ ) { - $string = str_replace("{".$i."}", $params[$i], $string); + $string = myiconv($webim_encoding, getoutputenc(), getstring_($text, $current_locale)); + $string = str_replace("\"", "\\\"", str_replace("\n", "\\n", $string)); + for ($i = 0; $i < count($params); $i++) { + $string = str_replace("{" . $i . "}", $params[$i], $string); } return $string; } /* ajax server actions use utf-8 */ -function getrawparam( $name ) { +function getrawparam($name) +{ global $webim_encoding; - if( isset($_POST[$name]) ) { - $value = myiconv("utf-8",$webim_encoding,$_POST[$name]); + if (isset($_POST[$name])) { + $value = myiconv("utf-8", $webim_encoding, $_POST[$name]); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } return $value; } - die("no ".$name." parameter"); + die("no " . $name . " parameter"); } /* form processors use current Output encoding */ -function getparam( $name ) { +function getparam($name) +{ global $webim_encoding; - if( isset($_POST[$name]) ) { + if (isset($_POST[$name])) { $value = myiconv(getoutputenc(), $webim_encoding, $_POST[$name]); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } return $value; } - die("no ".$name." parameter"); + die("no " . $name . " parameter"); } -function unicode_urldecode($url) { - preg_match_all('/%u([[:alnum:]]{4})/', $url, $a); +function unicode_urldecode($url) +{ + preg_match_all('/%u([[:alnum:]]{4})/', $url, $a); - foreach ($a[1] as $uniord) { - $dec = hexdec($uniord); - $utf = ''; + foreach ($a[1] as $uniord) { + $dec = hexdec($uniord); + $utf = ''; - if ($dec < 128) { - $utf = chr($dec); - } else if ($dec < 2048) { - $utf = chr(192 + (($dec - ($dec % 64)) / 64)); - $utf .= chr(128 + ($dec % 64)); - } else { - $utf = chr(224 + (($dec - ($dec % 4096)) / 4096)); - $utf .= chr(128 + ((($dec % 4096) - ($dec % 64)) / 64)); - $utf .= chr(128 + ($dec % 64)); - } - $url = str_replace('%u'.$uniord, $utf, $url); - } - return urldecode($url); + if ($dec < 128) { + $utf = chr($dec); + } else if ($dec < 2048) { + $utf = chr(192 + (($dec - ($dec % 64)) / 64)); + $utf .= chr(128 + ($dec % 64)); + } else { + $utf = chr(224 + (($dec - ($dec % 4096)) / 4096)); + $utf .= chr(128 + ((($dec % 4096) - ($dec % 64)) / 64)); + $utf .= chr(128 + ($dec % 64)); + } + $url = str_replace('%u' . $uniord, $utf, $url); + } + return urldecode($url); } -function getgetparam($name,$default='') { +function getgetparam($name, $default = '') +{ global $webim_encoding; - if( !isset($_GET[$name]) || !$_GET[$name] ) { + if (!isset($_GET[$name]) || !$_GET[$name]) { return $default; } $value = myiconv("utf-8", $webim_encoding, unicode_urldecode($_GET[$name])); @@ -319,36 +342,40 @@ function getgetparam($name,$default='') { return $value; } -function connect() { +function connect() +{ global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding, $force_charset_in_connection; - if(!extension_loaded("mysql")) { + if (!extension_loaded("mysql")) { die('Mysql extension is not loaded'); } - $link = @mysql_connect($mysqlhost,$mysqllogin ,$mysqlpass ) - or die('Could not connect: ' . mysql_error()); - mysql_select_db($mysqldb,$link) or die('Could not select database'); - if( $force_charset_in_connection ) { + $link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass) + or die('Could not connect: ' . mysql_error()); + mysql_select_db($mysqldb, $link) or die('Could not select database'); + if ($force_charset_in_connection) { mysql_query("SET NAMES '$dbencoding'", $link); } return $link; } -function perform_query($query,$link) { - mysql_query($query,$link) - or die(' Query failed: '.mysql_error()/*.": ".$query*/); +function perform_query($query, $link) +{ + mysql_query($query, $link) + or die(' Query failed: ' . mysql_error() /*.": ".$query*/); } -function select_one_row($query,$link) { - $result = mysql_query($query,$link) or die(' Query failed: ' . - mysql_error().": ".$query); +function select_one_row($query, $link) +{ + $result = mysql_query($query, $link) or die(' Query failed: ' . + mysql_error() . ": " . $query); $line = mysql_fetch_array($result, MYSQL_ASSOC); mysql_free_result($result); return $line; } -function select_multi_assoc($query, $link) { - $sqlresult = mysql_query($query,$link) or die(' Query failed: ' . - mysql_error().": ".$query); +function select_multi_assoc($query, $link) +{ + $sqlresult = mysql_query($query, $link) or die(' Query failed: ' . + mysql_error() . ": " . $query); $result = array(); while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) { @@ -358,21 +385,24 @@ function select_multi_assoc($query, $link) { return $result; } -function db_build_select($fields, $table, $conditions, $orderandgroup) { - $condition = count($conditions) > 0 ? " where ".implode(" and ", $conditions) : ""; - if($orderandgroup) $orderandgroup = " ".$orderandgroup; +function db_build_select($fields, $table, $conditions, $orderandgroup) +{ + $condition = count($conditions) > 0 ? " where " . implode(" and ", $conditions) : ""; + if ($orderandgroup) $orderandgroup = " " . $orderandgroup; return "select $fields from $table$condition$orderandgroup"; -} +} -function db_rows_count($table,$conditions,$countfields, $link) { - $result = mysql_query(db_build_select("count(".($countfields ? $countfields : "*").")", $table, $conditions, ""),$link) - or die(' Count query failed: '.mysql_error()); +function db_rows_count($table, $conditions, $countfields, $link) +{ + $result = mysql_query(db_build_select("count(" . ($countfields ? $countfields : "*") . ")", $table, $conditions, ""), $link) + or die(' Count query failed: ' . mysql_error()); $line = mysql_fetch_array($result, MYSQL_NUM); mysql_free_result($result); return $line[0]; } -function start_xml_output() { +function start_xml_output() +{ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); @@ -380,173 +410,196 @@ function start_xml_output() { echo ""; } -function start_html_output() { +function start_html_output() +{ $charset = getstring("output_charset"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); - header("Content-type: text/html".(isset($charset)?"; charset=".$charset:"")); + header("Content-type: text/html" . (isset($charset) ? "; charset=" . $charset : "")); } -function escape_with_cdata($text) { - return "", "]]>]]>"; +function escape_with_cdata($text) +{ + return "", "]]>]]>"; } -function form_value($key) { +function form_value($key) +{ global $page; - if( isset($page) && isset($page["form$key"]) ) + if (isset($page) && isset($page["form$key"])) return htmlspecialchars($page["form$key"]); return ""; } -function form_value_cb($key) { +function form_value_cb($key) +{ global $page; - if( isset($page) && isset($page["form$key"]) ) + if (isset($page) && isset($page["form$key"])) return $page["form$key"] === true; return false; } -function form_value_mb($key,$id) { +function form_value_mb($key, $id) +{ global $page; - if( isset($page) && isset($page["form$key"]) && is_array($page["form$key"]) ) { + if (isset($page) && isset($page["form$key"]) && is_array($page["form$key"])) { return in_array($id, $page["form$key"]); } return false; } -function no_field($key) { - return getlocal2("errors.required",array(getlocal($key))); +function no_field($key) +{ + return getlocal2("errors.required", array(getlocal($key))); } -function failed_uploading_file($filename, $key) { +function failed_uploading_file($filename, $key) +{ return getlocal2("errors.failed.uploading.file", - array($filename, getlocal($key))); + array($filename, getlocal($key))); } -function wrong_field($key) { - return getlocal2("errors.wrong_field",array(getlocal($key))); +function wrong_field($key) +{ + return getlocal2("errors.wrong_field", array(getlocal($key))); } -function get_popup($href,$jshref,$message,$title,$wndName,$options) { - if(!$jshref) { $jshref = "'$href'"; } - return "$message"; +function get_popup($href, $jshref, $message, $title, $wndName, $options) +{ + if (!$jshref) { + $jshref = "'$href'"; + } + return "$message"; } -function get_image($href,$width,$height) { - if( $width != 0 && $height != 0 ) +function get_image($href, $width, $height) +{ + if ($width != 0 && $height != 0) return ""; return ""; } -function get_gifimage_size($filename) { - if( function_exists('gd_info')) { +function get_gifimage_size($filename) +{ + if (function_exists('gd_info')) { $info = gd_info(); - if( isset($info['GIF Read Support']) && $info['GIF Read Support'] ) { + if (isset($info['GIF Read Support']) && $info['GIF Read Support']) { $img = @imagecreatefromgif($filename); - if($img) { + if ($img) { $height = imagesy($img); $width = imagesx($img); imagedestroy($img); - return array($width,$height); + return array($width, $height); } } } - return array(0,0); + return array(0, 0); } -function add_params($servlet, $params) { +function add_params($servlet, $params) +{ $infix = '?'; - if( strstr($servlet,$infix) !== FALSE ) + if (strstr($servlet, $infix) !== FALSE) $infix = '&'; - foreach($params as $k => $v) { - $servlet .= $infix.$k."=".$v; + foreach ($params as $k => $v) { + $servlet .= $infix . $k . "=" . $v; $infix = '&'; } return $servlet; } -function div($a,$b) { - return ($a-($a % $b)) / $b; +function div($a, $b) +{ + return ($a - ($a % $b)) / $b; } -function date_diff_to_text($seconds) { - $minutes = div($seconds,60); +function date_diff_to_text($seconds) +{ + $minutes = div($seconds, 60); $seconds = $seconds % 60; - if( $minutes < 60 ) { - return sprintf("%02d:%02d",$minutes, $seconds); + if ($minutes < 60) { + return sprintf("%02d:%02d", $minutes, $seconds); } else { - $hours = div($minutes,60); + $hours = div($minutes, 60); $minutes = $minutes % 60; - return sprintf("%02d:%02d:%02d",$hours, $minutes, $seconds); + return sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds); } } -function is_valid_email($email) { +function is_valid_email($email) +{ return preg_match("/^[^@]+@[^\.]+(\.[^\.]+)*$/", $email); } -function get_app_location($showhost,$issecure) { +function get_app_location($showhost, $issecure) +{ global $webimroot; - if( $showhost ) { - return ($issecure?"https://":"http://").$_SERVER['HTTP_HOST'].$webimroot; + if ($showhost) { + return ($issecure ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $webimroot; } else { return $webimroot; } } -function is_secure_request() { +function is_secure_request() +{ return - isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' - || isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" - || isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on"; + isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' + || isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" + || isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on"; } -function get_month_selection($fromtime,$totime) { +function get_month_selection($fromtime, $totime) +{ $start = getdate($fromtime); $month = $start['mon']; $year = $start['year']; $result = array(); do { - $current = mktime(0,0,0,$month,1,$year); - $result[date("m.y",$current)] = strftime("%B, %Y",$current); + $current = mktime(0, 0, 0, $month, 1, $year); + $result[date("m.y", $current)] = strftime("%B, %Y", $current); $month++; - if( $month > 12 ) { + if ($month > 12) { $month = 1; $year++; } - } while( $current < $totime ); + } while ($current < $totime); return $result; } -function get_form_date($day,$month) { - if( preg_match('/^(\d{2}).(\d{2})$/', $month, $matches)) { - return mktime(0,0,0,$matches[1],$day,$matches[2]); +function get_form_date($day, $month) +{ + if (preg_match('/^(\d{2}).(\d{2})$/', $month, $matches)) { + return mktime(0, 0, 0, $matches[1], $day, $matches[2]); } return 0; } -function set_form_date($utime,$prefix) { +function set_form_date($utime, $prefix) +{ global $page; $page["form${prefix}day"] = date("d", $utime); $page["form${prefix}month"] = date("m.y", $utime); } -function date_to_text($unixtime) { - if ($unixtime < 60*60*24*30) +function date_to_text($unixtime) +{ + if ($unixtime < 60 * 60 * 24 * 30) return getlocal("time.never"); - + $then = getdate($unixtime); $now = getdate(); if ($then['yday'] == $now['yday'] && $then['year'] == $now['year']) { $date_format = getlocal("time.today.at"); - } else if (($then['yday']+1) == $now['yday'] && $then['year'] == $now['year']) { + } else if (($then['yday'] + 1) == $now['yday'] && $then['year'] == $now['year']) { $date_format = getlocal("time.yesterday.at"); } else { $date_format = getlocal("time.dateformat"); } - - return strftime($date_format." ".getlocal("time.timeformat"), $unixtime); + + return strftime($date_format . " " . getlocal("time.timeformat"), $unixtime); } $dbversion = '1.6.3'; @@ -566,26 +619,26 @@ $settings = array( 'max_uploaded_file_size' => 100000, 'max_connections_from_one_host' => 10, - 'email' => '', /* inbox for left messages */ + 'email' => '', /* inbox for left messages */ 'left_messages_locale' => $home_locale, 'sendmessagekey' => 'center', 'enableban' => '0', 'enablessl' => '0', - 'forcessl' => '0', + 'forcessl' => '0', 'usercanchangename' => '1', 'enablegroups' => '0', 'enablestatistics' => '1', 'enablejabber' => '0', 'enablepresurvey' => '1', - 'surveyaskmail' => '0', - 'surveyaskgroup' => '1', - 'surveyaskmessage' => '0', + 'surveyaskmail' => '0', + 'surveyaskgroup' => '1', + 'surveyaskmessage' => '0', 'enablepopupnotification' => '0', 'showonlineoperators' => '0', 'enablecaptcha' => '0', - 'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */ + 'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */ 'updatefrequency_operator' => 2, 'updatefrequency_chat' => 2, 'updatefrequency_oldchat' => 7, @@ -593,14 +646,15 @@ $settings = array( $settingsloaded = false; $settings_in_db = array(); -function loadsettings_($link) { +function loadsettings_($link) +{ global $settingsloaded, $settings_in_db, $settings, $mysqlprefix; - if($settingsloaded) { + if ($settingsloaded) { return; } $settingsloaded = true; - $sqlresult = mysql_query("select vckey,vcvalue from ${mysqlprefix}chatconfig", $link) or die(' Query failed: '.mysql_error($link)); + $sqlresult = mysql_query("select vckey,vcvalue from ${mysqlprefix}chatconfig", $link) or die(' Query failed: ' . mysql_error($link)); while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) { $name = $row['vckey']; @@ -610,28 +664,31 @@ function loadsettings_($link) { mysql_free_result($sqlresult); } -function loadsettings() { +function loadsettings() +{ global $settingsloaded; - if(!$settingsloaded) { + if (!$settingsloaded) { $link = connect(); loadsettings_($link); mysql_close($link); } } - -function getchatstyle() { + +function getchatstyle() +{ global $settings; - $chatstyle = verifyparam( "style", "/^\w+$/", ""); - if($chatstyle) { + $chatstyle = verifyparam("style", "/^\w+$/", ""); + if ($chatstyle) { return $chatstyle; } loadsettings(); return $settings['chatstyle']; } -function jspath() { +function jspath() +{ global $jsver; - return "js/$jsver"; + return "js/$jsver"; } ?> diff --git a/src/messenger/webim/libs/config.php b/src/messenger/webim/libs/config.php index 0037923d..90baf25d 100644 --- a/src/messenger/webim/libs/config.php +++ b/src/messenger/webim/libs/config.php @@ -50,7 +50,7 @@ $mail_encoding = "utf-8"; /* * Locales */ -$home_locale = "en"; /* native name will be used in this locale */ -$default_locale = "en"; /* if user does not provide known lang */ +$home_locale = "en"; /* native name will be used in this locale */ +$default_locale = "en"; /* if user does not provide known lang */ ?> diff --git a/src/messenger/webim/libs/converter.php b/src/messenger/webim/libs/converter.php index a7ea04d5..02e5a2e2 100644 --- a/src/messenger/webim/libs/converter.php +++ b/src/messenger/webim/libs/converter.php @@ -20,36 +20,36 @@ */ $_utf8win1251 = array( -"\xD0\x90"=>"\xC0","\xD0\x91"=>"\xC1","\xD0\x92"=>"\xC2","\xD0\x93"=>"\xC3","\xD0\x94"=>"\xC4", -"\xD0\x95"=>"\xC5","\xD0\x81"=>"\xA8","\xD0\x96"=>"\xC6","\xD0\x97"=>"\xC7","\xD0\x98"=>"\xC8", -"\xD0\x99"=>"\xC9","\xD0\x9A"=>"\xCA","\xD0\x9B"=>"\xCB","\xD0\x9C"=>"\xCC","\xD0\x9D"=>"\xCD", -"\xD0\x9E"=>"\xCE","\xD0\x9F"=>"\xCF","\xD0\xA0"=>"\xD0","\xD0\xA1"=>"\xD1","\xD0\xA2"=>"\xD2", -"\xD0\xA3"=>"\xD3","\xD0\xA4"=>"\xD4","\xD0\xA5"=>"\xD5","\xD0\xA6"=>"\xD6","\xD0\xA7"=>"\xD7", -"\xD0\xA8"=>"\xD8","\xD0\xA9"=>"\xD9","\xD0\xAA"=>"\xDA","\xD0\xAB"=>"\xDB","\xD0\xAC"=>"\xDC", -"\xD0\xAD"=>"\xDD","\xD0\xAE"=>"\xDE","\xD0\xAF"=>"\xDF","\xD0\x87"=>"\xAF","\xD0\x86"=>"\xB2", -"\xD0\x84"=>"\xAA","\xD0\x8E"=>"\xA1","\xD0\xB0"=>"\xE0","\xD0\xB1"=>"\xE1","\xD0\xB2"=>"\xE2", -"\xD0\xB3"=>"\xE3","\xD0\xB4"=>"\xE4","\xD0\xB5"=>"\xE5","\xD1\x91"=>"\xB8","\xD0\xB6"=>"\xE6", -"\xD0\xB7"=>"\xE7","\xD0\xB8"=>"\xE8","\xD0\xB9"=>"\xE9","\xD0\xBA"=>"\xEA","\xD0\xBB"=>"\xEB", -"\xD0\xBC"=>"\xEC","\xD0\xBD"=>"\xED","\xD0\xBE"=>"\xEE","\xD0\xBF"=>"\xEF","\xD1\x80"=>"\xF0", -"\xD1\x81"=>"\xF1","\xD1\x82"=>"\xF2","\xD1\x83"=>"\xF3","\xD1\x84"=>"\xF4","\xD1\x85"=>"\xF5", -"\xD1\x86"=>"\xF6","\xD1\x87"=>"\xF7","\xD1\x88"=>"\xF8","\xD1\x89"=>"\xF9","\xD1\x8A"=>"\xFA", -"\xD1\x8B"=>"\xFB","\xD1\x8C"=>"\xFC","\xD1\x8D"=>"\xFD","\xD1\x8E"=>"\xFE","\xD1\x8F"=>"\xFF", -"\xD1\x96"=>"\xB3","\xD1\x97"=>"\xBF","\xD1\x94"=>"\xBA","\xD1\x9E"=>"\xA2"); + "\xD0\x90" => "\xC0", "\xD0\x91" => "\xC1", "\xD0\x92" => "\xC2", "\xD0\x93" => "\xC3", "\xD0\x94" => "\xC4", + "\xD0\x95" => "\xC5", "\xD0\x81" => "\xA8", "\xD0\x96" => "\xC6", "\xD0\x97" => "\xC7", "\xD0\x98" => "\xC8", + "\xD0\x99" => "\xC9", "\xD0\x9A" => "\xCA", "\xD0\x9B" => "\xCB", "\xD0\x9C" => "\xCC", "\xD0\x9D" => "\xCD", + "\xD0\x9E" => "\xCE", "\xD0\x9F" => "\xCF", "\xD0\xA0" => "\xD0", "\xD0\xA1" => "\xD1", "\xD0\xA2" => "\xD2", + "\xD0\xA3" => "\xD3", "\xD0\xA4" => "\xD4", "\xD0\xA5" => "\xD5", "\xD0\xA6" => "\xD6", "\xD0\xA7" => "\xD7", + "\xD0\xA8" => "\xD8", "\xD0\xA9" => "\xD9", "\xD0\xAA" => "\xDA", "\xD0\xAB" => "\xDB", "\xD0\xAC" => "\xDC", + "\xD0\xAD" => "\xDD", "\xD0\xAE" => "\xDE", "\xD0\xAF" => "\xDF", "\xD0\x87" => "\xAF", "\xD0\x86" => "\xB2", + "\xD0\x84" => "\xAA", "\xD0\x8E" => "\xA1", "\xD0\xB0" => "\xE0", "\xD0\xB1" => "\xE1", "\xD0\xB2" => "\xE2", + "\xD0\xB3" => "\xE3", "\xD0\xB4" => "\xE4", "\xD0\xB5" => "\xE5", "\xD1\x91" => "\xB8", "\xD0\xB6" => "\xE6", + "\xD0\xB7" => "\xE7", "\xD0\xB8" => "\xE8", "\xD0\xB9" => "\xE9", "\xD0\xBA" => "\xEA", "\xD0\xBB" => "\xEB", + "\xD0\xBC" => "\xEC", "\xD0\xBD" => "\xED", "\xD0\xBE" => "\xEE", "\xD0\xBF" => "\xEF", "\xD1\x80" => "\xF0", + "\xD1\x81" => "\xF1", "\xD1\x82" => "\xF2", "\xD1\x83" => "\xF3", "\xD1\x84" => "\xF4", "\xD1\x85" => "\xF5", + "\xD1\x86" => "\xF6", "\xD1\x87" => "\xF7", "\xD1\x88" => "\xF8", "\xD1\x89" => "\xF9", "\xD1\x8A" => "\xFA", + "\xD1\x8B" => "\xFB", "\xD1\x8C" => "\xFC", "\xD1\x8D" => "\xFD", "\xD1\x8E" => "\xFE", "\xD1\x8F" => "\xFF", + "\xD1\x96" => "\xB3", "\xD1\x97" => "\xBF", "\xD1\x94" => "\xBA", "\xD1\x9E" => "\xA2"); $_win1251utf8 = array( -"\xC0"=>"\xD0\x90","\xC1"=>"\xD0\x91","\xC2"=>"\xD0\x92","\xC3"=>"\xD0\x93","\xC4"=>"\xD0\x94", -"\xC5"=>"\xD0\x95","\xA8"=>"\xD0\x81","\xC6"=>"\xD0\x96","\xC7"=>"\xD0\x97","\xC8"=>"\xD0\x98", -"\xC9"=>"\xD0\x99","\xCA"=>"\xD0\x9A","\xCB"=>"\xD0\x9B","\xCC"=>"\xD0\x9C","\xCD"=>"\xD0\x9D", -"\xCE"=>"\xD0\x9E","\xCF"=>"\xD0\x9F","\xD0"=>"\xD0\xA0","\xD1"=>"\xD0\xA1","\xD2"=>"\xD0\xA2", -"\xD3"=>"\xD0\xA3","\xD4"=>"\xD0\xA4","\xD5"=>"\xD0\xA5","\xD6"=>"\xD0\xA6","\xD7"=>"\xD0\xA7", -"\xD8"=>"\xD0\xA8","\xD9"=>"\xD0\xA9","\xDA"=>"\xD0\xAA","\xDB"=>"\xD0\xAB","\xDC"=>"\xD0\xAC", -"\xDD"=>"\xD0\xAD","\xDE"=>"\xD0\xAE","\xDF"=>"\xD0\xAF","\xAF"=>"\xD0\x87","\xB2"=>"\xD0\x86", -"\xAA"=>"\xD0\x84","\xA1"=>"\xD0\x8E","\xE0"=>"\xD0\xB0","\xE1"=>"\xD0\xB1","\xE2"=>"\xD0\xB2", -"\xE3"=>"\xD0\xB3","\xE4"=>"\xD0\xB4","\xE5"=>"\xD0\xB5","\xB8"=>"\xD1\x91","\xE6"=>"\xD0\xB6", -"\xE7"=>"\xD0\xB7","\xE8"=>"\xD0\xB8","\xE9"=>"\xD0\xB9","\xEA"=>"\xD0\xBA","\xEB"=>"\xD0\xBB", -"\xEC"=>"\xD0\xBC","\xED"=>"\xD0\xBD","\xEE"=>"\xD0\xBE","\xEF"=>"\xD0\xBF","\xF0"=>"\xD1\x80", -"\xF1"=>"\xD1\x81","\xF2"=>"\xD1\x82","\xF3"=>"\xD1\x83","\xF4"=>"\xD1\x84","\xF5"=>"\xD1\x85", -"\xF6"=>"\xD1\x86","\xF7"=>"\xD1\x87","\xF8"=>"\xD1\x88","\xF9"=>"\xD1\x89","\xFA"=>"\xD1\x8A", -"\xFB"=>"\xD1\x8B","\xFC"=>"\xD1\x8C","\xFD"=>"\xD1\x8D","\xFE"=>"\xD1\x8E","\xFF"=>"\xD1\x8F", -"\xB3"=>"\xD1\x96","\xBF"=>"\xD1\x97","\xBA"=>"\xD1\x94","\xA2"=>"\xD1\x9E"); + "\xC0" => "\xD0\x90", "\xC1" => "\xD0\x91", "\xC2" => "\xD0\x92", "\xC3" => "\xD0\x93", "\xC4" => "\xD0\x94", + "\xC5" => "\xD0\x95", "\xA8" => "\xD0\x81", "\xC6" => "\xD0\x96", "\xC7" => "\xD0\x97", "\xC8" => "\xD0\x98", + "\xC9" => "\xD0\x99", "\xCA" => "\xD0\x9A", "\xCB" => "\xD0\x9B", "\xCC" => "\xD0\x9C", "\xCD" => "\xD0\x9D", + "\xCE" => "\xD0\x9E", "\xCF" => "\xD0\x9F", "\xD0" => "\xD0\xA0", "\xD1" => "\xD0\xA1", "\xD2" => "\xD0\xA2", + "\xD3" => "\xD0\xA3", "\xD4" => "\xD0\xA4", "\xD5" => "\xD0\xA5", "\xD6" => "\xD0\xA6", "\xD7" => "\xD0\xA7", + "\xD8" => "\xD0\xA8", "\xD9" => "\xD0\xA9", "\xDA" => "\xD0\xAA", "\xDB" => "\xD0\xAB", "\xDC" => "\xD0\xAC", + "\xDD" => "\xD0\xAD", "\xDE" => "\xD0\xAE", "\xDF" => "\xD0\xAF", "\xAF" => "\xD0\x87", "\xB2" => "\xD0\x86", + "\xAA" => "\xD0\x84", "\xA1" => "\xD0\x8E", "\xE0" => "\xD0\xB0", "\xE1" => "\xD0\xB1", "\xE2" => "\xD0\xB2", + "\xE3" => "\xD0\xB3", "\xE4" => "\xD0\xB4", "\xE5" => "\xD0\xB5", "\xB8" => "\xD1\x91", "\xE6" => "\xD0\xB6", + "\xE7" => "\xD0\xB7", "\xE8" => "\xD0\xB8", "\xE9" => "\xD0\xB9", "\xEA" => "\xD0\xBA", "\xEB" => "\xD0\xBB", + "\xEC" => "\xD0\xBC", "\xED" => "\xD0\xBD", "\xEE" => "\xD0\xBE", "\xEF" => "\xD0\xBF", "\xF0" => "\xD1\x80", + "\xF1" => "\xD1\x81", "\xF2" => "\xD1\x82", "\xF3" => "\xD1\x83", "\xF4" => "\xD1\x84", "\xF5" => "\xD1\x85", + "\xF6" => "\xD1\x86", "\xF7" => "\xD1\x87", "\xF8" => "\xD1\x88", "\xF9" => "\xD1\x89", "\xFA" => "\xD1\x8A", + "\xFB" => "\xD1\x8B", "\xFC" => "\xD1\x8C", "\xFD" => "\xD1\x8D", "\xFE" => "\xD1\x8E", "\xFF" => "\xD1\x8F", + "\xB3" => "\xD1\x96", "\xBF" => "\xD1\x97", "\xBA" => "\xD1\x94", "\xA2" => "\xD1\x9E"); ?> \ No newline at end of file diff --git a/src/messenger/webim/libs/demothread.php b/src/messenger/webim/libs/demothread.php index aca5a73a..b795a787 100644 --- a/src/messenger/webim/libs/demothread.php +++ b/src/messenger/webim/libs/demothread.php @@ -19,72 +19,74 @@ * Evgeny Gryaznov - initial API and implementation */ -function demo_print_message($msg,$format) { +function demo_print_message($msg, $format) +{ global $webim_encoding; - if($format == "xml") { - print "