2009-03-23 00:22:51 +03:00
|
|
|
<?php
|
|
|
|
/*
|
2009-06-04 02:44:32 +04:00
|
|
|
* This file is part of Mibew Messenger project.
|
2009-03-23 00:22:51 +03:00
|
|
|
*
|
2009-06-04 02:44:32 +04:00
|
|
|
* Copyright (c) 2005-2009 Mibew Messenger Community
|
2009-03-23 00:22:51 +03:00
|
|
|
* 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
|
|
|
|
*
|
2009-08-04 17:38:37 +04:00
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* the GNU General Public License Version 2 or later (the "GPL"), in which case
|
|
|
|
* the provisions of the GPL are applicable instead of those above. If you wish
|
|
|
|
* to allow use of your version of this file only under the terms of the GPL, and
|
|
|
|
* not to allow others to use your version of this file under the terms of the
|
|
|
|
* EPL, indicate your decision by deleting the provisions above and replace them
|
|
|
|
* with the notice and other provisions required by the GPL.
|
|
|
|
*
|
2009-03-23 00:22:51 +03:00
|
|
|
* Contributors:
|
|
|
|
* Evgeny Gryaznov - initial API and implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once('../libs/common.php');
|
|
|
|
require_once('../libs/operator.php');
|
|
|
|
require_once('../libs/operator_settings.php');
|
|
|
|
|
|
|
|
$operator = check_login();
|
|
|
|
|
|
|
|
function update_operator_groups($operatorid,$newvalue) {
|
|
|
|
$link = connect();
|
|
|
|
perform_query("delete from chatgroupoperator where operatorid = $operatorid", $link);
|
|
|
|
foreach($newvalue as $groupid) {
|
|
|
|
perform_query("insert into chatgroupoperator (groupid, operatorid) values ($groupid,$operatorid)", $link);
|
|
|
|
}
|
|
|
|
mysql_close($link);
|
|
|
|
}
|
|
|
|
|
2009-07-19 04:07:34 +04:00
|
|
|
|
2009-03-23 00:22:51 +03:00
|
|
|
$opId = verifyparam( "op","/^\d{1,9}$/");
|
2009-04-10 18:12:57 +04:00
|
|
|
$page = array('opid' => $opId);
|
2009-07-19 04:07:34 +04:00
|
|
|
$link = connect();
|
2009-07-24 11:37:58 +04:00
|
|
|
$page['groups'] = get_all_groups($link);
|
2009-07-19 04:07:34 +04:00
|
|
|
mysql_close($link);
|
2009-03-23 00:22:51 +03:00
|
|
|
$errors = array();
|
|
|
|
|
2009-05-31 20:13:22 +04:00
|
|
|
$canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator))
|
|
|
|
|| is_capable($can_administrate, $operator);
|
|
|
|
|
2009-03-23 00:22:51 +03:00
|
|
|
$op = operator_by_id($opId);
|
|
|
|
|
|
|
|
if( !$op ) {
|
|
|
|
$errors[] = getlocal("no_such_operator");
|
|
|
|
|
|
|
|
} else if( isset($_POST['op']) ) {
|
|
|
|
|
2009-05-31 20:13:22 +04:00
|
|
|
if(!$canmodify) {
|
2009-04-10 18:12:57 +04:00
|
|
|
$errors[] = getlocal('page_agent.cannot_modify');
|
2009-03-23 00:22:51 +03:00
|
|
|
}
|
2009-05-31 20:13:22 +04:00
|
|
|
|
2009-04-10 18:12:57 +04:00
|
|
|
if(count($errors) == 0) {
|
|
|
|
$new_groups = array();
|
|
|
|
foreach($page['groups'] as $group) {
|
|
|
|
if( verifyparam("group".$group['groupid'],"/^on$/", "") == "on") {
|
|
|
|
$new_groups[] = $group['groupid'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
update_operator_groups($op['operatorid'],$new_groups);
|
|
|
|
header("Location: $webimroot/operator/opgroups.php?op=$opId&stored");
|
|
|
|
exit;
|
|
|
|
}
|
2009-03-23 00:22:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
$page['formgroup'] = array();
|
2009-04-10 18:12:57 +04:00
|
|
|
$page['currentop'] = $op ? topage(get_operator_name($op))." (".$op['vclogin'].")" : "-not found-";
|
2009-05-31 20:13:22 +04:00
|
|
|
$page['canmodify'] = $canmodify ? "1" : "";
|
2009-03-23 00:22:51 +03:00
|
|
|
|
2009-04-10 18:12:57 +04:00
|
|
|
if($op) {
|
2009-03-23 00:22:51 +03:00
|
|
|
foreach(get_operator_groupids($opId) as $rel) {
|
|
|
|
$page['formgroup'][] = $rel['groupid'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-25 02:34:57 +03:00
|
|
|
$page['stored'] = isset($_GET['stored']);
|
2009-03-23 00:22:51 +03:00
|
|
|
prepare_menu($operator);
|
|
|
|
setup_operator_settings_tabs($opId,2);
|
|
|
|
start_html_output();
|
|
|
|
require('../view/operator_groups.php');
|
|
|
|
?>
|