Fixed a problem with multiple installations on the same domain.

When a user logged in on one chat, they also got logged in to all the other chats.
This commit is contained in:
novagen 2010-10-29 11:44:17 +02:00
parent e304901bd0
commit 7cc810c683
3 changed files with 579 additions and 578 deletions

19
src/messenger/webim/libs/operator.php Normal file → Executable file
View File

@ -195,13 +195,13 @@ function append_query($link,$pv) {
}
function check_login($redirect=true) {
global $webimroot;
if( !isset( $_SESSION['operator'] ) ) {
global $webimroot, $mysqlprefix;
if( !isset( $_SESSION[$mysqlprefix . 'operator'] ) ) {
if( isset($_COOKIE['webim_lite']) ) {
list($login,$pwd) = preg_split("/,/", $_COOKIE['webim_lite'], 2);
$op = operator_by_login($login);
if( $op && isset($pwd) && isset($op['vcpassword']) && md5($op['vcpassword']) == $pwd ) {
$_SESSION['operator'] = $op;
$_SESSION[$mysqlprefix . 'operator'] = $op;
return $op;
}
}
@ -217,16 +217,17 @@ function check_login($redirect=true) {
return null;
}
}
return $_SESSION['operator'];
return $_SESSION[$mysqlprefix . 'operator'];
}
function get_logged_in() {
return isset( $_SESSION['operator'] ) ? $_SESSION['operator'] : FALSE;
global $mysqlprefix;
return isset( $_SESSION[$mysqlprefix . 'operator'] ) ? $_SESSION[$mysqlprefix . 'operator'] : FALSE;
}
function login_operator($operator,$remember) {
global $webimroot;
$_SESSION['operator'] = $operator;
global $webimroot, $mysqlprefix;
$_SESSION[$mysqlprefix . 'operator'] = $operator;
if( $remember ) {
$value = $operator['vclogin'].",".md5($operator['vcpassword']);
setcookie('webim_lite', $value, time()+60*60*24*1000, "$webimroot/");
@ -237,8 +238,8 @@ function login_operator($operator,$remember) {
}
function logout_operator() {
global $webimroot;
unset($_SESSION['operator']);
global $webimroot, $mysqlprefix;
unset($_SESSION[$mysqlprefix . 'operator']);
unset($_SESSION['backpath']);
if( isset($_COOKIE['webim_lite']) ) {
setcookie('webim_lite', '', time() - 3600, "$webimroot/");

4
src/messenger/webim/operator/avatar.php Normal file → Executable file
View File

@ -77,8 +77,8 @@ if( !$op ) {
if(count($errors) == 0) {
update_operator_avatar($op['operatorid'],$avatar);
if ($opId && $avatar && $_SESSION['operator'] && $operator['operatorid'] == $opId) {
$_SESSION['operator']['vcavatar'] = $avatar;
if ($opId && $avatar && $_SESSION[$mysqlprefix . 'operator'] && $operator['operatorid'] == $opId) {
$_SESSION[$mysqlprefix . 'operator']['vcavatar'] = $avatar;
}
header("Location: $webimroot/operator/avatar.php?op=$opId");
exit;

4
src/messenger/webim/operator/permissions.php Normal file → Executable file
View File

@ -62,8 +62,8 @@ if( !$op ) {
if(count($errors) == 0) {
update_operator_permissions($op['operatorid'],$new_permissions);
if ($opId && $_SESSION['operator'] && $operator['operatorid'] == $opId) {
$_SESSION['operator']['iperm'] = $new_permissions;
if ($opId && $_SESSION[$mysqlprefix . 'operator'] && $operator['operatorid'] == $opId) {
$_SESSION[$mysqlprefix . $mysqlprefix . 'operator']['iperm'] = $new_permissions;
}
header("Location: $webimroot/operator/permissions.php?op=$opId&stored");
exit;