Fix bug in chat button image's generation script

This commit is contained in:
Dmitriy Simushev 2012-09-17 13:16:41 +00:00
parent 03ffd84e76
commit f720da79d0

View File

@ -267,10 +267,12 @@ function has_online_operators($groupid = "")
$db = Database::getInstance(); $db = Database::getInstance();
$query = "select count(*) as total, min(:now - dtmlastvisited) as time from {chatoperator}"; $query = "select count(*) as total, min(:now - dtmlastvisited) as time from {chatoperator}";
$values = array(':now' => time());
if ($groupid) { if ($groupid) {
$query .= ", {chatgroupoperator}, {chatgroup} where {chatgroup}.groupid = {chatgroupoperator}.groupid and " . $query .= ", {chatgroupoperator}, {chatgroup} where {chatgroup}.groupid = {chatgroupoperator}.groupid and " .
"({chatgroup}.groupid = :groupid or {chatgroup}.parent = :groupid) and {chatoperator}.operatorid = " . "({chatgroup}.groupid = :groupid or {chatgroup}.parent = :groupid) and {chatoperator}.operatorid = " .
"{chatgroupoperator}.operatorid and istatus = 0"; "{chatgroupoperator}.operatorid and istatus = 0";
$values[':groupid'] = $groupid;
} else { } else {
if (Settings::get('enablegroups') == 1) { if (Settings::get('enablegroups') == 1) {
$query .= ", {chatgroupoperator} where {chatoperator}.operatorid = " . $query .= ", {chatgroupoperator} where {chatoperator}.operatorid = " .
@ -282,10 +284,7 @@ function has_online_operators($groupid = "")
$row = $db->query( $row = $db->query(
$query, $query,
array( $values,
':groupid'=>$groupid,
':now' => time()
),
array('return_rows' => Database::RETURN_ONE_ROW) array('return_rows' => Database::RETURN_ONE_ROW)
); );
return $row['time'] < Settings::get('online_timeout') && $row['total'] > 0; return $row['time'] < Settings::get('online_timeout') && $row['total'] > 0;