mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-22 21:40:28 +03:00
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:
parent
eb1692f556
commit
883df2bd0b
@ -22,7 +22,8 @@ $threadid = verifyparam( "thread", "/^\d{1,8}$/");
|
|||||||
|
|
||||||
if( !isset($_GET['token']) ) {
|
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");
|
die("old browser is used, please update it");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,11 +32,11 @@ if( !isset($_GET['token']) ) {
|
|||||||
die("wrong thread");
|
die("wrong thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
take_thread($thread,$operator);
|
take_thread($thread,$operator);
|
||||||
|
|
||||||
$token = $thread['ltoken'];
|
$token = $thread['ltoken'];
|
||||||
header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token");
|
header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token&level=$remote_level");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$token = verifyparam( "token", "/^\d{1,8}$/");
|
$token = verifyparam( "token", "/^\d{1,8}$/");
|
||||||
@ -49,7 +50,6 @@ setup_chatview_for_operator($thread, $operator);
|
|||||||
|
|
||||||
start_html_output();
|
start_html_output();
|
||||||
|
|
||||||
|
|
||||||
require('../view/chat_ajaxed.php');
|
require('../view/chat_ajaxed.php');
|
||||||
|
|
||||||
?>
|
?>
|
@ -26,7 +26,7 @@ if($query !== false) {
|
|||||||
$link = connect();
|
$link = connect();
|
||||||
|
|
||||||
$result = mysql_query(
|
$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, ".
|
"unix_timestamp(chatthread.dtmmodified) as modified, chatthread.threadid, ".
|
||||||
"chatthread.remote, chatthread.agentName, chatthread.userName, ".
|
"chatthread.remote, chatthread.agentName, chatthread.userName, ".
|
||||||
"messageCount as size ".
|
"messageCount as size ".
|
||||||
@ -34,7 +34,7 @@ if($query !== false) {
|
|||||||
"where chatmessage.threadid = chatthread.threadid and ".
|
"where chatmessage.threadid = chatthread.threadid and ".
|
||||||
"((chatthread.userName LIKE '%%$query%%') or ".
|
"((chatthread.userName LIKE '%%$query%%') or ".
|
||||||
" (chatmessage.tmessage LIKE '%%$query%%'))".
|
" (chatmessage.tmessage LIKE '%%$query%%'))".
|
||||||
"order by created DESC", $link)
|
"order by created DESC", $link)
|
||||||
or die(' Query failed: ' .mysql_error().": ".$query);
|
or die(' Query failed: ' .mysql_error().": ".$query);
|
||||||
|
|
||||||
$foundThreads = array();
|
$foundThreads = array();
|
||||||
|
@ -17,7 +17,7 @@ require_once('../libs/operator.php');
|
|||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
|
|
||||||
$page = array(
|
$page = array(
|
||||||
'operator' => topage(get_operator_name($operator)),
|
'operator' => topage(get_operator_name($operator)),
|
||||||
'version' => $version,
|
'version' => $version,
|
||||||
'localeLinks' => get_locale_links("$webimroot/operator/index.php")
|
'localeLinks' => get_locale_links("$webimroot/operator/index.php")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* This file is part of Web Instant Messenger project.
|
* 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 );
|
$operator = operator_by_login( $login );
|
||||||
if( $operator && isset($operator['vcpassword']) && $operator['vcpassword'] == md5($password) ) {
|
if( $operator && isset($operator['vcpassword']) && $operator['vcpassword'] == md5($password) ) {
|
||||||
|
|
||||||
$target = isset($_SESSION['backpath'])
|
$target = isset($_SESSION['backpath'])
|
||||||
? $_SESSION['backpath']
|
? $_SESSION['backpath']
|
||||||
: "$webimroot/operator/index.php";
|
: "$webimroot/operator/index.php";
|
||||||
|
|
||||||
login_operator($operator,$remember);
|
login_operator($operator,$remember);
|
||||||
header("Location: $target");
|
header("Location: $target");
|
||||||
exit;
|
exit;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* This file is part of Web Instant Messenger project.
|
* This file is part of Web Instant Messenger project.
|
||||||
*
|
*
|
||||||
|
@ -20,7 +20,6 @@ $operator = check_login();
|
|||||||
$page = array('agentId' => '');
|
$page = array('agentId' => '');
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
|
|
||||||
if( isset($_POST['login']) && isset($_POST['password']) ) {
|
if( isset($_POST['login']) && isset($_POST['password']) ) {
|
||||||
$agentId = verifyparam( "agentId", "/^(\d{1,9})?$/", "");
|
$agentId = verifyparam( "agentId", "/^(\d{1,9})?$/", "");
|
||||||
$login = getparam('login');
|
$login = getparam('login');
|
||||||
@ -29,7 +28,6 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
|
|||||||
$localname = getparam('name');
|
$localname = getparam('name');
|
||||||
$commonname = getparam('commonname');
|
$commonname = getparam('commonname');
|
||||||
|
|
||||||
|
|
||||||
if( !$localname )
|
if( !$localname )
|
||||||
$errors[] = no_field("form.field.agent_name");
|
$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");
|
$errors[] = getlocal("my_settings.error.password_match");
|
||||||
|
|
||||||
$existing_operator = operator_by_login($login);
|
$existing_operator = operator_by_login($login);
|
||||||
if( (!$agentId && $existing_operator) ||
|
if( (!$agentId && $existing_operator) ||
|
||||||
( $agentId && $existing_operator && $agentId != $existing_operator['operatorid']) )
|
( $agentId && $existing_operator && $agentId != $existing_operator['operatorid']) )
|
||||||
$errors[] = getlocal("page_agent.error.duplicate_login");
|
$errors[] = getlocal("page_agent.error.duplicate_login");
|
||||||
|
|
||||||
if( count($errors) == 0 ) {
|
if( count($errors) == 0 ) {
|
||||||
if (!$agentId) {
|
if (!$agentId) {
|
||||||
create_operator($login,$password,$localname,$commonname);
|
create_operator($login,$password,$localname,$commonname);
|
||||||
} else {
|
} else {
|
||||||
update_operator($agentId,$login,$password,$localname,$commonname);
|
update_operator($agentId,$login,$password,$localname,$commonname);
|
||||||
}
|
}
|
||||||
header("Location: $webimroot/operator/operators.php");
|
header("Location: $webimroot/operator/operators.php");
|
||||||
exit;
|
exit;
|
||||||
|
@ -20,7 +20,6 @@ $operator = check_login();
|
|||||||
|
|
||||||
$page = array( 'operator' => topage(get_operator_name($operator)) );
|
$page = array( 'operator' => topage(get_operator_name($operator)) );
|
||||||
|
|
||||||
|
|
||||||
if( isset($_GET['threadid'])) {
|
if( isset($_GET['threadid'])) {
|
||||||
$threadid = verifyparam( "threadid", "/^(\d{1,9})?$/", "");
|
$threadid = verifyparam( "threadid", "/^(\d{1,9})?$/", "");
|
||||||
$lastid = -1;
|
$lastid = -1;
|
||||||
|
@ -57,7 +57,7 @@ function thread_to_xml($thread) {
|
|||||||
$result .= "<agent>".htmlspecialchars(htmlspecialchars($threadoperator))."</agent>";
|
$result .= "<agent>".htmlspecialchars(htmlspecialchars($threadoperator))."</agent>";
|
||||||
$result .= "<time>".$thread['unix_timestamp(dtmcreated)']."000</time>";
|
$result .= "<time>".$thread['unix_timestamp(dtmcreated)']."000</time>";
|
||||||
$result .= "<modified>".$thread['unix_timestamp(dtmmodified)']."000</modified>";
|
$result .= "<modified>".$thread['unix_timestamp(dtmmodified)']."000</modified>";
|
||||||
|
|
||||||
$result .= "</thread>";
|
$result .= "</thread>";
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -71,16 +71,14 @@ function print_pending_threads($since) {
|
|||||||
$query = "select threadid, userName, agentName, unix_timestamp(dtmcreated), userTyping, ".
|
$query = "select threadid, userName, agentName, unix_timestamp(dtmcreated), userTyping, ".
|
||||||
"unix_timestamp(dtmmodified), lrevision, istate, remote ".
|
"unix_timestamp(dtmmodified), lrevision, istate, remote ".
|
||||||
"from chatthread where lrevision > $since ORDER BY threadid";
|
"from chatthread where lrevision > $since ORDER BY threadid";
|
||||||
$result = mysql_query($query,$link) or die(' Query failed: ' .mysql_error().": ".$query);
|
$rows = select_multi_assoc($query, $link);
|
||||||
|
foreach ($rows as $row) {
|
||||||
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
|
||||||
$thread = thread_to_xml($row);
|
$thread = thread_to_xml($row);
|
||||||
$output[] = $thread;
|
$output[] = $thread;
|
||||||
if( $row['lrevision'] > $revision )
|
if( $row['lrevision'] > $revision )
|
||||||
$revision = $row['lrevision'];
|
$revision = $row['lrevision'];
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_free_result($result);
|
|
||||||
mysql_close($link);
|
mysql_close($link);
|
||||||
|
|
||||||
start_xml_output();
|
start_xml_output();
|
||||||
@ -91,8 +89,6 @@ function print_pending_threads($since) {
|
|||||||
echo "</threads>";
|
echo "</threads>";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////
|
|
||||||
|
|
||||||
$since = verifyparam( "since", "/^\d{1,9}$/", 0);
|
$since = verifyparam( "since", "/^\d{1,9}$/", 0);
|
||||||
|
|
||||||
print_pending_threads($since);
|
print_pending_threads($since);
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
require_once('../libs/common.php');
|
require_once('../libs/common.php');
|
||||||
require_once('../libs/operator.php');
|
require_once('../libs/operator.php');
|
||||||
|
|
||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
|
|
||||||
notify_operator_alive($operator['operatorid']);
|
notify_operator_alive($operator['operatorid']);
|
||||||
|
Loading…
Reference in New Issue
Block a user