mirror of
https://github.com/Mibew/java.git
synced 2025-01-22 17:40:35 +03:00
format code in libs/
This commit is contained in:
parent
693ece85fe
commit
a90594235a
@ -15,16 +15,19 @@
|
||||
Copyright 2006 WebCheatSheet.com
|
||||
*/
|
||||
|
||||
function can_show_captcha() {
|
||||
function can_show_captcha()
|
||||
{
|
||||
return extension_loaded("gd");
|
||||
}
|
||||
|
||||
function gen_captcha() {
|
||||
function gen_captcha()
|
||||
{
|
||||
$md5_hash = md5(rand(0, 9999));
|
||||
return substr($md5_hash, 15, 5);
|
||||
}
|
||||
|
||||
function draw_captcha($security_code) {
|
||||
function draw_captcha($security_code)
|
||||
{
|
||||
|
||||
//Set the image width and height
|
||||
$width = 100;
|
||||
|
@ -43,22 +43,26 @@ $kind_avatar = 7;
|
||||
$kind_to_string = array($kind_user => "user", $kind_agent => "agent", $kind_for_agent => "hidden",
|
||||
$kind_info => "inf", $kind_conn => "conn", $kind_events => "event", $kind_avatar => "avatar");
|
||||
|
||||
function get_user_id() {
|
||||
function get_user_id()
|
||||
{
|
||||
return (time() + microtime()) . rand(0, 99999999);
|
||||
}
|
||||
|
||||
function next_token() {
|
||||
function next_token()
|
||||
{
|
||||
return rand(99999, 99999999);
|
||||
}
|
||||
|
||||
function next_revision($link) {
|
||||
function next_revision($link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
perform_query("update ${mysqlprefix}chatrevision set id=LAST_INSERT_ID(id+1)", $link);
|
||||
$val = mysql_insert_id($link);
|
||||
return $val;
|
||||
}
|
||||
|
||||
function post_message_($threadid,$kind,$message,$link,$from=null,$utime=null,$opid=null) {
|
||||
function post_message_($threadid, $kind, $message, $link, $from = null, $utime = null, $opid = null)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$query = sprintf(
|
||||
"insert into ${mysqlprefix}chatmessage (threadid,ikind,tmessage,tname,agentId,dtmcreated) values (%s, %s,'%s',%s,%s,%s)",
|
||||
@ -73,21 +77,24 @@ function post_message_($threadid,$kind,$message,$link,$from=null,$utime=null,$op
|
||||
return mysql_insert_id($link);
|
||||
}
|
||||
|
||||
function post_message($threadid,$kind,$message,$from=null,$agentid=null) {
|
||||
function post_message($threadid, $kind, $message, $from = null, $agentid = null)
|
||||
{
|
||||
$link = connect();
|
||||
$id = post_message_($threadid, $kind, $message, $link, $from, null, $agentid);
|
||||
mysql_close($link);
|
||||
return $id;
|
||||
}
|
||||
|
||||
function prepare_html_message($text) {
|
||||
function prepare_html_message($text)
|
||||
{
|
||||
$escaped_text = htmlspecialchars($text);
|
||||
$text_w_links = preg_replace('/(http|ftp):\/\/\S*/', '<a href="$0" target="_blank">$0</a>', $escaped_text);
|
||||
$multiline = str_replace("\n", "<br/>", $text_w_links);
|
||||
return $multiline;
|
||||
}
|
||||
|
||||
function message_to_html($msg) {
|
||||
function message_to_html($msg)
|
||||
{
|
||||
global $kind_to_string, $kind_avatar;
|
||||
if ($msg['ikind'] == $kind_avatar) return "";
|
||||
$message = "<span>" . date("H:i:s", $msg['created']) . "</span> ";
|
||||
@ -98,7 +105,8 @@ function message_to_html($msg) {
|
||||
return $message;
|
||||
}
|
||||
|
||||
function message_to_text($msg) {
|
||||
function message_to_text($msg)
|
||||
{
|
||||
global $kind_user, $kind_agent, $kind_info, $kind_avatar;
|
||||
if ($msg['ikind'] == $kind_avatar) return "";
|
||||
$message_time = date("H:i:s ", $msg['created']);
|
||||
@ -114,7 +122,8 @@ function message_to_text($msg) {
|
||||
}
|
||||
}
|
||||
|
||||
function get_messages($threadid,$meth,$isuser,&$lastid) {
|
||||
function get_messages($threadid, $meth, $isuser, &$lastid)
|
||||
{
|
||||
global $kind_for_agent, $kind_avatar, $webim_encoding, $mysqlprefix;
|
||||
$link = connect();
|
||||
|
||||
@ -151,7 +160,8 @@ function get_messages($threadid,$meth,$isuser,&$lastid) {
|
||||
return $messages;
|
||||
}
|
||||
|
||||
function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agentid=null) {
|
||||
function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agentid = null)
|
||||
{
|
||||
global $webim_encoding, $webimroot, $connection_timeout, $settings;
|
||||
$threadid = $thread['threadid'];
|
||||
$istyping = abs($thread['current'] - $thread[$isuser ? "lpagent" : "lpuser"]) < $connection_timeout
|
||||
@ -194,7 +204,8 @@ function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agen
|
||||
}
|
||||
}
|
||||
|
||||
function get_user_name($username, $addr, $id) {
|
||||
function get_user_name($username, $addr, $id)
|
||||
{
|
||||
global $settings;
|
||||
loadsettings();
|
||||
return str_replace("{addr}", $addr,
|
||||
@ -202,7 +213,8 @@ function get_user_name($username, $addr, $id) {
|
||||
str_replace("{name}", $username, $settings['usernamepattern'])));
|
||||
}
|
||||
|
||||
function is_ajax_browser($browserid,$ver,$useragent) {
|
||||
function is_ajax_browser($browserid, $ver, $useragent)
|
||||
{
|
||||
if ($browserid == "opera")
|
||||
return $ver >= 8.02;
|
||||
if ($browserid == "safari")
|
||||
@ -221,7 +233,8 @@ function is_ajax_browser($browserid,$ver,$useragent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function is_old_browser($browserid,$ver) {
|
||||
function is_old_browser($browserid, $ver)
|
||||
{
|
||||
if ($browserid == "opera")
|
||||
return $ver < 7.0;
|
||||
if ($browserid == "msie")
|
||||
@ -231,7 +244,8 @@ function is_old_browser($browserid,$ver) {
|
||||
|
||||
$knownAgents = array("opera", "msie", "chrome", "safari", "firefox", "netscape", "mozilla");
|
||||
|
||||
function get_remote_level($useragent) {
|
||||
function get_remote_level($useragent)
|
||||
{
|
||||
global $knownAgents;
|
||||
$useragent = strtolower($useragent);
|
||||
foreach ($knownAgents as $agent) {
|
||||
@ -251,7 +265,8 @@ function get_remote_level($useragent) {
|
||||
return "simple";
|
||||
}
|
||||
|
||||
function is_agent_opera95() {
|
||||
function is_agent_opera95()
|
||||
{
|
||||
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
if (strstr($useragent, "opera")) {
|
||||
if (preg_match("/opera[\\s\/]?(\\d+(\\.\\d+)?)/", $useragent, $matches)) {
|
||||
@ -264,17 +279,20 @@ function is_agent_opera95() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function is_mac_opera() {
|
||||
function is_mac_opera()
|
||||
{
|
||||
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
return strstr($useragent, "opera") && strstr($useragent, "mac");
|
||||
}
|
||||
|
||||
function needsFramesrc() {
|
||||
function needsFramesrc()
|
||||
{
|
||||
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
return strstr($useragent, "safari/");
|
||||
}
|
||||
|
||||
function setup_logo() {
|
||||
function setup_logo()
|
||||
{
|
||||
global $page, $settings;
|
||||
loadsettings();
|
||||
$page['ct.company.name'] = topage($settings['title']);
|
||||
@ -282,7 +300,8 @@ function setup_logo() {
|
||||
$page['webimHost'] = topage($settings['hosturl']);
|
||||
}
|
||||
|
||||
function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info, $referrer,$canshowcaptcha) {
|
||||
function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info, $referrer, $canshowcaptcha)
|
||||
{
|
||||
global $settings, $page;
|
||||
$page['formname'] = topage($name);
|
||||
$page['formemail'] = topage($email);
|
||||
@ -294,7 +313,8 @@ function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info
|
||||
$page['referrer'] = urlencode(topage($referrer));
|
||||
}
|
||||
|
||||
function setup_survey($name, $email, $groupid, $info, $referrer) {
|
||||
function setup_survey($name, $email, $groupid, $info, $referrer)
|
||||
{
|
||||
global $settings, $page;
|
||||
|
||||
$page['formname'] = topage($name);
|
||||
@ -331,7 +351,8 @@ function setup_survey($name, $email, $groupid, $info, $referrer) {
|
||||
$page['showname'] = $settings['usercanchangename'] == "1" ? "1" : "";
|
||||
}
|
||||
|
||||
function setup_chatview_for_user($thread,$level) {
|
||||
function setup_chatview_for_user($thread, $level)
|
||||
{
|
||||
global $page, $webimroot, $settings;
|
||||
loadsettings();
|
||||
$page = array();
|
||||
@ -370,11 +391,12 @@ function setup_chatview_for_user($thread,$level) {
|
||||
$page['frequency'] = $settings['updatefrequency_chat'];
|
||||
}
|
||||
|
||||
function load_canned_messages($locale, $groupid) {
|
||||
function load_canned_messages($locale, $groupid)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$result = select_multi_assoc(
|
||||
"select vcvalue from ${mysqlprefix}chatresponses where locale = '".$locale."' ".
|
||||
"select vcvalue from ${mysqlprefix}chatresponses where locale = '$locale' " .
|
||||
"AND (groupid is NULL OR groupid = 0) order by vcvalue", $link);
|
||||
if (count($result) == 0) {
|
||||
foreach (explode("\n", getstring_('chat.predefined_answers', $locale)) as $answer) {
|
||||
@ -383,7 +405,7 @@ function load_canned_messages($locale, $groupid) {
|
||||
}
|
||||
if ($groupid) {
|
||||
$result2 = select_multi_assoc(
|
||||
"select vcvalue from ${mysqlprefix}chatresponses where locale = '".$locale."' ".
|
||||
"select vcvalue from ${mysqlprefix}chatresponses where locale = '$locale' " .
|
||||
"AND groupid = $groupid order by vcvalue", $link);
|
||||
foreach ($result as $r) {
|
||||
$result2[] = $r;
|
||||
@ -394,7 +416,8 @@ function load_canned_messages($locale, $groupid) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
function setup_chatview_for_operator($thread,$operator) {
|
||||
function setup_chatview_for_operator($thread, $operator)
|
||||
{
|
||||
global $page, $webimroot, $company_logo_link, $company_name, $settings;
|
||||
loadsettings();
|
||||
$page = array();
|
||||
@ -435,7 +458,8 @@ function setup_chatview_for_operator($thread,$operator) {
|
||||
$page['frequency'] = $settings['updatefrequency_chat'];
|
||||
}
|
||||
|
||||
function update_thread_access($threadid, $params, $link) {
|
||||
function update_thread_access($threadid, $params, $link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$clause = "";
|
||||
foreach ($params as $k => $v) {
|
||||
@ -445,10 +469,11 @@ function update_thread_access($threadid, $params, $link) {
|
||||
}
|
||||
perform_query(
|
||||
"update ${mysqlprefix}chatthread set $clause " .
|
||||
"where threadid = ".$threadid,$link);
|
||||
"where threadid = $threadid", $link);
|
||||
}
|
||||
|
||||
function ping_thread($thread, $isuser,$istyping) {
|
||||
function ping_thread($thread, $isuser, $istyping)
|
||||
{
|
||||
global $kind_for_agent, $state_queue, $state_loading, $state_chatting, $state_waiting, $kind_conn, $connection_timeout;
|
||||
$link = connect();
|
||||
$params = array(($isuser ? "lastpinguser" : "lastpingagent") => "CURRENT_TIMESTAMP",
|
||||
@ -485,18 +510,20 @@ function ping_thread($thread, $isuser,$istyping) {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function commit_thread($threadid,$params,$link) {
|
||||
function commit_thread($threadid, $params, $link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$query = "update ${mysqlprefix}chatthread t set lrevision = " . next_revision($link) . ", dtmmodified = CURRENT_TIMESTAMP";
|
||||
foreach ($params as $k => $v) {
|
||||
$query .= ", " . $k . "=" . $v;
|
||||
}
|
||||
$query .= " where threadid = ".$threadid;
|
||||
$query .= " where threadid = $threadid";
|
||||
|
||||
perform_query($query, $link);
|
||||
}
|
||||
|
||||
function rename_user($thread, $newname) {
|
||||
function rename_user($thread, $newname)
|
||||
{
|
||||
global $kind_events;
|
||||
|
||||
$link = connect();
|
||||
@ -509,7 +536,8 @@ function rename_user($thread, $newname) {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function close_thread($thread,$isuser) {
|
||||
function close_thread($thread, $isuser)
|
||||
{
|
||||
global $state_closed, $kind_events, $mysqlprefix;
|
||||
|
||||
$link = connect();
|
||||
@ -524,7 +552,8 @@ function close_thread($thread,$isuser) {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function thread_by_id_($id,$link) {
|
||||
function thread_by_id_($id, $link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
return select_one_row("select threadid,userName,agentName,agentId,lrevision,istate,ltoken,userTyping,agentTyping" .
|
||||
",unix_timestamp(dtmmodified) as modified, unix_timestamp(dtmcreated) as created" .
|
||||
@ -532,19 +561,22 @@ function thread_by_id_($id,$link) {
|
||||
" from ${mysqlprefix}chatthread where threadid = " . $id, $link);
|
||||
}
|
||||
|
||||
function ban_for_addr_($addr,$link) {
|
||||
function ban_for_addr_($addr, $link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
return select_one_row("select banid,comment from ${mysqlprefix}chatban where unix_timestamp(dtmtill) > unix_timestamp(CURRENT_TIMESTAMP) AND address = '" . mysql_real_escape_string($addr, $link) . "'", $link);
|
||||
}
|
||||
|
||||
function thread_by_id($id) {
|
||||
function thread_by_id($id)
|
||||
{
|
||||
$link = connect();
|
||||
$thread = thread_by_id_($id, $link);
|
||||
mysql_close($link);
|
||||
return $thread;
|
||||
}
|
||||
|
||||
function create_thread($groupid,$username,$remoteHost,$referer,$lang,$userid,$userbrowser,$initialState,$link) {
|
||||
function create_thread($groupid, $username, $remoteHost, $referer, $lang, $userid, $userbrowser, $initialState, $link)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$query = sprintf(
|
||||
"insert into ${mysqlprefix}chatthread (userName,userid,ltoken,remote,referer,lrevision,locale,userAgent,dtmcreated,dtmmodified,istate" . ($groupid ? ",groupid" : "") . ") values " .
|
||||
@ -565,7 +597,8 @@ function create_thread($groupid,$username,$remoteHost,$referer,$lang,$userid,$us
|
||||
return $newthread;
|
||||
}
|
||||
|
||||
function do_take_thread($threadid,$operatorId,$operatorName) {
|
||||
function do_take_thread($threadid, $operatorId, $operatorName)
|
||||
{
|
||||
global $state_chatting;
|
||||
$link = connect();
|
||||
commit_thread($threadid,
|
||||
@ -576,7 +609,8 @@ function do_take_thread($threadid,$operatorId,$operatorName) {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function reopen_thread($threadid) {
|
||||
function reopen_thread($threadid)
|
||||
{
|
||||
global $state_queue, $state_loading, $state_waiting, $state_chatting, $state_closed, $state_left, $kind_events;
|
||||
$link = connect();
|
||||
$thread = thread_by_id_($threadid, $link);
|
||||
@ -597,7 +631,8 @@ function reopen_thread($threadid) {
|
||||
return $thread;
|
||||
}
|
||||
|
||||
function take_thread($thread,$operator) {
|
||||
function take_thread($thread, $operator)
|
||||
{
|
||||
global $state_queue, $state_loading, $state_waiting, $state_chatting, $kind_events, $kind_avatar, $home_locale;
|
||||
|
||||
$state = $thread['istate'];
|
||||
@ -633,7 +668,8 @@ function take_thread($thread,$operator) {
|
||||
}
|
||||
}
|
||||
|
||||
function check_for_reassign($thread,$operator) {
|
||||
function check_for_reassign($thread, $operator)
|
||||
{
|
||||
global $state_waiting, $home_locale, $kind_events, $kind_avatar;
|
||||
$operatorName = ($thread['locale'] == $home_locale) ? $operator['vclocalename'] : $operator['vccommonname'];
|
||||
if ($thread['istate'] == $state_waiting &&
|
||||
@ -651,7 +687,8 @@ function check_for_reassign($thread,$operator) {
|
||||
}
|
||||
}
|
||||
|
||||
function check_connections_from_remote($remote,$link) {
|
||||
function check_connections_from_remote($remote, $link)
|
||||
{
|
||||
global $settings, $state_closed, $state_left, $mysqlprefix;
|
||||
if ($settings['max_connections_from_one_host'] == 0) {
|
||||
return true;
|
||||
@ -665,7 +702,8 @@ function check_connections_from_remote($remote,$link) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function visitor_from_request() {
|
||||
function visitor_from_request()
|
||||
{
|
||||
global $namecookie, $webim_encoding, $usercookie;
|
||||
$defaultName = getstring("chat.default.username");
|
||||
$userName = $defaultName;
|
||||
@ -689,7 +727,8 @@ function visitor_from_request() {
|
||||
return array('id' => $userId, 'name' => $userName);
|
||||
}
|
||||
|
||||
function get_remote_host() {
|
||||
function get_remote_host()
|
||||
{
|
||||
$extAddr = $_SERVER['REMOTE_ADDR'];
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) &&
|
||||
$_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR']) {
|
||||
|
@ -27,7 +27,8 @@ require_once(dirname(__FILE__).'/config.php');
|
||||
$version = '1.6.4';
|
||||
$jsver = "164";
|
||||
|
||||
function myiconv($in_enc, $out_enc, $string) {
|
||||
function myiconv($in_enc, $out_enc, $string)
|
||||
{
|
||||
global $_utf8win1251, $_win1251utf8;
|
||||
if ($in_enc == $out_enc) {
|
||||
return $string;
|
||||
@ -46,7 +47,8 @@ function myiconv($in_enc, $out_enc, $string) {
|
||||
return $string; // do not know how to convert
|
||||
}
|
||||
|
||||
function verifyparam( $name, $regexp, $default = null ) {
|
||||
function verifyparam($name, $regexp, $default = null)
|
||||
{
|
||||
if (isset($_GET[$name])) {
|
||||
$val = $_GET[$name];
|
||||
if (preg_match($regexp, $val))
|
||||
@ -65,7 +67,8 @@ function verifyparam( $name, $regexp, $default = null ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function debugexit_print( $var ) {
|
||||
function debugexit_print($var)
|
||||
{
|
||||
echo "<html><body><pre>";
|
||||
print_r($var);
|
||||
echo "</pre></body></html>";
|
||||
@ -74,11 +77,13 @@ function debugexit_print( $var ) {
|
||||
|
||||
$locale_pattern = "/^[\w-]{2,5}$/";
|
||||
|
||||
function locale_exists($locale) {
|
||||
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";
|
||||
@ -94,7 +99,8 @@ function get_available_locales() {
|
||||
return $list;
|
||||
}
|
||||
|
||||
function get_user_locale() {
|
||||
function get_user_locale()
|
||||
{
|
||||
global $default_locale;
|
||||
|
||||
if (isset($_COOKIE['webim_locale'])) {
|
||||
@ -120,7 +126,8 @@ function get_user_locale() {
|
||||
return 'en';
|
||||
}
|
||||
|
||||
function get_locale() {
|
||||
function get_locale()
|
||||
{
|
||||
global $webimroot, $locale_pattern;
|
||||
|
||||
$locale = verifyparam("locale", $locale_pattern, "");
|
||||
@ -147,7 +154,8 @@ if(function_exists("date_default_timezone_set")) {
|
||||
@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();
|
||||
@ -160,7 +168,8 @@ function get_locale_links($href) {
|
||||
return $localeLinks;
|
||||
}
|
||||
|
||||
function load_messages($locale) {
|
||||
function load_messages($locale)
|
||||
{
|
||||
global $messages, $webim_encoding, $output_encoding;
|
||||
$hash = array();
|
||||
$current_encoding = $webim_encoding;
|
||||
@ -184,14 +193,16 @@ function load_messages($locale) {
|
||||
$messages[$locale] = $hash;
|
||||
}
|
||||
|
||||
function getoutputenc() {
|
||||
function getoutputenc()
|
||||
{
|
||||
global $current_locale, $output_encoding, $webim_encoding, $messages;
|
||||
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]))
|
||||
load_messages($locale);
|
||||
@ -206,27 +217,32 @@ function getstring_($text,$locale) {
|
||||
return "!" . $text;
|
||||
}
|
||||
|
||||
function getstring($text) {
|
||||
function getstring($text)
|
||||
{
|
||||
global $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));
|
||||
}
|
||||
|
||||
function getlocal_($text,$locale) {
|
||||
function getlocal_($text, $locale)
|
||||
{
|
||||
global $webim_encoding;
|
||||
return myiconv($webim_encoding, getoutputenc(), getstring_($text, $locale));
|
||||
}
|
||||
|
||||
function topage($text) {
|
||||
function topage($text)
|
||||
{
|
||||
global $webim_encoding;
|
||||
return myiconv($webim_encoding, getoutputenc(), $text);
|
||||
}
|
||||
|
||||
function getstring2_($text,$params,$locale) {
|
||||
function getstring2_($text, $params, $locale)
|
||||
{
|
||||
$string = getstring_($text, $locale);
|
||||
for ($i = 0; $i < count($params); $i++) {
|
||||
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
||||
@ -234,12 +250,14 @@ function getstring2_($text,$params,$locale) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
function getstring2($text,$params) {
|
||||
function getstring2($text, $params)
|
||||
{
|
||||
global $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++) {
|
||||
@ -249,7 +267,8 @@ function getlocal2($text,$params) {
|
||||
}
|
||||
|
||||
/* 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));
|
||||
@ -260,7 +279,8 @@ function getlocalforJS($text,$params) {
|
||||
}
|
||||
|
||||
/* 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]);
|
||||
@ -273,7 +293,8 @@ function getrawparam( $name ) {
|
||||
}
|
||||
|
||||
/* form processors use current Output encoding */
|
||||
function getparam( $name ) {
|
||||
function getparam($name)
|
||||
{
|
||||
global $webim_encoding;
|
||||
if (isset($_POST[$name])) {
|
||||
$value = myiconv(getoutputenc(), $webim_encoding, $_POST[$name]);
|
||||
@ -285,7 +306,8 @@ function getparam( $name ) {
|
||||
die("no " . $name . " parameter");
|
||||
}
|
||||
|
||||
function unicode_urldecode($url) {
|
||||
function unicode_urldecode($url)
|
||||
{
|
||||
preg_match_all('/%u([[:alnum:]]{4})/', $url, $a);
|
||||
|
||||
foreach ($a[1] as $uniord) {
|
||||
@ -307,7 +329,8 @@ function unicode_urldecode($url) {
|
||||
return urldecode($url);
|
||||
}
|
||||
|
||||
function getgetparam($name,$default='') {
|
||||
function getgetparam($name, $default = '')
|
||||
{
|
||||
global $webim_encoding;
|
||||
if (!isset($_GET[$name]) || !$_GET[$name]) {
|
||||
return $default;
|
||||
@ -319,7 +342,8 @@ function getgetparam($name,$default='') {
|
||||
return $value;
|
||||
}
|
||||
|
||||
function connect() {
|
||||
function connect()
|
||||
{
|
||||
global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding, $force_charset_in_connection;
|
||||
if (!extension_loaded("mysql")) {
|
||||
die('Mysql extension is not loaded');
|
||||
@ -333,12 +357,14 @@ function connect() {
|
||||
return $link;
|
||||
}
|
||||
|
||||
function perform_query($query,$link) {
|
||||
function perform_query($query, $link)
|
||||
{
|
||||
mysql_query($query, $link)
|
||||
or die(' Query failed: ' . mysql_error($link) /*.": ".$query*/);
|
||||
}
|
||||
|
||||
function select_one_row($query,$link) {
|
||||
function select_one_row($query, $link)
|
||||
{
|
||||
$result = mysql_query($query, $link) or die(' Query failed: ' .
|
||||
mysql_error($link) /*.": ".$query*/);
|
||||
$line = mysql_fetch_array($result, MYSQL_ASSOC);
|
||||
@ -346,7 +372,8 @@ function select_one_row($query,$link) {
|
||||
return $line;
|
||||
}
|
||||
|
||||
function select_multi_assoc($query, $link) {
|
||||
function select_multi_assoc($query, $link)
|
||||
{
|
||||
$sqlresult = mysql_query($query, $link) or die(' Query failed: ' .
|
||||
mysql_error($link) /*.": ".$query*/);
|
||||
|
||||
@ -358,13 +385,15 @@ function select_multi_assoc($query, $link) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
function db_build_select($fields, $table, $conditions, $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) {
|
||||
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($link));
|
||||
$line = mysql_fetch_array($result, MYSQL_NUM);
|
||||
@ -372,7 +401,8 @@ function db_rows_count($table,$conditions,$countfields, $link) {
|
||||
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,7 +410,8 @@ function start_xml_output() {
|
||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||
}
|
||||
|
||||
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");
|
||||
@ -388,25 +419,29 @@ function start_html_output() {
|
||||
header("Content-type: text/html" . (isset($charset) ? "; charset=" . $charset : ""));
|
||||
}
|
||||
|
||||
function escape_with_cdata($text) {
|
||||
function escape_with_cdata($text)
|
||||
{
|
||||
return "<![CDATA[" . str_replace("]]>", "]]>]]><![CDATA[", $text) . "]]>";
|
||||
}
|
||||
|
||||
function form_value($key) {
|
||||
function form_value($key)
|
||||
{
|
||||
global $page;
|
||||
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"]))
|
||||
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"])) {
|
||||
return in_array($id, $page["form$key"]);
|
||||
@ -414,31 +449,39 @@ function form_value_mb($key,$id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function no_field($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)));
|
||||
}
|
||||
|
||||
function wrong_field($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'"; }
|
||||
function get_popup($href, $jshref, $message, $title, $wndName, $options)
|
||||
{
|
||||
if (!$jshref) {
|
||||
$jshref = "'$href'";
|
||||
}
|
||||
return "<a href=\"$href\" target=\"_blank\" " . ($title ? "title=\"$title\" " : "") . "onclick=\"if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 && window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open($jshref, '$wndName', '$options');this.newWindow.focus();this.newWindow.opener=window;return false;\">$message</a>";
|
||||
}
|
||||
|
||||
function get_image($href,$width,$height) {
|
||||
function get_image($href, $width, $height)
|
||||
{
|
||||
if ($width != 0 && $height != 0)
|
||||
return "<img src=\"$href\" border=\"0\" width=\"$width\" height=\"$height\" alt=\"\"/>";
|
||||
return "<img src=\"$href\" border=\"0\" alt=\"\"/>";
|
||||
}
|
||||
|
||||
function get_gifimage_size($filename) {
|
||||
function get_gifimage_size($filename)
|
||||
{
|
||||
if (function_exists('gd_info')) {
|
||||
$info = gd_info();
|
||||
if (isset($info['GIF Read Support']) && $info['GIF Read Support']) {
|
||||
@ -454,7 +497,8 @@ function get_gifimage_size($filename) {
|
||||
return array(0, 0);
|
||||
}
|
||||
|
||||
function add_params($servlet, $params) {
|
||||
function add_params($servlet, $params)
|
||||
{
|
||||
$infix = '?';
|
||||
if (strstr($servlet, $infix) !== FALSE)
|
||||
$infix = '&';
|
||||
@ -465,11 +509,13 @@ function add_params($servlet, $params) {
|
||||
return $servlet;
|
||||
}
|
||||
|
||||
function div($a,$b) {
|
||||
function div($a, $b)
|
||||
{
|
||||
return ($a - ($a % $b)) / $b;
|
||||
}
|
||||
|
||||
function date_diff_to_text($seconds) {
|
||||
function date_diff_to_text($seconds)
|
||||
{
|
||||
$minutes = div($seconds, 60);
|
||||
$seconds = $seconds % 60;
|
||||
if ($minutes < 60) {
|
||||
@ -481,11 +527,13 @@ function date_diff_to_text($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;
|
||||
@ -494,14 +542,16 @@ function get_app_location($showhost,$issecure) {
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
function get_month_selection($fromtime,$totime) {
|
||||
function get_month_selection($fromtime, $totime)
|
||||
{
|
||||
$start = getdate($fromtime);
|
||||
$month = $start['mon'];
|
||||
$year = $start['year'];
|
||||
@ -518,20 +568,23 @@ function get_month_selection($fromtime,$totime) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_form_date($day,$month) {
|
||||
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) {
|
||||
function date_to_text($unixtime)
|
||||
{
|
||||
if ($unixtime < 60 * 60 * 24 * 30)
|
||||
return getlocal("time.never");
|
||||
|
||||
@ -592,7 +645,8 @@ $settings = array(
|
||||
$settingsloaded = false;
|
||||
$settings_in_db = array();
|
||||
|
||||
function loadsettings_($link) {
|
||||
function loadsettings_($link)
|
||||
{
|
||||
global $settingsloaded, $settings_in_db, $settings, $mysqlprefix;
|
||||
if ($settingsloaded) {
|
||||
return;
|
||||
@ -609,7 +663,8 @@ function loadsettings_($link) {
|
||||
mysql_free_result($sqlresult);
|
||||
}
|
||||
|
||||
function loadsettings() {
|
||||
function loadsettings()
|
||||
{
|
||||
global $settingsloaded;
|
||||
if (!$settingsloaded) {
|
||||
$link = connect();
|
||||
@ -618,7 +673,8 @@ function loadsettings() {
|
||||
}
|
||||
}
|
||||
|
||||
function getchatstyle() {
|
||||
function getchatstyle()
|
||||
{
|
||||
global $settings;
|
||||
$chatstyle = verifyparam("style", "/^\w+$/", "");
|
||||
if ($chatstyle) {
|
||||
@ -628,7 +684,8 @@ function getchatstyle() {
|
||||
return $settings['chatstyle'];
|
||||
}
|
||||
|
||||
function jspath() {
|
||||
function jspath()
|
||||
{
|
||||
global $jsver;
|
||||
return "js/$jsver";
|
||||
}
|
||||
|
@ -19,7 +19,8 @@
|
||||
* 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 "<message>" . myiconv($webim_encoding, "utf-8", escape_with_cdata(message_to_html($msg))) . "</message>\n";
|
||||
@ -28,7 +29,8 @@ function demo_print_message($msg,$format) {
|
||||
}
|
||||
}
|
||||
|
||||
function demo_process_thread($act,$outformat,$lastid,$isuser,$canpost,$istyping,$postmessage) {
|
||||
function demo_process_thread($act, $outformat, $lastid, $isuser, $canpost, $istyping, $postmessage)
|
||||
{
|
||||
global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent, $webimroot, $settings;
|
||||
loadsettings();
|
||||
if ($act == "refresh" || $act == "post") {
|
||||
|
@ -23,7 +23,8 @@ $ifregexp = "/\\\${(if|ifnot):([\w\.]+)}(.*?)(\\\${else:\\2}.*?)?\\\${endif:\\2}
|
||||
$expand_include_path = "";
|
||||
$current_style = "";
|
||||
|
||||
function check_condition($condition) {
|
||||
function check_condition($condition)
|
||||
{
|
||||
global $errors, $page;
|
||||
if ($condition == 'errors') {
|
||||
return isset($errors) && count($errors) > 0;
|
||||
@ -31,7 +32,8 @@ function check_condition($condition) {
|
||||
return isset($page[$condition]) && $page[$condition];
|
||||
}
|
||||
|
||||
function expand_condition($matches) {
|
||||
function expand_condition($matches)
|
||||
{
|
||||
global $page, $ifregexp;
|
||||
$value = check_condition($matches[2]) ^ ($matches[1] != 'if');
|
||||
if ($value) {
|
||||
@ -42,7 +44,8 @@ function expand_condition($matches) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function expand_var($matches) {
|
||||
function expand_var($matches)
|
||||
{
|
||||
global $page, $webimroot, $jsver, $errors, $current_style;
|
||||
$prefix = $matches[1];
|
||||
$var = $matches[2];
|
||||
@ -87,21 +90,24 @@ function expand_var($matches) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function expand_include($matches) {
|
||||
function expand_include($matches)
|
||||
{
|
||||
global $expand_include_path;
|
||||
$name = $matches[1];
|
||||
$contents = @file_get_contents($expand_include_path . $name) or die("cannot load template");
|
||||
return $contents;
|
||||
}
|
||||
|
||||
function expandtext($text) {
|
||||
function expandtext($text)
|
||||
{
|
||||
global $ifregexp;
|
||||
$text = preg_replace_callback("/\\\${include:([\w\.]+)}/", "expand_include", $text);
|
||||
$text = preg_replace_callback($ifregexp, "expand_condition", $text);
|
||||
return preg_replace_callback("/\\\${(\w+:)?([\w\.,]+)}/", "expand_var", $text);
|
||||
}
|
||||
|
||||
function expand($basedir,$style,$filename) {
|
||||
function expand($basedir, $style, $filename)
|
||||
{
|
||||
global $expand_include_path, $current_style;
|
||||
start_html_output();
|
||||
if (!is_dir("$basedir/$style")) {
|
||||
|
@ -19,7 +19,8 @@
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
function group_by_id($id) {
|
||||
function group_by_id($id)
|
||||
{
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$group = select_one_row(
|
||||
@ -28,7 +29,8 @@ function group_by_id($id) {
|
||||
return $group;
|
||||
}
|
||||
|
||||
function get_group_name($group) {
|
||||
function get_group_name($group)
|
||||
{
|
||||
global $home_locale, $current_locale;
|
||||
if ($home_locale == $current_locale || !isset($group['vccommonname']) || !$group['vccommonname'])
|
||||
return $group['vclocalname'];
|
||||
@ -36,7 +38,8 @@ function get_group_name($group) {
|
||||
return $group['vccommonname'];
|
||||
}
|
||||
|
||||
function setup_group_settings_tabs($gid, $active) {
|
||||
function setup_group_settings_tabs($gid, $active)
|
||||
{
|
||||
global $page, $webimroot, $settings;
|
||||
if ($gid) {
|
||||
$page['tabs'] = array(
|
||||
@ -48,7 +51,8 @@ function setup_group_settings_tabs($gid, $active) {
|
||||
}
|
||||
}
|
||||
|
||||
function get_operator_groupslist($operatorid, $link) {
|
||||
function get_operator_groupslist($operatorid, $link)
|
||||
{
|
||||
global $settings, $mysqlprefix;
|
||||
if ($settings['enablegroups'] == '1') {
|
||||
$groupids = array(0);
|
||||
|
@ -19,7 +19,8 @@
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
function webim_mail($toaddr, $reply_to, $subject, $body, $link) {
|
||||
function webim_mail($toaddr, $reply_to, $subject, $body, $link)
|
||||
{
|
||||
global $webim_encoding, $webim_mailbox, $mail_encoding, $current_locale;
|
||||
|
||||
$headers = "From: $webim_mailbox\r\n"
|
||||
|
@ -19,7 +19,8 @@
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
function setup_operator_settings_tabs($opId, $active) {
|
||||
function setup_operator_settings_tabs($opId, $active)
|
||||
{
|
||||
global $page, $webimroot, $settings;
|
||||
loadsettings();
|
||||
|
||||
|
@ -22,19 +22,22 @@
|
||||
$pagination_spacing = " ";
|
||||
$links_on_page = 5;
|
||||
|
||||
function generate_pagination_link($page,$title) {
|
||||
function generate_pagination_link($page, $title)
|
||||
{
|
||||
$lnk = $_SERVER['REQUEST_URI'];
|
||||
$href = preg_replace("/\?page=\d+\&/", "?", preg_replace("/\&page=\d+/", "", $lnk));
|
||||
$href .= strstr($href, "?") ? "&page=$page" : "?page=$page";
|
||||
return "<a href=\"" . htmlspecialchars($href) . "\" class=\"pagelink\">$title</a>";
|
||||
}
|
||||
|
||||
function generate_pagination_image($id,$alt) {
|
||||
function generate_pagination_image($id, $alt)
|
||||
{
|
||||
global $webimroot;
|
||||
return "<img src=\"$webimroot/images/$id.gif\" border=\"0\" alt=\"" . htmlspecialchars($alt) . "\"/>";
|
||||
}
|
||||
|
||||
function prepare_pagination($items_count,$default_items_per_page=15) {
|
||||
function prepare_pagination($items_count, $default_items_per_page = 15)
|
||||
{
|
||||
global $page;
|
||||
|
||||
if ($items_count) {
|
||||
@ -61,7 +64,8 @@ function prepare_pagination($items_count,$default_items_per_page=15) {
|
||||
}
|
||||
}
|
||||
|
||||
function setup_pagination($items,$default_items_per_page=15) {
|
||||
function setup_pagination($items, $default_items_per_page = 15)
|
||||
{
|
||||
global $page;
|
||||
prepare_pagination($items ? count($items) : 0, $default_items_per_page);
|
||||
if ($items && count($items) > 0) {
|
||||
@ -72,7 +76,8 @@ function setup_pagination($items,$default_items_per_page=15) {
|
||||
}
|
||||
}
|
||||
|
||||
function select_with_pagintation($fields, $table, $conditions, $order, $countfields, $link) {
|
||||
function select_with_pagintation($fields, $table, $conditions, $order, $countfields, $link)
|
||||
{
|
||||
global $page;
|
||||
$count = db_rows_count($table, $conditions, $countfields, $link);
|
||||
prepare_pagination($count);
|
||||
@ -85,13 +90,15 @@ function select_with_pagintation($fields, $table, $conditions, $order, $countfie
|
||||
}
|
||||
}
|
||||
|
||||
function setup_empty_pagination() {
|
||||
function setup_empty_pagination()
|
||||
{
|
||||
global $page;
|
||||
$page['pagination.items'] = false;
|
||||
$page['pagination'] = false;
|
||||
}
|
||||
|
||||
function generate_pagination($pagination,$bottom=true) {
|
||||
function generate_pagination($pagination, $bottom = true)
|
||||
{
|
||||
global $pagination_spacing, $links_on_page;
|
||||
$result = getlocal2("tag.pagination.info",
|
||||
array($pagination['page'], $pagination['total'], $pagination['start'] + 1, $pagination['end'], $pagination['count'])) . "<br/>";
|
||||
|
@ -19,7 +19,8 @@
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
function update_settings() {
|
||||
function update_settings()
|
||||
{
|
||||
global $settings, $settings_in_db, $mysqlprefix;
|
||||
$link = connect();
|
||||
foreach ($settings as $key => $value) {
|
||||
@ -33,7 +34,8 @@ function update_settings() {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function setup_settings_tabs($active) {
|
||||
function setup_settings_tabs($active)
|
||||
{
|
||||
global $page, $webimroot;
|
||||
$page['tabs'] = array(
|
||||
getlocal("page_settings.tab.main") => $active != 0 ? "$webimroot/operator/settings.php" : "",
|
||||
|
@ -19,7 +19,8 @@
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
function get_useragent_version($userAgent) {
|
||||
function get_useragent_version($userAgent)
|
||||
{
|
||||
global $knownAgents;
|
||||
if (is_array($knownAgents)) {
|
||||
$userAgent = strtolower($userAgent);
|
||||
@ -48,7 +49,8 @@ function get_useragent_version($userAgent) {
|
||||
return $userAgent;
|
||||
}
|
||||
|
||||
function get_user_addr($addr) {
|
||||
function get_user_addr($addr)
|
||||
{
|
||||
global $settings;
|
||||
if ($settings['geolink'] && preg_match("/(\\d+\\.\\d+\\.\\d+\\.\\d+)/", $addr, $matches)) {
|
||||
$userip = $matches[1];
|
||||
|
Loading…
Reference in New Issue
Block a user