From 2efea861672090f2aa88bacb66849a30cbbdc76f Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sun, 19 Jul 2009 00:07:34 +0000 Subject: [PATCH] show if group is online, filter out empty groups in redirect and visitor selector, captcha checkbox in settings git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@592 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/inprogress/webim/fgot2.php | 2 +- src/messenger/webim/libs/chat.php | 19 ++++++++++++++++--- src/messenger/webim/libs/operator.php | 22 ++++++++++++++-------- src/messenger/webim/locales/en/properties | 2 ++ src/messenger/webim/locales/ru/properties | 2 ++ src/messenger/webim/operator/canned.php | 4 +++- src/messenger/webim/operator/features.php | 3 ++- src/messenger/webim/operator/getcode.php | 4 +++- src/messenger/webim/operator/groups.php | 9 ++++++++- src/messenger/webim/operator/opgroups.php | 5 ++++- src/messenger/webim/view/features.php | 9 +++++++++ src/messenger/webim/view/groups.php | 9 +++++++++ 12 files changed, 73 insertions(+), 17 deletions(-) diff --git a/src/messenger/inprogress/webim/fgot2.php b/src/messenger/inprogress/webim/fgot2.php index 50b4955b..91ebf92a 100644 --- a/src/messenger/inprogress/webim/fgot2.php +++ b/src/messenger/inprogress/webim/fgot2.php @@ -8,5 +8,5 @@ Your username:$username Your new password:$password click here to confirm the changes." -Mail($to, $subj, $message); +# mail($to, $subj, $message); ?> \ No newline at end of file diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index fe2e131c..a227ffb6 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -282,10 +282,23 @@ function setup_survey($name, $email, $groupid, $info, $referrer) { $page['referrer'] = urlencode(topage($referrer)); if($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") { - $allgroups = get_groups(false); + $link = connect(); + $allgroups = get_groups($link,true,true); + mysql_close($link); $val = ""; - foreach($allgroups as $k) { - $val .= ""; + foreach($allgroups as $k) { + $groupname = $k['vclocalname']; + if($k['inumofagents'] == 0) { + continue; + } + if($k['ilastseen'] !== NULL && $k['ilastseen'] < $settings['online_timeout']) { + $groupname .= " (online)"; + if(!$groupid) { + $groupid = $k['groupid']; + } + } + $isselected = $k['groupid'] == $groupid; + $val .= ""; } $page['groups'] = $val; } diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index 0cbb2a05..728a9791 100644 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -211,8 +211,7 @@ function setup_redirect_links($threadid,$token) { $operators = select_multi_assoc($query, $link); if($settings['enablegroups'] == "1") { - $query = "select groupid, vclocalname, vccommonname from chatgroup order by vclocalname $limit"; - $groups = select_multi_assoc($query, $link); + $groups = get_groups($link, true, true); } mysql_close($link); @@ -233,11 +232,15 @@ function setup_redirect_links($threadid,$token) { if($settings['enablegroups'] == "1") { $params = array('thread' => $threadid, 'token' => $token); foreach($groups as $group) { + if($group['inumofagents'] == 0) { + continue; + } $params['nextGroup'] = $group['groupid']; + $online = $group['ilastseen'] < $settings['online_timeout'] ? getlocal("char.redirect.operator.online_suff") : ""; $group_list .= "
  • ". topage(get_group_name($group)). - "
  • "; + " $online"; } } $page['redirectToGroup'] = $group_list; @@ -276,16 +279,19 @@ function prepare_menu($operator,$hasright=true) { } } -function get_groups($countagents) { - $link = connect(); +function get_groups($link,$countagents, $checkonline=false) { $query = "select chatgroup.groupid as groupid, vclocalname, vclocaldescription". ($countagents ? ", (SELECT count(*) from chatgroupoperator where chatgroup.groupid = chatgroupoperator.groupid) as inumofagents" : ""). + ($checkonline + ? ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ". + "from chatgroupoperator, chatoperator where chatgroup.groupid = chatgroupoperator.groupid ". + "and chatgroupoperator.operatorid = chatoperator.operatorid) as ilastseen" + : ""). + " from chatgroup order by vclocalname"; - $result = select_multi_assoc($query, $link); - mysql_close($link); - return $result; + return select_multi_assoc($query, $link); } function get_operator_groupids($operatorid) { diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index d091e1e5..d940cb7f 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -390,6 +390,8 @@ settings.geolinkparams.description=Window size and toolbars hiding settings.geolinkparams=Geolocation window options settings.host.description=Destination for you company name or logo link settings.host=URL of your website +settings.leavemessage_captcha.description=Protection against automated spam (captcha) +settings.leavemessage_captcha=Force visitor to enter verification code when leaving message settings.logo.description=Enter http address of your company logo settings.logo=Your company logo settings.no.title=Please enter your company title diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index 4365460d..10fefbaf 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -386,6 +386,8 @@ settings.geolinkparams.description= settings.geolinkparams=Опции для окна с геоинформацией settings.host.description=Будет открываться по нажатию на логотип или название компании в чат окне settings.host=Ссылка на ваш веб сайт +settings.leavemessage_captcha.description=Защита от автоматизированного спама (captcha) +settings.leavemessage_captcha=Разрешать оставлять сообщение только после ввода специального кода с картинки settings.logo.description=Введите ссылку на логотип компании settings.logo=Лого компании settings.no.title=Введите имя Вашей компании diff --git a/src/messenger/webim/operator/canned.php b/src/messenger/webim/operator/canned.php index ebd0ca25..2aaa0d5d 100644 --- a/src/messenger/webim/operator/canned.php +++ b/src/messenger/webim/operator/canned.php @@ -81,7 +81,9 @@ if($settings['enablegroups'] == '1') { } } - $allgroups = get_groups(false); + $link = connect(); + $allgroups = get_groups($link, false); + mysql_close($link); $page['groups'] = array(); $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); foreach($allgroups as $g) { diff --git a/src/messenger/webim/operator/features.php b/src/messenger/webim/operator/features.php index b28ae987..41ec9bcc 100644 --- a/src/messenger/webim/operator/features.php +++ b/src/messenger/webim/operator/features.php @@ -25,7 +25,8 @@ $options = array( 'enableban', 'usercanchangename', 'enablegroups', 'enablestatistics', 'enablessl', 'forcessl', 'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage', - 'enablepopupnotification'); + 'enablepopupnotification', + 'enablecaptcha'); loadsettings(); $params = array(); diff --git a/src/messenger/webim/operator/getcode.php b/src/messenger/webim/operator/getcode.php index c5639457..a6705fcd 100644 --- a/src/messenger/webim/operator/getcode.php +++ b/src/messenger/webim/operator/getcode.php @@ -92,7 +92,9 @@ $page['availableLocales'] = $image_locales; $page['availableStyles'] = $stylelist; if($settings['enablegroups'] == '1') { - $allgroups = get_groups(false); + $link = connect(); + $allgroups = get_groups($link,false); + mysql_close($link); $page['groups'] = array(); $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); foreach($allgroups as $g) { diff --git a/src/messenger/webim/operator/groups.php b/src/messenger/webim/operator/groups.php index e433c1f1..c218814f 100644 --- a/src/messenger/webim/operator/groups.php +++ b/src/messenger/webim/operator/groups.php @@ -40,8 +40,15 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) { } } +function is_online($group) { + global $settings; + return $group['ilastseen'] && $group['ilastseen'] < $settings['online_timeout'] ? "1" : ""; +} + $page = array(); -$page['groups'] = get_groups(true); +$link = connect(); +$page['groups'] = get_groups($link, true, true); +mysql_close($link); $page['canmodify'] = is_capable($can_administrate, $operator); prepare_menu($operator); diff --git a/src/messenger/webim/operator/opgroups.php b/src/messenger/webim/operator/opgroups.php index 6eafc63a..64fb04de 100644 --- a/src/messenger/webim/operator/opgroups.php +++ b/src/messenger/webim/operator/opgroups.php @@ -27,9 +27,12 @@ function update_operator_groups($operatorid,$newvalue) { mysql_close($link); } + $opId = verifyparam( "op","/^\d{1,9}$/"); $page = array('opid' => $opId); -$page['groups'] = get_groups(false); +$link = connect(); +$page['groups'] = get_groups($link, false); +mysql_close($link); $errors = array(); $canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator)) diff --git a/src/messenger/webim/view/features.php b/src/messenger/webim/view/features.php index 2a8b09a1..d4db1c90 100644 --- a/src/messenger/webim/view/features.php +++ b/src/messenger/webim/view/features.php @@ -177,6 +177,15 @@ require_once('inc_errors.php');
    +
    +
    +
    + /> +
    +
    +
    +
    +
    diff --git a/src/messenger/webim/view/groups.php b/src/messenger/webim/view/groups.php index 9f40368c..a07e1cbf 100644 --- a/src/messenger/webim/view/groups.php +++ b/src/messenger/webim/view/groups.php @@ -49,6 +49,8 @@ require_once('inc_errors.php'); + + @@ -70,6 +72,13 @@ if(count($page['groups']) > 0) { + + + + + + +