autologin (for Java API), rename project

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@514 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2009-05-31 14:36:11 +00:00
parent 4b2c43a5f3
commit bee41dc218
3 changed files with 37 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>messenger-lite-sf</name>
<name>messenger</name>
<comment></comment>
<projects>
</projects>

View File

@ -147,7 +147,7 @@ function generate_button($title,$locale,$style,$group,$inner,$showhost,$forcesec
return "<!-- webim button -->".$temp."<!-- / webim button -->";
}
function check_login() {
function check_login($redirect=true) {
global $webimroot;
if( !isset( $_SESSION['operator'] ) ) {
if( isset($_COOKIE['webim_lite']) ) {
@ -162,9 +162,13 @@ function check_login() {
if($_SERVER['REQUEST_METHOD'] == 'GET' && $_SERVER['QUERY_STRING']) {
$requested .= "?".$_SERVER['QUERY_STRING'];
}
$_SESSION['backpath'] = $requested;
header("Location: $webimroot/operator/login.php");
exit;
if($redirect) {
$_SESSION['backpath'] = $requested;
header("Location: $webimroot/operator/login.php");
exit;
} else {
return null;
}
}
return $_SESSION['operator'];
}

View File

@ -0,0 +1,28 @@
<?php
/*
* This file is part of Web Instant Messenger project.
*
* Copyright (c) 2005-2009 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/operator.php');
$operator = check_login(false);
start_xml_output();
if($operator) {
echo "<login><status>OK</status></login>";
} else {
echo "<login><status>FAILED</status></login>";
}
exit;
?>