mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-16 09:04:11 +03:00
block visitors feature, turned off by default
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@154 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
aa7c974e59
commit
4d29191044
@ -119,6 +119,11 @@ var HtmlGenerationUtils = {
|
||||
gen += '</a></td>';
|
||||
}
|
||||
return HtmlGenerationUtils.generateOneRowTable(gen);
|
||||
},
|
||||
banCell: function(id){
|
||||
return '<td width="30" align="center">'+
|
||||
HtmlGenerationUtils.popupLink( webimRoot+'/operator/ban.php?thread='+id, localized[2], "ban"+id, '<img src="'+webimRoot+'/images/ban.gif" width="15" height="15" border="0" alt="'+localized[2]+'">', 550, 440, null)+
|
||||
'</td>';
|
||||
}
|
||||
};
|
||||
|
||||
@ -164,7 +169,8 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
|
||||
canopen = true;
|
||||
else if( attr.nodeName == "canview" )
|
||||
canview = true;
|
||||
|
||||
else if( attr.nodeName == "ban" )
|
||||
ban = attr.nodeValue;
|
||||
}
|
||||
|
||||
function setcell(_table, row,id,pcontent) {
|
||||
@ -190,6 +196,12 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
|
||||
var modified = NodeUtils.getNodeValue(node,"modified");
|
||||
var message = NodeUtils.getNodeValue(node,"message");
|
||||
var etc = '<td class="table">'+NodeUtils.getNodeValue(node,"useragent")+'</td>';
|
||||
|
||||
if(ban != null) {
|
||||
etc = '<td class="table">'+NodeUtils.getNodeValue(node,"reason")+'</td>';
|
||||
}
|
||||
|
||||
etc += HtmlGenerationUtils.banCell(id);
|
||||
etc = HtmlGenerationUtils.generateOneRowTable(etc);
|
||||
|
||||
var startRow = CommonUtils.getRow(stateid, this.t);
|
||||
|
BIN
src/messenger/webim/images/ban.gif
Normal file
BIN
src/messenger/webim/images/ban.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 185 B |
BIN
src/messenger/webim/images/buttons/createban.gif
Normal file
BIN
src/messenger/webim/images/buttons/createban.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -60,6 +60,15 @@ $dbtables = array(
|
||||
"id" => "INT NOT NULL"
|
||||
),
|
||||
|
||||
"chatban" => array(
|
||||
"banid" => "INT NOT NULL auto_increment PRIMARY KEY",
|
||||
"dtmcreated" => "datetime DEFAULT 0",
|
||||
"dtmtill" => "datetime DEFAULT 0",
|
||||
"address" => "varchar(255)",
|
||||
"comment" => "varchar(255)",
|
||||
"blockedCount" => "int DEFAULT 0"
|
||||
),
|
||||
|
||||
"chatconfig" => array (
|
||||
"id" => "INT NOT NULL auto_increment PRIMARY KEY",
|
||||
"vckey" => "varchar(255)",
|
||||
@ -72,6 +81,7 @@ $memtables = array();
|
||||
$dbtables_can_update = array(
|
||||
"chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount", "nextagent", "shownmessageid", "userid", "userAgent"),
|
||||
"chatmessage" => array("agentId"),
|
||||
"chatban" => array(),
|
||||
);
|
||||
|
||||
function show_install_err($text) {
|
||||
|
@ -1 +1 @@
|
||||
var myAgent="";var rk=0;var myRealAgent="";function sk(){var tk=["\u006f\u0070\145\162\141","\155\u0073ie","\u0073\141fari","\146ir\u0065f\157x","n\145\164\163ca\160\145","mo\u007a\u0069\u006cl\141"];var lj=navigator.userAgent.toLowerCase();for(var i=0;i<tk.length;i++){var uk=tk[i];if(lj.indexOf(uk)!=-1){myAgent=uk;if(!window.RegExp)break;var hk=new RegExp(uk+"\u005b \/\135\077\050\u005b\060-\071\135\053\050\.\133\u0030-\u0039\135\053)\077)");if(hk.exec(lj)!=null){rk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\107\u0065\143\153\u006f")myAgent="m\157\172";} sk();function getEl(name){return document.getElementById(name);}
|
||||
var myAgent="";var sk=0;var myRealAgent="";function tk(){var uk=["\u006f\160er\u0061","m\u0073\u0069\145","\163a\u0066\141\u0072\151","firef\u006f\170","n\145\u0074\u0073\143a\160\145","\u006d\u006fz\u0069lla"];var oj=navigator.userAgent.toLowerCase();for(var i=0;i<uk.length;i++){var hk=uk[i];if(oj.indexOf(hk)!=-1){myAgent=hk;if(!window.RegExp)break;var ik=new RegExp(hk+"\133\040\/]\077\u0028[\060-\071]\053(\.\u005b0\u002d\071\135\053)\077\u0029");if(ik.exec(oj)!=null){sk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\u0047ec\u006b\u006f")myAgent="moz";} tk();function getEl(name){return document.getElementById(name);}
|
File diff suppressed because one or more lines are too long
@ -388,6 +388,10 @@ function thread_by_id_($id,$link) {
|
||||
" from chatthread where threadid = ". $id, $link );
|
||||
}
|
||||
|
||||
function ban_for_addr_($addr,$link) {
|
||||
return select_one_row("select banid,comment from chatban where unix_timestamp(dtmtill) > unix_timestamp(CURRENT_TIMESTAMP) AND address = '".quote_smart($addr,$link)."'", $link );
|
||||
}
|
||||
|
||||
function thread_by_id($id) {
|
||||
$link = connect();
|
||||
$thread = thread_by_id_($id,$link);
|
||||
|
@ -425,7 +425,8 @@ $settings = array(
|
||||
'email' => '', /* inbox for left messages */
|
||||
'title' => 'Company',
|
||||
'hosturl' => 'http://webim.sourceforge.net',
|
||||
'logo' => ''
|
||||
'logo' => '',
|
||||
'enableban' => '0'
|
||||
);
|
||||
$settingsloaded = false;
|
||||
$settings_in_db = array();
|
||||
|
BIN
src/messenger/webim/locales/en/images/delete.gif
Normal file
BIN
src/messenger/webim/locales/en/images/delete.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -135,23 +135,42 @@ form.field.password_confirm=Confirmation
|
||||
form.field.password_confirm.description=Confirm new password.
|
||||
form.field.password=Password
|
||||
form.field.password.description=Enter new password or leave the <br/>field empty to keep previous one.
|
||||
form.field.address=Visitor's Address
|
||||
form.field.address.description=Ex: 12.23.45.123 or todo.com
|
||||
form.field.ban_days=Days
|
||||
form.field.ban_days.description=How many days to ignore this address
|
||||
form.field.ban_comment=Comment
|
||||
form.field.ban_comment.description=Reason of block
|
||||
button.enter=Enter
|
||||
button.save=Save
|
||||
button.search=Search
|
||||
button.delete=Delete
|
||||
tag.pagination.info=Page {0} of {1}, {2}-{3} from {4}
|
||||
tag.pagination.no_items=Found 0 elements
|
||||
tag.pagination.no_items.elements=No elements
|
||||
image.chat.history=/locales/en/images/history.gif
|
||||
image.chat.message=/locales/en/images/message.gif
|
||||
image.button.login=/locales/en/images/login.gif
|
||||
image.button.save=/locales/en/images/save.gif
|
||||
image.button.search=/locales/en/images/search.gif
|
||||
image.button.delete=/locales/en/images/delete.gif
|
||||
page_bans.list=List of banned IPs:
|
||||
page_bans.title=Blocked
|
||||
page_bans.to=Till
|
||||
page_bans.add=Add address
|
||||
page_ban.title=Block address
|
||||
page_ban.intro=Here you can block malicious visitors that affect you work by spam messages.
|
||||
page_ban.sent=Address {0} is blocked for specified number of days.
|
||||
page_ban.thread=You opened this window for "{0}" thread, <i>Address</i> field is already filled. Select number of days and click <i>Send</i>.
|
||||
admin.content.client_settings=Specify options affecting chat window and common system behavior
|
||||
app.title=Web Instant Messenger
|
||||
ban.error.duplicate=Address {0} is already in the system, click <a href="ban.php?id={1}">here</a> to edit it.
|
||||
chat.came.from=Vistor came from page {0}
|
||||
confirm.take.head=Change operator
|
||||
confirm.take.message=Visitor <span style="color:blue;">{0}</span> is already served by <span style="color:green;">{1}</span>.<br/> Are your really sure you wan't to start chatting the visitor?
|
||||
confirm.take.no=No, close the window
|
||||
confirm.take.yes=Yes, I'm sure
|
||||
content.blocked=Here you can defend from malicious visitors.
|
||||
content.history=Search the dialogs history
|
||||
content.logoff=Log out of the system.
|
||||
errors.wrong_field=Please fill "{0}" correctly.
|
||||
@ -193,6 +212,7 @@ leavemessage.title=Leave your message
|
||||
leftMenu.client_settings=Settings
|
||||
localeid=English (en)
|
||||
menu.agents=Agents list
|
||||
menu.blocked=Blocked visitors
|
||||
menu.main=Main
|
||||
menu.operator=You are {0}
|
||||
no_such_operator=No such operator
|
||||
@ -209,8 +229,10 @@ settings.company.title=Company title
|
||||
settings.company.title.description=Enter your company title
|
||||
settings.email=Email
|
||||
settings.email.description=Enter email to receive system messages
|
||||
settings.enableban=Enable feature "Malicious Visitors"
|
||||
settings.enableban.description=Using it you can block attacks from specific IPs
|
||||
settings.host=URL of your website
|
||||
settings.host.description=Destination for you company name or logo link
|
||||
settings.host.description=Destination for you company name or logo link
|
||||
settings.logo=Your company logo
|
||||
settings.logo.description=Enter http address of your company logo
|
||||
settings.no.title=Please enter your company title
|
||||
|
BIN
src/messenger/webim/locales/ru/images/delete.gif
Normal file
BIN
src/messenger/webim/locales/ru/images/delete.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -135,23 +135,42 @@ form.field.password_confirm=
|
||||
form.field.password_confirm.description=Подтвердите введенный пароль.
|
||||
form.field.password=Пароль
|
||||
form.field.password.description=Введите новый пароль или оставьте поле <br/>пустым, чтобы сохранить старый.
|
||||
form.field.address=Адрес посетителя
|
||||
form.field.address.description=Например: 12.23.45.123 или relay.info.ru
|
||||
form.field.ban_days=Дни
|
||||
form.field.ban_days.description=Количество дней, <br/> на которое будет запрещен адрес
|
||||
form.field.ban_comment=Комментарий
|
||||
form.field.ban_comment.description=Причина запрета
|
||||
button.enter=Войти
|
||||
button.save=Сохранить
|
||||
button.search=Искать
|
||||
button.delete=Удалить
|
||||
tag.pagination.info=Страница {0} из {1}, показаны {2}-{3} из {4}
|
||||
tag.pagination.no_items=Ничего не найдено
|
||||
tag.pagination.no_items.elements=Нет элементов для отображения.
|
||||
image.chat.history=/locales/ru/images/history.gif
|
||||
image.chat.message=/locales/ru/images/message.gif
|
||||
image.button.login=/locales/ru/images/login.gif
|
||||
image.button.save=/locales/ru/images/save.gif
|
||||
image.button.search=/locales/ru/images/search.gif
|
||||
image.button.delete=/locales/ru/images/delete.gif
|
||||
page_bans.list=Список запрещенных адресов:
|
||||
page_bans.title=Запреты
|
||||
page_bans.to=До
|
||||
page_bans.add=Добавить адрес
|
||||
page_ban.title=Запрет адреса
|
||||
page_ban.intro=С помощью механизма запрета Вы можете бороться с нежелательными посетителями, которые нарушают работу консультантов, открывая большое количество окон или присылая спам сообщения.
|
||||
page_ban.sent=Адрес {0} запрещен на указанное число дней.
|
||||
page_ban.thread=Вы открыли это окно для диалога с "{0}", поэтому поле <i>Адрес</i> уже заполнено. Выберите количество дней и нажмите <i>Отправить</i>.
|
||||
admin.content.client_settings=Вы можете задать опции влияющие на отображение чат окна и общее поведение системы
|
||||
app.title=Веб Мессенджер
|
||||
ban.error.duplicate=Адрес {0} уже зарегестрирован в системе, нажмите <a href="ban.php?id={1}">здесь</a> чтобы отредактировать его.
|
||||
chat.came.from=Посетитель пришел со страницы {0}
|
||||
confirm.take.head=Сменить оператора
|
||||
confirm.take.message=С посетителем <span style="color:blue;">{0}</span> уже общается <span style="color:green;">{1}</span>.<br/>Вы уверены что хотите сменить его?
|
||||
confirm.take.no=Нет, закрыть окно
|
||||
confirm.take.yes=Да, я уверен
|
||||
content.blocked=Здесь можно защищаться от спама и вредных посетителей
|
||||
content.history=Поиск по истории диалогов
|
||||
content.logoff=Покинуть систему.
|
||||
errors.wrong_field=Неправильно заполнено поле "{0}"
|
||||
@ -193,6 +212,7 @@ leavemessage.title=
|
||||
leftMenu.client_settings=Настройки
|
||||
localeid=Russian (ru)
|
||||
menu.agents=Список агентов
|
||||
menu.blocked=Нежелательные посетители
|
||||
menu.main=Главная
|
||||
menu.operator=Вы {0}
|
||||
no_such_operator=Запрашиваемая учетная запись не существует
|
||||
@ -209,6 +229,8 @@ settings.company.title=
|
||||
settings.company.title.description=Введите название Вашей компании
|
||||
settings.email=Адрес электронной почты
|
||||
settings.email.description=Введите адрес электронной почты для получения сообщений от системы
|
||||
settings.enableban=Включить функцию "Нежелательные посетители"
|
||||
settings.enableban.description=С ее помощью можно блокировать атаки с определенных адресов
|
||||
settings.host=Ссылка на ваш веб сайт
|
||||
settings.host.description=Будет открываться по нажатию на логотип или название компании в чат окне
|
||||
settings.logo=Лого компании
|
||||
|
119
src/messenger/webim/operator/ban.php
Normal file
119
src/messenger/webim/operator/ban.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
require_once('../libs/common.php');
|
||||
require_once('../libs/chat.php');
|
||||
require_once('../libs/operator.php');
|
||||
require_once('../libs/pagination.php');
|
||||
|
||||
$operator = check_login();
|
||||
$page = array('banId' => '', 'operator' => topage(get_operator_name($operator)) );
|
||||
$page['saved'] = false;
|
||||
$page['thread'] = '';
|
||||
$page['threadid'] = '';
|
||||
$errors = array();
|
||||
|
||||
if( isset($_POST['address']) ) {
|
||||
$banId = verifyparam( "banId", "/^(\d{1,9})?$/", "");
|
||||
$address = getparam("address");
|
||||
$days = getparam("days");
|
||||
$comment = getparam('comment');
|
||||
$threadid = isset($_POST['threadid']) ? getparam('threadid') : "";
|
||||
|
||||
if( !preg_match( "/^(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})$/", $address )) {
|
||||
if( !preg_match("/^([a-z0-9-]+\.)+[a-z0-9-]+$/", $address)) {
|
||||
$errors[] = wrong_field("form.field.address");
|
||||
}
|
||||
}
|
||||
|
||||
if( !preg_match( "/^\d+$/", $days )) {
|
||||
$errors[] = wrong_field("form.field.ban_days");
|
||||
}
|
||||
|
||||
if( !$comment ) {
|
||||
$errors[] = no_field("form.field.ban_comment");
|
||||
}
|
||||
|
||||
$link = connect();
|
||||
$existing_ban = ban_for_addr_($address,$link);
|
||||
mysql_close($link);
|
||||
|
||||
if( (!$banId && $existing_ban) ||
|
||||
( $banId && $existing_ban && $banId != $existing_ban['banid']) ) {
|
||||
$errors[] = getlocal2("ban.error.duplicate",array($address,$existing_ban['banid']));
|
||||
}
|
||||
|
||||
if( count($errors) == 0 ) {
|
||||
$link = connect();
|
||||
$utime = time() + $days * 24*60*60;
|
||||
if (!$banId) {
|
||||
$query = sprintf(
|
||||
"insert into chatban (dtmcreated,dtmtill,address,comment) values (CURRENT_TIMESTAMP,%s,'%s','%s')",
|
||||
"FROM_UNIXTIME($utime)",
|
||||
quote_smart($address,$link),
|
||||
quote_smart($comment,$link));
|
||||
perform_query($query,$link);
|
||||
} else {
|
||||
$query = sprintf(
|
||||
"update chatban set dtmtill = %s,address = '%s',comment = '%s' where banid = $banId",
|
||||
"FROM_UNIXTIME($utime)",
|
||||
quote_smart($address,$link),
|
||||
quote_smart($comment,$link));
|
||||
perform_query($query,$link);
|
||||
}
|
||||
mysql_close($link);
|
||||
|
||||
if(!$threadid) {
|
||||
header("Location: $webimroot/operator/blocked.php");
|
||||
exit;
|
||||
} else {
|
||||
$page['saved'] = true;
|
||||
$page['address'] = $address;
|
||||
}
|
||||
} else {
|
||||
$page['banId'] = topage($banId);
|
||||
$page['formaddress'] = topage($address);
|
||||
$page['formdays'] = topage($days);
|
||||
$page['formcomment'] = topage($comment);
|
||||
$page['threadid'] = $threadid;
|
||||
}
|
||||
} else if(isset($_GET['id'])) {
|
||||
$banId = verifyparam( 'id', "/^\d{1,9}$/");
|
||||
$link = connect();
|
||||
$ban = select_one_row("select banid,(unix_timestamp(dtmtill)-unix_timestamp(CURRENT_TIMESTAMP)) as days,address,comment from chatban where banid = $banId", $link);
|
||||
mysql_close($link);
|
||||
|
||||
if( $ban ) {
|
||||
$page['banId'] = topage($ban['banid']);
|
||||
$page['formaddress'] = topage($ban['address']);
|
||||
$page['formdays'] = topage(round($ban['days']/86400));
|
||||
$page['formcomment'] = topage($ban['comment']);
|
||||
} else {
|
||||
$errors[] = "Wrong id";
|
||||
}
|
||||
} else if(isset($_GET['thread'])) {
|
||||
$threadid = verifyparam( 'thread', "/^\d{1,9}$/");
|
||||
$thread = thread_by_id($threadid);
|
||||
if( $thread ) {
|
||||
$page['thread'] = topage($thread['userName']);
|
||||
$page['threadid'] = $threadid;
|
||||
$page['formaddress'] = topage($thread['remote']);
|
||||
$page['formdays'] = 15;
|
||||
}
|
||||
}
|
||||
|
||||
start_html_output();
|
||||
require('../view/ban.php');
|
||||
exit;
|
||||
?>
|
57
src/messenger/webim/operator/blocked.php
Normal file
57
src/messenger/webim/operator/blocked.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
|
||||
require_once('../libs/common.php');
|
||||
require_once('../libs/chat.php');
|
||||
require_once('../libs/operator.php');
|
||||
require_once('../libs/pagination.php');
|
||||
|
||||
$operator = check_login();
|
||||
$page = array();
|
||||
$page['operator'] = topage(get_operator_name($operator));
|
||||
$errors = array();
|
||||
|
||||
$link = connect();
|
||||
|
||||
if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
|
||||
$banId = isset($_GET['id']) ? $_GET['id'] : "";
|
||||
|
||||
if( !preg_match( "/^\d+$/", $banId )) {
|
||||
$errors[] = "Wrong argument";
|
||||
}
|
||||
|
||||
if( count($errors) == 0 ) {
|
||||
perform_query("delete from chatban where banid = $banId",$link);
|
||||
header("Location: $webimroot/operator/blocked.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$result = mysql_query("select banid,unix_timestamp(dtmtill) as till,address,comment from chatban", $link)
|
||||
or die(' Query failed: ' .mysql_error());
|
||||
|
||||
$blockedList = array();
|
||||
while ($ban = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||
$blockedList[] = $ban;
|
||||
}
|
||||
|
||||
mysql_free_result($result);
|
||||
mysql_close($link);
|
||||
|
||||
setup_pagination($blockedList);
|
||||
|
||||
start_html_output();
|
||||
require('../view/blocked_visitors.php');
|
||||
exit;
|
||||
?>
|
@ -16,11 +16,13 @@ require_once('../libs/common.php');
|
||||
require_once('../libs/operator.php');
|
||||
|
||||
$operator = check_login();
|
||||
loadsettings();
|
||||
|
||||
$page = array(
|
||||
'operator' => topage(get_operator_name($operator)),
|
||||
'version' => $version,
|
||||
'localeLinks' => get_locale_links("$webimroot/operator/index.php")
|
||||
'localeLinks' => get_locale_links("$webimroot/operator/index.php"),
|
||||
'showban' => $settings['enableban'] == "1"
|
||||
);
|
||||
|
||||
start_html_output();
|
||||
|
@ -39,12 +39,14 @@ $email = $settings['email'];
|
||||
$title = $settings['title'];
|
||||
$logo = $settings['logo'];
|
||||
$hosturl = $settings['hosturl'];
|
||||
$enableban = $settings['enableban'];
|
||||
|
||||
if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
|
||||
$email = getparam('email');
|
||||
$title = getparam('title');
|
||||
$logo = getparam('logo');
|
||||
$hosturl = getparam('hosturl');
|
||||
$enableban = verifyparam("enableban","/^on$/", "") == "on" ? "1" : "0";
|
||||
|
||||
if($email && !is_valid_email($email)) {
|
||||
$errors[] = getlocal("settings.wrong.email");
|
||||
@ -55,6 +57,7 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
|
||||
$settings['title'] = $title;
|
||||
$settings['logo'] = $logo;
|
||||
$settings['hosturl'] = $hosturl;
|
||||
$settings['enableban'] = $enableban;
|
||||
update_settings();
|
||||
header("Location: $webimroot/operator/index.php");
|
||||
exit;
|
||||
@ -66,6 +69,7 @@ $page['formemail'] = topage($email);
|
||||
$page['formtitle'] = topage($title);
|
||||
$page['formlogo'] = topage($logo);
|
||||
$page['formhosturl'] = topage($hosturl);
|
||||
$page['formenableban'] = $enableban == "1";
|
||||
|
||||
start_html_output();
|
||||
require('../view/settings.php');
|
||||
|
@ -85,6 +85,11 @@ function thread_to_xml($thread,$link) {
|
||||
$result .= " canview=\"true\"";
|
||||
}
|
||||
|
||||
$banForThread = ban_for_addr_($thread['remote'],$link);
|
||||
if($banForThread) {
|
||||
$result .= " ban=\"blocked\"";
|
||||
}
|
||||
|
||||
$result .= " state=\"$state\" typing=\"".$thread['userTyping']."\">";
|
||||
$result .= "<name>".htmlspecialchars(htmlspecialchars(get_user_name($thread['userName'],$thread['remote'], $thread['userid'])))."</name>";
|
||||
$result .= "<addr>".htmlspecialchars(htmlspecialchars($thread['remote']))."</addr>";
|
||||
@ -92,6 +97,10 @@ function thread_to_xml($thread,$link) {
|
||||
$result .= "<time>".$thread['unix_timestamp(dtmcreated)']."000</time>";
|
||||
$result .= "<modified>".$thread['unix_timestamp(dtmmodified)']."000</modified>";
|
||||
|
||||
if($banForThread) {
|
||||
$result .= "<reason>".$banForThread['comment']."</reason>";
|
||||
}
|
||||
|
||||
$userAgent = get_useragent_version($thread['userAgent']);
|
||||
$result .= "<useragent>".$userAgent."</useragent>";
|
||||
if( $thread["shownmessageid"] != 0 ) {
|
||||
|
117
src/messenger/webim/view/ban.php
Normal file
117
src/messenger/webim/view/ban.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="all" href="<?php echo $webimroot ?>/styles.css" />
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="<?php echo $webimroot ?>/images/favicon.ico" type="image/x-icon"/>
|
||||
<title>
|
||||
<?php echo getlocal("app.title") ?> - <?php echo getlocal("page_ban.title") ?>
|
||||
</title>
|
||||
|
||||
<meta http-equiv="keywords" content="<?php echo getlocal("page.main_layout.meta_keyword") ?>">
|
||||
<meta http-equiv="description" content="<?php echo getlocal("page.main_layout.meta_description") ?>">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000" link="#2971C1" vlink="#2971C1" alink="#2971C1">
|
||||
|
||||
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td valign="top" class="text">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="left" valign="top">
|
||||
<h1><?php echo getlocal("page_ban.title") ?></h1>
|
||||
</td><td align="right" class="text" valign="top"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="textform"><?php echo getlocal2("menu.operator",array($page['operator'])) ?></td><td class="textform"><img src='<?php echo $webimroot ?>/images/topdiv.gif' width="25" height="15" border="0" alt="|" /></td><td class="textform"><a href="<?php echo $webimroot ?>/operator/blocked.php" title="<?php echo getlocal("menu.blocked") ?>"><?php echo getlocal("menu.blocked") ?></a></td><td class="textform"><img src='<?php echo $webimroot ?>/images/topdiv.gif' width="25" height="15" border="0" alt="|" /></td><td class="textform"><a href="<?php echo $webimroot ?>/operator/index.php" title="<?php echo getlocal("menu.main") ?>"><?php echo getlocal("menu.main") ?></a></td></tr></table></td></tr></table>
|
||||
|
||||
|
||||
|
||||
<?php if( $page['saved'] ) { ?>
|
||||
<?php echo getlocal2("page_ban.sent",array($page['address'])) ?>
|
||||
|
||||
<script><!--
|
||||
setTimeout( (function() { window.close(); }), 1500 );
|
||||
//--></script>
|
||||
<?php } ?>
|
||||
<?php if( !$page['saved'] ) { ?>
|
||||
|
||||
<?php echo getlocal("page_ban.intro") ?><br/>
|
||||
<br/>
|
||||
|
||||
<?php if( isset($errors) && count($errors) > 0 ) { ?>
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td valign="top"><img src='<?php echo $webimroot ?>/images/icon_err.gif' width="40" height="40" border="0" alt="" /></td>
|
||||
<td width="10"></td>
|
||||
<td class="text">
|
||||
<?php if( isset($errors) && count($errors) > 0 ) {
|
||||
print getlocal("errors.header");
|
||||
foreach( $errors as $e ) {
|
||||
print getlocal("errors.prefix");
|
||||
print $e;
|
||||
print getlocal("errors.suffix");
|
||||
}
|
||||
print getlocal("errors.footer");
|
||||
} ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $page['thread'] ) { ?>
|
||||
<?php echo getlocal2("page_ban.thread",array(htmlspecialchars($page['thread']))) ?><br/>
|
||||
<br/>
|
||||
<?php } ?>
|
||||
|
||||
<form name="banForm" method="post" action="<?php echo $webimroot ?>/operator/ban.php">
|
||||
<table cellspacing='0' cellpadding='0' border='0'><tr><td background='<?php echo $webimroot ?>/images/loginbg.gif'><table cellspacing='0' cellpadding='0' border='0'><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlt.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrt.gif' width='16' height='16' border='0' alt=''></td></tr><tr><td></td><td align='center'><table border='0' cellspacing='0' cellpadding='0'>
|
||||
<tr><td class='formauth'><?php echo getlocal('form.field.address') ?><b><font class='red'>*</font></b></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
|
||||
<input type="text" name="address" size="40" value="<?php echo form_value('address') ?>" class="formauth"/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('form.field.address.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr><td class='formauth'><?php echo getlocal('form.field.ban_days') ?><b><font class='red'>*</font></b></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
|
||||
<input type="text" name="days" size="4" value="<?php echo form_value('days') ?>" class="formauth"/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('form.field.ban_days.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr><td class='formauth'><?php echo getlocal('form.field.ban_comment') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
|
||||
<input type="text" name="comment" size="40" value="<?php echo form_value('comment') ?>" class="formauth"/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('form.field.ban_comment.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr><td colspan='3' height='20'></td></tr><tr><td colspan='3' background='<?php echo $webimroot ?>/images/formline.gif'><img src='<?php echo $webimroot ?>/images/formline.gif' width='1' height='2' border='0' alt=''></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="formauth">
|
||||
<input type="hidden" name="banId" value="<?php echo $page['banId'] ?>"/>
|
||||
<?php if( $page['threadid'] ) { ?>
|
||||
<input type="hidden" name="threadid" value="<?php echo $page['threadid'] ?>"/>
|
||||
<?php } ?>
|
||||
<input type="image" name="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' border="0" alt='<?php echo getlocal("button.save") ?>'/></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table></td><td></td></tr><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlb.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrb.gif' width='16' height='16' border='0' alt=''></td></tr></table></td></tr></table>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
147
src/messenger/webim/view/blocked_visitors.php
Normal file
147
src/messenger/webim/view/blocked_visitors.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Web Instant Messenger project.
|
||||
*
|
||||
* Copyright (c) 2005-2008 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Evgeny Gryaznov - initial API and implementation
|
||||
*/
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="all" href="<?php echo $webimroot ?>/styles.css" />
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="<?php echo $webimroot ?>/images/favicon.ico" type="image/x-icon"/>
|
||||
<title>
|
||||
<?php echo getlocal("app.title") ?> - <?php echo getlocal("page_bans.title") ?>
|
||||
</title>
|
||||
|
||||
<meta http-equiv="keywords" content="<?php echo getlocal("page.main_layout.meta_keyword") ?>">
|
||||
<meta http-equiv="description" content="<?php echo getlocal("page.main_layout.meta_description") ?>">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000" link="#2971C1" vlink="#2971C1" alink="#2971C1">
|
||||
|
||||
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td valign="top" class="text">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="left" valign="top">
|
||||
<h1><?php echo getlocal("page_bans.title") ?></h1>
|
||||
</td><td align="right" class="text" valign="top"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="textform"><?php echo getlocal2("menu.operator",array($page['operator'])) ?></td><td class="textform"><img src='<?php echo $webimroot ?>/images/topdiv.gif' width="25" height="15" border="0" alt="|" /></td><td class="textform"><a href="<?php echo $webimroot ?>/operator/index.php" title="<?php echo getlocal("menu.main") ?>"><?php echo getlocal("menu.main") ?></a></td></tr></table></td></tr></table>
|
||||
|
||||
|
||||
<?php echo getlocal("page_ban.intro") ?>
|
||||
<br/>
|
||||
<br/>
|
||||
<?php if( isset($errors) && count($errors) > 0 ) { ?>
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td valign="top"><img src='<?php echo $webimroot ?>/images/icon_err.gif' width="40" height="40" border="0" alt="" /></td>
|
||||
<td width="10"></td>
|
||||
<td class="text">
|
||||
<?php if( isset($errors) && count($errors) > 0 ) {
|
||||
print getlocal("errors.header");
|
||||
foreach( $errors as $e ) {
|
||||
print getlocal("errors.prefix");
|
||||
print $e;
|
||||
print getlocal("errors.suffix");
|
||||
}
|
||||
print getlocal("errors.footer");
|
||||
} ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td class="text"><b><?php echo getlocal("page_bans.list") ?></b></td>
|
||||
<td align="right">
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td><img src="<?php echo $webimroot ?>/images/buttons/createban.gif"
|
||||
border="0" alt="<?php echo getlocal("page_bans.add") ?>"></td>
|
||||
<td width="10"></td>
|
||||
<td class="text"><a href="<?php echo $webimroot ?>/operator/ban.php" title="<?php echo getlocal("page_bans.add") ?>">
|
||||
<?php echo getlocal("page_bans.add") ?>
|
||||
</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" height="15"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<?php if( $page['pagination'] && $page['pagination.items'] ) { ?>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td class='table' bgcolor='#276db8' height='30'><span class='header'>
|
||||
<?php echo getlocal("form.field.address") ?>
|
||||
</span></td><td width='3'></td>
|
||||
<td class='table' bgcolor='#276db8' height='30'><span class='header'>
|
||||
<?php echo getlocal("page_bans.to") ?>
|
||||
</span></td><td width='3'></td>
|
||||
<td class='table' bgcolor='#276db8' height='30'><span class='header'>
|
||||
<?php echo getlocal("form.field.ban_comment") ?>
|
||||
</span></td><td width='3'></td>
|
||||
<td class='table' bgcolor='#276db8' height='30'><span class='header'>
|
||||
</span></td>
|
||||
</tr>
|
||||
<?php foreach( $page['pagination.items'] as $b ) { ?>
|
||||
<tr>
|
||||
<td height='45' class='table'>
|
||||
<a href="ban.php?id=<?php echo $b['banid'] ?>">
|
||||
<?php echo htmlspecialchars($b['address']) ?>
|
||||
</a>
|
||||
</td><td background='<?php echo $webimroot ?>/images/tablediv3.gif'><img width='3' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td>
|
||||
<td height='45' class='table'>
|
||||
<?php echo strftime("%B, %d %Y %H:%M:%S", $b['till']) ?>
|
||||
</td><td background='<?php echo $webimroot ?>/images/tablediv3.gif'><img width='3' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td>
|
||||
<td height='45' class='table'>
|
||||
<?php if( strlen(topage($b['comment'])) > 30 ) { ?>
|
||||
<?php echo htmlspecialchars(substr(topage($b['comment']),0,30)) ?>...
|
||||
<?php } ?>
|
||||
<?php if( strlen(topage($b['comment'])) <= 30 ) { ?>
|
||||
<?php echo htmlspecialchars(topage($b['comment'])) ?>
|
||||
<?php } ?>
|
||||
</td><td background='<?php echo $webimroot ?>/images/tablediv3.gif'><img width='3' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td>
|
||||
<td height='45' class='table'>
|
||||
<a href="<?php echo $webimroot ?>/operator/blocked.php?act=del&id=<?php echo $b['banid'] ?>">
|
||||
<input type="image" name="" src='<?php echo $webimroot.getlocal("image.button.delete") ?>' border="0" alt='<?php echo getlocal("button.delete") ?>'/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td height='2' colspan='9'></td></tr><tr><td bgcolor='#e1e1e1' colspan='9'><img width='1' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td></tr><tr><td height='2' colspan='9'></td></tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<br />
|
||||
<?php echo generate_pagination($page['pagination']) ?>
|
||||
<?php } ?>
|
||||
<?php if( $page['pagination'] && !$page['pagination.items'] ) { ?>
|
||||
<table cellspacing='0' cellpadding='0' border='0'><tr><td background='<?php echo $webimroot ?>/images/loginbg.gif'><table cellspacing='0' cellpadding='0' border='0'><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlt.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrt.gif' width='16' height='16' border='0' alt=''></td></tr><tr><td></td><td align='center'><table border='0' cellspacing='0' cellpadding='0'>
|
||||
<span class="table"> <?php echo getlocal("tag.pagination.no_items.elements") ?> </span>
|
||||
</table></td><td></td></tr><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlb.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrb.gif' width='16' height='16' border='0' alt=''></td></tr></table></td></tr></table>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -53,7 +53,9 @@
|
||||
<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/getcode.php'><?php echo getlocal('leftMenu.client_gen_button') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('admin.content.client_gen_button') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
|
||||
|
||||
<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/history.php'><?php echo getlocal('page_analysis.search.title') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('content.history') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
|
||||
|
||||
<?php if( $page['showban'] ) { ?>
|
||||
<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/blocked.php'><?php echo getlocal('menu.blocked') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('content.blocked') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
|
||||
<?php } ?>
|
||||
<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/settings.php'><?php echo getlocal('leftMenu.client_settings') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('admin.content.client_settings') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
|
||||
|
||||
<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/logout.php'><?php echo getlocal('topMenu.logoff') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('content.logoff') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
|
||||
|
@ -82,6 +82,10 @@
|
||||
<input type="text" name="hosturl" size="40" value="<?php echo form_value('hosturl') ?>" class="formauth"/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('settings.host.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr><td class='formauth'><?php echo getlocal('settings.enableban') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
|
||||
<input type="checkbox" name="enableban" value="on"<?php echo form_value_cb('enableban') ? " checked=\"checked\"" : "" ?>/>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('settings.enableban.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
|
||||
<tr><td colspan='3' height='20'></td></tr><tr><td colspan='3' background='<?php echo $webimroot ?>/images/formline.gif'><img src='<?php echo $webimroot ?>/images/formline.gif' width='1' height='2' border='0' alt=''></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
<tr>
|
||||
<td class="formauth" colspan="3">
|
||||
|
Loading…
Reference in New Issue
Block a user