mirror of
https://github.com/Mibew/design.git
synced 2024-11-16 01:44:11 +03:00
use operator id in management instead of login
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@159 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
cbce7c1561
commit
95c2e697b3
@ -17,27 +17,27 @@ require_once('../libs/operator.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
$page = array('agentId' => '', 'avatar' => '');
|
||||
$opId = verifyparam( "op","/^\d{1,9}$/");
|
||||
$page = array('op' => $opId, 'avatar' => '');
|
||||
$page['operator'] = topage(get_operator_name($operator));
|
||||
$errors = array();
|
||||
|
||||
if( isset($_POST['agentId']) ) {
|
||||
$avatar = '';
|
||||
$agentId = verifyparam( "agentId", "/^(\d{1,9})?$/", "");
|
||||
$op = operator_by_id($agentId);
|
||||
$login = $op ? $op['vclogin'] : '';
|
||||
$op = operator_by_id($opId);
|
||||
|
||||
if( !$op ) {
|
||||
$errors[] = getlocal("no_such_operator");
|
||||
if( !$op ) {
|
||||
$errors[] = getlocal("no_such_operator");
|
||||
|
||||
} else if( isset($_FILES['avatarFile']) && $_FILES['avatarFile']['name']) {
|
||||
} else if( isset($_POST['op']) ) {
|
||||
$avatar = $op['vcavatar'];
|
||||
|
||||
if( isset($_FILES['avatarFile']) && $_FILES['avatarFile']['name']) {
|
||||
$valid_types = array("gif","jpg", "png", "tif");
|
||||
|
||||
$orig_filename = $_FILES['avatarFile']['name'];
|
||||
$tmp_file_name = $_FILES['avatarFile']['tmp_name'];
|
||||
|
||||
$ext = substr($orig_filename, 1 + strrpos($orig_filename, "."));
|
||||
$new_file_name = "$agentId.$ext";
|
||||
$new_file_name = "$opId.$ext";
|
||||
|
||||
if ($_FILES['avatarFile']['size'] > $max_uploaded_file_size) {
|
||||
$errors[] = failed_uploading_file($orig_filename, "errors.file.size.exceeded");
|
||||
@ -62,40 +62,28 @@ if( isset($_POST['agentId']) ) {
|
||||
if(count($errors) == 0) {
|
||||
update_operator_avatar($op['operatorid'],$avatar);
|
||||
|
||||
if ($agentId && $avatar && $_SESSION['operator'] && $operator['operatorid'] == $agentId) {
|
||||
if ($opId && $avatar && $_SESSION['operator'] && $operator['operatorid'] == $opId) {
|
||||
$_SESSION['operator']['vcavatar'] = $avatar;
|
||||
}
|
||||
header("Location: $webimroot/operator/avatar.php?op=".topage($op['vclogin']));
|
||||
header("Location: $webimroot/operator/avatar.php?op=$opId");
|
||||
exit;
|
||||
} else {
|
||||
$page['avatar'] = topage($op ? $op['vcavatar'] : '');
|
||||
$page['agentId'] = $agentId;
|
||||
$page['formlogin'] = topage($login);
|
||||
$page['avatar'] = topage($op['vcavatar']);
|
||||
}
|
||||
|
||||
} else {
|
||||
$login = verifyparam( 'op', "/^[\w_]+$/");
|
||||
$op = operator_by_login( $login );
|
||||
|
||||
if( !$op ) {
|
||||
$errors[] = getlocal("no_such_operator");
|
||||
$page['formlogin'] = topage($login);
|
||||
} else {
|
||||
if (isset($_GET['delete']) && $_GET['delete'] == "true") {
|
||||
update_operator_avatar($op['operatorid'],'');
|
||||
header("Location: $webimroot/operator/avatar.php?op=".topage($op['vclogin']));
|
||||
exit;
|
||||
}
|
||||
$page['formlogin'] = topage($op['vclogin']);
|
||||
$page['agentId'] = topage($op['operatorid']);
|
||||
$page['avatar'] = topage($op['vcavatar']);
|
||||
if (isset($_GET['delete']) && $_GET['delete'] == "true") {
|
||||
update_operator_avatar($op['operatorid'],'');
|
||||
header("Location: $webimroot/operator/avatar.php?op=$opId");
|
||||
exit;
|
||||
}
|
||||
$page['avatar'] = topage($op['vcavatar']);
|
||||
}
|
||||
|
||||
$page['tabs'] = isset($login) ? array(
|
||||
getlocal("page_agent.tab.main") => "$webimroot/operator/operator.php?op=".topage($login),
|
||||
$page['tabs'] = array(
|
||||
getlocal("page_agent.tab.main") => "$webimroot/operator/operator.php?op=$opId",
|
||||
getlocal("page_agent.tab.avatar") => ""
|
||||
) : array();
|
||||
);
|
||||
|
||||
start_html_output();
|
||||
require('../view/avatar.php');
|
||||
|
@ -17,11 +17,12 @@ require_once('../libs/operator.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
$page = array('agentId' => '');
|
||||
$page = array('opid' => '');
|
||||
$errors = array();
|
||||
$opId = '';
|
||||
|
||||
if( isset($_POST['login']) && isset($_POST['password']) ) {
|
||||
$agentId = verifyparam( "agentId", "/^(\d{1,9})?$/", "");
|
||||
$opId = verifyparam( "opid", "/^(\d{1,9})?$/", "");
|
||||
$login = getparam('login');
|
||||
$password = getparam('password');
|
||||
$passwordConfirm = getparam('passwordConfirm');
|
||||
@ -40,22 +41,22 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
|
||||
$errors[] = getlocal("page_agent.error.wrong_login");
|
||||
}
|
||||
|
||||
if( !$agentId && !$password )
|
||||
if( !$opId && !$password )
|
||||
$errors[] = no_field("form.field.password");
|
||||
|
||||
if( $password != $passwordConfirm )
|
||||
$errors[] = getlocal("my_settings.error.password_match");
|
||||
|
||||
$existing_operator = operator_by_login($login);
|
||||
if( (!$agentId && $existing_operator) ||
|
||||
( $agentId && $existing_operator && $agentId != $existing_operator['operatorid']) )
|
||||
if( (!$opId && $existing_operator) ||
|
||||
( $opId && $existing_operator && $opId != $existing_operator['operatorid']) )
|
||||
$errors[] = getlocal("page_agent.error.duplicate_login");
|
||||
|
||||
if( count($errors) == 0 ) {
|
||||
if (!$agentId) {
|
||||
if (!$opId) {
|
||||
create_operator($login,$password,$localname,$commonname,"");
|
||||
} else {
|
||||
update_operator($agentId,$login,$password,$localname,$commonname);
|
||||
update_operator($opId,$login,$password,$localname,$commonname);
|
||||
}
|
||||
header("Location: $webimroot/operator/operators.php");
|
||||
exit;
|
||||
@ -63,29 +64,29 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
|
||||
$page['formlogin'] = topage($login);
|
||||
$page['formname'] = topage($localname);
|
||||
$page['formcommonname'] = topage($commonname);
|
||||
$page['agentId'] = topage($agentId);
|
||||
$page['opid'] = topage($opId);
|
||||
}
|
||||
|
||||
} else if( isset($_GET['op']) ) {
|
||||
$login = verifyparam( 'op', "/^[\w_]+$/");
|
||||
$op = operator_by_login( $login );
|
||||
$opId = verifyparam( 'op', "/^\d{1,9}$/");
|
||||
$op = operator_by_id($opId);
|
||||
|
||||
if( !$op ) {
|
||||
$errors[] = getlocal("no_such_operator");
|
||||
$page['formlogin'] = topage($login);
|
||||
$page['opid'] = topage($opId);
|
||||
} else {
|
||||
$page['formlogin'] = topage($op['vclogin']);
|
||||
$page['formname'] = topage($op['vclocalename']);
|
||||
$page['formcommonname'] = topage($op['vccommonname']);
|
||||
$page['agentId'] = topage($op['operatorid']);
|
||||
$page['opid'] = topage($op['operatorid']);
|
||||
}
|
||||
}
|
||||
|
||||
$page['operator'] = topage(get_operator_name($operator));
|
||||
|
||||
$page['tabs'] = isset($login) ? array(
|
||||
$page['tabs'] = $opId ? array(
|
||||
getlocal("page_agent.tab.main") => "",
|
||||
getlocal("page_agent.tab.avatar") => "$webimroot/operator/avatar.php?op=".topage($login)
|
||||
getlocal("page_agent.tab.avatar") => "$webimroot/operator/avatar.php?op=$opId"
|
||||
) : array();
|
||||
|
||||
start_html_output();
|
||||
|
@ -40,10 +40,10 @@
|
||||
</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/operators.php" title="<?php echo getlocal("menu.agents") ?>"><?php echo getlocal("menu.agents") ?></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['agentId'] ) { ?>
|
||||
<?php if( $page['opid'] ) { ?>
|
||||
<?php echo getlocal("page_agent.intro") ?>
|
||||
<?php } ?>
|
||||
<?php if( !$page['agentId'] ) { ?>
|
||||
<?php if( !$page['opid'] ) { ?>
|
||||
<?php echo getlocal("page_agent.create_new") ?>
|
||||
<?php } ?>
|
||||
<br />
|
||||
@ -99,7 +99,7 @@
|
||||
<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">
|
||||
<input type="hidden" name="agentId" value="<?php echo $page['agentId'] ?>"/>
|
||||
<input type="hidden" name="opid" value="<?php echo $page['opid'] ?>"/>
|
||||
<input type="image" name="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' border="0" alt='<?php echo getlocal("button.save") ?>'/>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -79,7 +79,7 @@
|
||||
<tr>
|
||||
<td><img src='<?php echo $webimroot ?>/images/tbliclogin.gif' width="10" height="15" border="0" alt="" /></td>
|
||||
<td class="table">
|
||||
<a href='<?php echo $webimroot ?>/operator/operator.php?op=<?php echo $a['vclogin'] ?>'>
|
||||
<a href='<?php echo $webimroot ?>/operator/operator.php?op=<?php echo $a['operatorid'] ?>'>
|
||||
<?php echo htmlspecialchars(topage($a['vclogin'])) ?>
|
||||
</a>
|
||||
</td>
|
||||
|
@ -76,7 +76,7 @@
|
||||
<tr><td class='formauth'><?php echo getlocal('form.field.avatar.current') ?></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>
|
||||
<img src="<?php echo $page['avatar'] ?>"/>
|
||||
<br/>
|
||||
<a class="formauth" href='<?php echo $webimroot ?>/operator/avatar.php?op=<?php echo $page['formlogin'] ?>&delete=true'>
|
||||
<a class="formauth" href='<?php echo $webimroot ?>/operator/avatar.php?op=<?php echo $page['op'] ?>&delete=true'>
|
||||
<?php echo getlocal("page_agent.clear_avatar") ?>
|
||||
</a>
|
||||
</td><td></td><td class='formauth'><span class='formdescr'> — <?php echo getlocal('form.field.avatar.current.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
|
||||
@ -89,7 +89,7 @@
|
||||
<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">
|
||||
<input type="hidden" name="agentId" value="<?php echo $page['agentId'] ?>"/>
|
||||
<input type="hidden" name="op" value="<?php echo $page['op'] ?>"/>
|
||||
<input type="image" name="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' border="0" alt='<?php echo getlocal("button.save") ?>'/>
|
||||
</td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user