minor: spaces and tabs, use select_multi_assoc

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@114 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-09-29 22:46:27 +00:00
parent eb1692f556
commit 883df2bd0b
9 changed files with 20 additions and 28 deletions

View File

@ -22,7 +22,8 @@ $threadid = verifyparam( "thread", "/^\d{1,8}$/");
if( !isset($_GET['token']) ) {
if( get_remote_level($_SERVER['HTTP_USER_AGENT']) != "ajaxed" ) {
$remote_level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
if( $remote_level != "ajaxed" ) {
die("old browser is used, please update it");
}
@ -31,11 +32,11 @@ if( !isset($_GET['token']) ) {
die("wrong thread");
}
take_thread($thread,$operator);
take_thread($thread,$operator);
$token = $thread['ltoken'];
header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token");
exit;
$token = $thread['ltoken'];
header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token&level=$remote_level");
exit;
}
$token = verifyparam( "token", "/^\d{1,8}$/");
@ -49,7 +50,6 @@ setup_chatview_for_operator($thread, $operator);
start_html_output();
require('../view/chat_ajaxed.php');
?>

View File

@ -26,7 +26,7 @@ if($query !== false) {
$link = connect();
$result = mysql_query(
"select DISTINCT unix_timestamp(chatthread.dtmcreated) as created, ".
"select DISTINCT unix_timestamp(chatthread.dtmcreated) as created, ".
"unix_timestamp(chatthread.dtmmodified) as modified, chatthread.threadid, ".
"chatthread.remote, chatthread.agentName, chatthread.userName, ".
"messageCount as size ".
@ -34,7 +34,7 @@ if($query !== false) {
"where chatmessage.threadid = chatthread.threadid and ".
"((chatthread.userName LIKE '%%$query%%') or ".
" (chatmessage.tmessage LIKE '%%$query%%'))".
"order by created DESC", $link)
"order by created DESC", $link)
or die(' Query failed: ' .mysql_error().": ".$query);
$foundThreads = array();

View File

@ -17,7 +17,7 @@ require_once('../libs/operator.php');
$operator = check_login();
$page = array(
$page = array(
'operator' => topage(get_operator_name($operator)),
'version' => $version,
'localeLinks' => get_locale_links("$webimroot/operator/index.php")

View File

@ -1,4 +1,4 @@
<?php
<?php
/*
* This file is part of Web Instant Messenger project.
*
@ -24,10 +24,10 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
$operator = operator_by_login( $login );
if( $operator && isset($operator['vcpassword']) && $operator['vcpassword'] == md5($password) ) {
$target = isset($_SESSION['backpath'])
? $_SESSION['backpath']
$target = isset($_SESSION['backpath'])
? $_SESSION['backpath']
: "$webimroot/operator/index.php";
login_operator($operator,$remember);
header("Location: $target");
exit;

View File

@ -1,4 +1,4 @@
<?php
<?php
/*
* This file is part of Web Instant Messenger project.
*

View File

@ -20,7 +20,6 @@ $operator = check_login();
$page = array('agentId' => '');
$errors = array();
if( isset($_POST['login']) && isset($_POST['password']) ) {
$agentId = verifyparam( "agentId", "/^(\d{1,9})?$/", "");
$login = getparam('login');
@ -29,7 +28,6 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
$localname = getparam('name');
$commonname = getparam('commonname');
if( !$localname )
$errors[] = no_field("form.field.agent_name");
@ -49,15 +47,15 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
$errors[] = getlocal("my_settings.error.password_match");
$existing_operator = operator_by_login($login);
if( (!$agentId && $existing_operator) ||
if( (!$agentId && $existing_operator) ||
( $agentId && $existing_operator && $agentId != $existing_operator['operatorid']) )
$errors[] = getlocal("page_agent.error.duplicate_login");
if( count($errors) == 0 ) {
if (!$agentId) {
create_operator($login,$password,$localname,$commonname);
create_operator($login,$password,$localname,$commonname);
} else {
update_operator($agentId,$login,$password,$localname,$commonname);
update_operator($agentId,$login,$password,$localname,$commonname);
}
header("Location: $webimroot/operator/operators.php");
exit;

View File

@ -20,7 +20,6 @@ $operator = check_login();
$page = array( 'operator' => topage(get_operator_name($operator)) );
if( isset($_GET['threadid'])) {
$threadid = verifyparam( "threadid", "/^(\d{1,9})?$/", "");
$lastid = -1;

View File

@ -57,7 +57,7 @@ function thread_to_xml($thread) {
$result .= "<agent>".htmlspecialchars(htmlspecialchars($threadoperator))."</agent>";
$result .= "<time>".$thread['unix_timestamp(dtmcreated)']."000</time>";
$result .= "<modified>".$thread['unix_timestamp(dtmmodified)']."000</modified>";
$result .= "</thread>";
return $result;
}
@ -71,16 +71,14 @@ function print_pending_threads($since) {
$query = "select threadid, userName, agentName, unix_timestamp(dtmcreated), userTyping, ".
"unix_timestamp(dtmmodified), lrevision, istate, remote ".
"from chatthread where lrevision > $since ORDER BY threadid";
$result = mysql_query($query,$link) or die(' Query failed: ' .mysql_error().": ".$query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$rows = select_multi_assoc($query, $link);
foreach ($rows as $row) {
$thread = thread_to_xml($row);
$output[] = $thread;
if( $row['lrevision'] > $revision )
$revision = $row['lrevision'];
}
mysql_free_result($result);
mysql_close($link);
start_xml_output();
@ -91,8 +89,6 @@ function print_pending_threads($since) {
echo "</threads>";
}
////////
$since = verifyparam( "since", "/^\d{1,9}$/", 0);
print_pending_threads($since);

View File

@ -15,7 +15,6 @@
require_once('../libs/common.php');
require_once('../libs/operator.php');
$operator = check_login();
notify_operator_alive($operator['operatorid']);