Replaced all mysql_close by close_connection, except for the directory /install

This commit is contained in:
Dmitriy Simushev 2011-11-09 14:16:37 +00:00
parent 6698601d19
commit 1cd6926f4f
35 changed files with 89 additions and 89 deletions

View File

@ -32,7 +32,7 @@ if($referer && isset($_SESSION['threadid'])) {
$msg = getstring2_("chat.client.visited.page", array($referer), $thread['locale']); $msg = getstring2_("chat.client.visited.page", array($referer), $thread['locale']);
post_message_($thread['threadid'], $kind_for_agent,$msg,$link); post_message_($thread['threadid'], $kind_for_agent,$msg,$link);
} }
mysql_close($link); close_connection($link);
} }
$image = verifyparam(isset($_GET['image']) ? "image" : "i", "/^\w+$/", "webim"); $image = verifyparam(isset($_GET['image']) ? "image" : "i", "/^\w+$/", "webim");

View File

@ -110,7 +110,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
$link = connect(); $link = connect();
if(!check_connections_from_remote($remoteHost, $link)) { if(!check_connections_from_remote($remoteHost, $link)) {
mysql_close($link); close_connection($link);
die("number of connections from your IP is exceeded, try again later"); die("number of connections from your IP is exceeded, try again later");
} }
$thread = create_thread($groupid,$visitor['name'], $remoteHost, $referrer,$current_locale,$visitor['id'], $userbrowser,$state_loading,$link); $thread = create_thread($groupid,$visitor['name'], $remoteHost, $referrer,$current_locale,$visitor['id'], $userbrowser,$state_loading,$link);
@ -137,7 +137,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
$postedid = post_message_($thread['threadid'],$kind_user,$firstmessage,$link,$visitor['name']); $postedid = post_message_($thread['threadid'],$kind_user,$firstmessage,$link,$visitor['name']);
commit_thread( $thread['threadid'], array('shownmessageid' => $postedid), $link); commit_thread( $thread['threadid'], array('shownmessageid' => $postedid), $link);
} }
mysql_close($link); close_connection($link);
} }
$threadid = $thread['threadid']; $threadid = $thread['threadid'];
$token = $thread['ltoken']; $token = $thread['ltoken'];

View File

@ -51,7 +51,7 @@ if ($settings['enabletracking'] == '1') {
$operator = operator_by_id_($invited, $link); $operator = operator_by_id_($invited, $link);
} }
mysql_close($link); close_connection($link);
} }
start_xml_output(); start_xml_output();

View File

@ -46,7 +46,7 @@ function store_message($name, $email, $info, $message,$groupid,$referrer) {
post_message_($thread['threadid'],$kind_for_agent,getstring2('chat.visitor.info',array($info)),$link); post_message_($thread['threadid'],$kind_for_agent,getstring2('chat.visitor.info',array($info)),$link);
} }
post_message_($thread['threadid'],$kind_user,$message,$link,$name); post_message_($thread['threadid'],$kind_user,$message,$link,$name);
mysql_close($link); close_connection($link);
} }
$groupid = ""; $groupid = "";
@ -118,7 +118,7 @@ if (isset($group) && !empty($group['vcemail'])) {
if($inbox_mail) { if($inbox_mail) {
$link = connect(); $link = connect();
webim_mail($inbox_mail, $email, $subject, $body, $link); webim_mail($inbox_mail, $email, $subject, $body, $link);
mysql_close($link); close_connection($link);
} }
setup_logo(); setup_logo();

View File

@ -83,7 +83,7 @@ function post_message($threadid, $kind, $message, $from = null, $agentid = null)
{ {
$link = connect(); $link = connect();
$id = post_message_($threadid, $kind, $message, $link, $from, null, $agentid); $id = post_message_($threadid, $kind, $message, $link, $from, null, $agentid);
mysql_close($link); close_connection($link);
return $id; return $id;
} }
@ -158,7 +158,7 @@ function get_messages($threadid, $meth, $isuser, &$lastid)
} }
} }
mysql_close($link); close_connection($link);
return $messages; return $messages;
} }
@ -328,7 +328,7 @@ function setup_survey($name, $email, $groupid, $info, $referrer)
if ($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") { if ($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") {
$link = connect(); $link = connect();
$allgroups = get_groups($link, false); $allgroups = get_groups($link, false);
mysql_close($link); close_connection($link);
$val = ""; $val = "";
foreach ($allgroups as $k) { foreach ($allgroups as $k) {
$groupname = $k['vclocalname']; $groupname = $k['vclocalname'];
@ -414,7 +414,7 @@ function load_canned_messages($locale, $groupid)
} }
$result = $result2; $result = $result2;
} }
mysql_close($link); close_connection($link);
return $result; return $result;
} }
@ -452,7 +452,7 @@ function setup_chatview_for_operator($thread, $operator)
$visitor = track_get_visitor_by_threadid($thread['threadid'], $link); $visitor = track_get_visitor_by_threadid($thread['threadid'], $link);
$page['trackedParams'] = array("visitor" => "" . $visitor['visitorid']); $page['trackedParams'] = array("visitor" => "" . $visitor['visitorid']);
$page['trackedParamsLink'] = add_params($webimroot . "/operator/tracked.php", $page['trackedParams']); $page['trackedParamsLink'] = add_params($webimroot . "/operator/tracked.php", $page['trackedParams']);
mysql_close($link); close_connection($link);
} }
$predefinedres = ""; $predefinedres = "";
$canned_messages = load_canned_messages($thread['locale'], $thread['groupid']); $canned_messages = load_canned_messages($thread['locale'], $thread['groupid']);
@ -494,7 +494,7 @@ function ping_thread($thread, $isuser, $istyping)
if ($thread['istate'] == $state_loading && $isuser) { if ($thread['istate'] == $state_loading && $isuser) {
$params['istate'] = $state_queue; $params['istate'] = $state_queue;
commit_thread($thread['threadid'], $params, $link); commit_thread($thread['threadid'], $params, $link);
mysql_close($link); close_connection($link);
return; return;
} }
@ -510,13 +510,13 @@ function ping_thread($thread, $isuser, $istyping)
$params['istate'] = $state_waiting; $params['istate'] = $state_waiting;
$params['nextagent'] = 0; $params['nextagent'] = 0;
commit_thread($thread['threadid'], $params, $link); commit_thread($thread['threadid'], $params, $link);
mysql_close($link); close_connection($link);
return; return;
} }
} }
update_thread_access($thread['threadid'], $params, $link); update_thread_access($thread['threadid'], $params, $link);
mysql_close($link); close_connection($link);
} }
function commit_thread($threadid, $params, $link) function commit_thread($threadid, $params, $link)
@ -542,7 +542,7 @@ function rename_user($thread, $newname)
post_message_($thread['threadid'], $kind_events, post_message_($thread['threadid'], $kind_events,
getstring2_("chat.status.user.changedname", array($thread['userName'], $newname), $thread['locale']), $link); getstring2_("chat.status.user.changedname", array($thread['userName'], $newname), $thread['locale']), $link);
} }
mysql_close($link); close_connection($link);
} }
function close_thread($thread, $isuser) function close_thread($thread, $isuser)
@ -558,7 +558,7 @@ function close_thread($thread, $isuser)
$message = $isuser ? getstring2_("chat.status.user.left", array($thread['userName']), $thread['locale']) $message = $isuser ? getstring2_("chat.status.user.left", array($thread['userName']), $thread['locale'])
: getstring2_("chat.status.operator.left", array($thread['agentName']), $thread['locale']); : getstring2_("chat.status.operator.left", array($thread['agentName']), $thread['locale']);
post_message_($thread['threadid'], $kind_events, $message, $link); post_message_($thread['threadid'], $kind_events, $message, $link);
mysql_close($link); close_connection($link);
} }
function thread_by_id_($id, $link) function thread_by_id_($id, $link)
@ -580,7 +580,7 @@ function thread_by_id($id)
{ {
$link = connect(); $link = connect();
$thread = thread_by_id_($id, $link); $thread = thread_by_id_($id, $link);
mysql_close($link); close_connection($link);
return $thread; return $thread;
} }
@ -615,7 +615,7 @@ function do_take_thread($threadid, $operatorId, $operatorName)
"nextagent" => 0, "nextagent" => 0,
"agentId" => $operatorId, "agentId" => $operatorId,
"agentName" => "'" . mysql_real_escape_string($operatorName, $link) . "'"), $link); "agentName" => "'" . mysql_real_escape_string($operatorName, $link) . "'"), $link);
mysql_close($link); close_connection($link);
} }
function reopen_thread($threadid) function reopen_thread($threadid)
@ -636,7 +636,7 @@ function reopen_thread($threadid)
} }
post_message_($thread['threadid'], $kind_events, getstring_("chat.status.user.reopenedthread", $thread['locale']), $link); post_message_($thread['threadid'], $kind_events, getstring_("chat.status.user.reopenedthread", $thread['locale']), $link);
mysql_close($link); close_connection($link);
return $thread; return $thread;
} }
@ -746,4 +746,4 @@ function get_remote_host()
return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr; return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr;
} }
?> ?>

View File

@ -687,7 +687,7 @@ function loadsettings()
if (!$settingsloaded) { if (!$settingsloaded) {
$link = connect(); $link = connect();
loadsettings_($link); loadsettings_($link);
mysql_close($link); close_connection($link);
} }
} }

View File

@ -84,7 +84,7 @@ function get_groups_list()
if ($settings['enablegroups'] == '1') { if ($settings['enablegroups'] == '1') {
$link = connect(); $link = connect();
$allgroups = get_all_groups($link); $allgroups = get_all_groups($link);
mysql_close($link); close_connection($link);
$result[] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); $result[] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
foreach ($allgroups as $g) { foreach ($allgroups as $g) {
$result[] = $g; $result[] = $g;

View File

@ -25,7 +25,7 @@ function group_by_id($id)
$link = connect(); $link = connect();
$group = select_one_row( $group = select_one_row(
"select * from ${mysqlprefix}chatgroup where groupid = $id", $link); "select * from ${mysqlprefix}chatgroup where groupid = $id", $link);
mysql_close($link); close_connection($link);
return $group; return $group;
} }
@ -66,4 +66,4 @@ function get_operator_groupslist($operatorid, $link)
} }
} }
?> ?>

View File

@ -39,7 +39,7 @@ function operator_by_login($login)
$link = connect(); $link = connect();
$operator = select_one_row( $operator = select_one_row(
"select * from ${mysqlprefix}chatoperator where vclogin = '" . mysql_real_escape_string($login) . "'", $link); "select * from ${mysqlprefix}chatoperator where vclogin = '" . mysql_real_escape_string($login) . "'", $link);
mysql_close($link); close_connection($link);
return $operator; return $operator;
} }
@ -49,7 +49,7 @@ function operator_by_email($mail)
$link = connect(); $link = connect();
$operator = select_one_row( $operator = select_one_row(
"select * from ${mysqlprefix}chatoperator where vcemail = '" . mysql_real_escape_string($mail) . "'", $link); "select * from ${mysqlprefix}chatoperator where vcemail = '" . mysql_real_escape_string($mail) . "'", $link);
mysql_close($link); close_connection($link);
return $operator; return $operator;
} }
@ -64,7 +64,7 @@ function operator_by_id($id)
{ {
$link = connect(); $link = connect();
$operator = operator_by_id_($id, $link); $operator = operator_by_id_($id, $link);
mysql_close($link); close_connection($link);
return $operator; return $operator;
} }
@ -76,7 +76,7 @@ function operator_get_all()
$query = "select operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time " . $query = "select operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time " .
"from ${mysqlprefix}chatoperator order by vclogin"; "from ${mysqlprefix}chatoperator order by vclogin";
$operators = select_multi_assoc($query, $link); $operators = select_multi_assoc($query, $link);
mysql_close($link); close_connection($link);
return $operators; return $operators;
} }
@ -115,7 +115,7 @@ function update_operator($operatorid, $login, $email, $password, $localename, $c
$operatorid); $operatorid);
perform_query($query, $link); perform_query($query, $link);
mysql_close($link); close_connection($link);
// update the session password // update the session password
if (isset($password)) if (isset($password))
{ {
@ -133,7 +133,7 @@ function update_operator_avatar($operatorid, $avatar)
mysql_real_escape_string($avatar), $operatorid); mysql_real_escape_string($avatar), $operatorid);
perform_query($query, $link); perform_query($query, $link);
mysql_close($link); close_connection($link);
} }
function create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link) function create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link)
@ -158,7 +158,7 @@ function create_operator($login, $email, $password, $localename, $commonname, $a
{ {
$link = connect(); $link = connect();
$newop = create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link); $newop = create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link);
mysql_close($link); close_connection($link);
return $newop; return $newop;
} }
@ -167,7 +167,7 @@ function notify_operator_alive($operatorid, $istatus)
global $mysqlprefix; global $mysqlprefix;
$link = connect(); $link = connect();
perform_query("update ${mysqlprefix}chatoperator set istatus = $istatus, dtmlastvisited = CURRENT_TIMESTAMP where operatorid = $operatorid", $link); perform_query("update ${mysqlprefix}chatoperator set istatus = $istatus, dtmlastvisited = CURRENT_TIMESTAMP where operatorid = $operatorid", $link);
mysql_close($link); close_connection($link);
} }
function has_online_operators($groupid = "") function has_online_operators($groupid = "")
@ -183,7 +183,7 @@ function has_online_operators($groupid = "")
$query .= " where istatus = 0"; $query .= " where istatus = 0";
} }
$row = select_one_row($query, $link); $row = select_one_row($query, $link);
mysql_close($link); close_connection($link);
return $row['time'] < $settings['online_timeout'] && $row['total'] > 0; return $row['time'] < $settings['online_timeout'] && $row['total'] > 0;
} }
@ -310,7 +310,7 @@ function setup_redirect_links($threadid, $token)
"${mysqlprefix}chatoperator", array(), "order by vclogin $limit"), $link); "${mysqlprefix}chatoperator", array(), "order by vclogin $limit"), $link);
$groups = array_slice($groups, $p['start'], $p['end'] - $p['start']); $groups = array_slice($groups, $p['start'], $p['end'] - $p['start']);
mysql_close($link); close_connection($link);
$agent_list = ""; $agent_list = "";
$params = array('thread' => $threadid, 'token' => $token); $params = array('thread' => $threadid, 'token' => $token);
@ -418,7 +418,7 @@ function get_operator_groupids($operatorid)
$link = connect(); $link = connect();
$query = "select groupid from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid"; $query = "select groupid from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid";
$result = select_multi_assoc($query, $link); $result = select_multi_assoc($query, $link);
mysql_close($link); close_connection($link);
return $result; return $result;
} }

View File

@ -31,7 +31,7 @@ function update_settings()
perform_query($query, $link); perform_query($query, $link);
} }
mysql_close($link); close_connection($link);
} }
function setup_settings_tabs($active) function setup_settings_tabs($active)
@ -45,4 +45,4 @@ function setup_settings_tabs($active)
); );
} }
?> ?>

View File

@ -66,7 +66,7 @@ $body = getstring2("mail.user.history.body", array($thread['userName'],$history)
$link = connect(); $link = connect();
webim_mail($email, $webim_mailbox, $subject, $body, $link); webim_mail($email, $webim_mailbox, $subject, $body, $link);
mysql_close($link); close_connection($link);
setup_logo(); setup_logo();
expand("styles", getchatstyle(), "mailsent.tpl"); expand("styles", getchatstyle(), "mailsent.tpl");

View File

@ -52,7 +52,7 @@ if (isset($_POST['address'])) {
$link = connect(); $link = connect();
$existing_ban = ban_for_addr_($address, $link); $existing_ban = ban_for_addr_($address, $link);
mysql_close($link); close_connection($link);
if ((!$banId && $existing_ban) || if ((!$banId && $existing_ban) ||
($banId && $existing_ban && $banId != $existing_ban['banid'])) { ($banId && $existing_ban && $banId != $existing_ban['banid'])) {
@ -77,7 +77,7 @@ if (isset($_POST['address'])) {
mysql_real_escape_string($comment, $link)); mysql_real_escape_string($comment, $link));
perform_query($query, $link); perform_query($query, $link);
} }
mysql_close($link); close_connection($link);
if (!$threadid) { if (!$threadid) {
header("Location: $webimroot/operator/blocked.php"); header("Location: $webimroot/operator/blocked.php");
@ -97,7 +97,7 @@ if (isset($_POST['address'])) {
$banId = verifyparam('id', "/^\d{1,9}$/"); $banId = verifyparam('id', "/^\d{1,9}$/");
$link = connect(); $link = connect();
$ban = select_one_row("select banid,(unix_timestamp(dtmtill)-unix_timestamp(CURRENT_TIMESTAMP)) as days,address,comment from ${mysqlprefix}chatban where banid = $banId", $link); $ban = select_one_row("select banid,(unix_timestamp(dtmtill)-unix_timestamp(CURRENT_TIMESTAMP)) as days,address,comment from ${mysqlprefix}chatban where banid = $banId", $link);
mysql_close($link); close_connection($link);
if ($ban) { if ($ban) {
$page['banId'] = topage($ban['banid']); $page['banId'] = topage($ban['banid']);
@ -122,4 +122,4 @@ prepare_menu($operator, false);
start_html_output(); start_html_output();
require('../view/ban.php'); require('../view/ban.php');
exit; exit;
?> ?>

View File

@ -55,7 +55,7 @@ while ($ban = mysql_fetch_array($result, MYSQL_ASSOC)) {
} }
mysql_free_result($result); mysql_free_result($result);
mysql_close($link); close_connection($link);
setup_pagination($blockedList); setup_pagination($blockedList);
@ -64,4 +64,4 @@ start_html_output();
require('../view/blocked_visitors.php'); require('../view/blocked_visitors.php');
exit; exit;
?> ?>

View File

@ -61,7 +61,7 @@ function load_canned_messages($locale, $groupid)
$result = select_multi_assoc($query, $link); $result = select_multi_assoc($query, $link);
} }
} }
mysql_close($link); close_connection($link);
return $result; return $result;
} }
@ -94,7 +94,7 @@ if ($settings['enablegroups'] == '1') {
$link = connect(); $link = connect();
$allgroups = get_all_groups($link); $allgroups = get_all_groups($link);
mysql_close($link); close_connection($link);
$page['groups'] = array(); $page['groups'] = array();
$page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
foreach ($allgroups as $g) { foreach ($allgroups as $g) {
@ -114,7 +114,7 @@ if (isset($_GET['act']) && $_GET['act'] == 'delete') {
if (count($errors) == 0) { if (count($errors) == 0) {
$link = connect(); $link = connect();
perform_query("delete from ${mysqlprefix}chatresponses where id = $key", $link); perform_query("delete from ${mysqlprefix}chatresponses where id = $key", $link);
mysql_close($link); close_connection($link);
header("Location: $webimroot/operator/canned.php?lang=$lang&group=$groupid"); header("Location: $webimroot/operator/canned.php?lang=$lang&group=$groupid");
exit; exit;
} }

View File

@ -28,7 +28,7 @@ function load_message($key)
global $mysqlprefix; global $mysqlprefix;
$link = connect(); $link = connect();
$result = select_one_row("select vcvalue from ${mysqlprefix}chatresponses where id = $key", $link); $result = select_one_row("select vcvalue from ${mysqlprefix}chatresponses where id = $key", $link);
mysql_close($link); close_connection($link);
return $result ? $result['vcvalue'] : null; return $result ? $result['vcvalue'] : null;
} }
@ -38,7 +38,7 @@ function save_message($key, $message)
$link = connect(); $link = connect();
perform_query("update ${mysqlprefix}chatresponses set vcvalue = '" . mysql_real_escape_string($message, $link) . "' " . perform_query("update ${mysqlprefix}chatresponses set vcvalue = '" . mysql_real_escape_string($message, $link) . "' " .
"where id = $key", $link); "where id = $key", $link);
mysql_close($link); close_connection($link);
} }
function add_message($locale, $groupid, $message) function add_message($locale, $groupid, $message)
@ -48,7 +48,7 @@ function add_message($locale, $groupid, $message)
perform_query("insert into ${mysqlprefix}chatresponses (locale,groupid,vcvalue) values ('$locale'," . perform_query("insert into ${mysqlprefix}chatresponses (locale,groupid,vcvalue) values ('$locale'," .
($groupid ? "$groupid, " : "null, ") . ($groupid ? "$groupid, " : "null, ") .
"'" . mysql_real_escape_string($message, $link) . "')", $link); "'" . mysql_real_escape_string($message, $link) . "')", $link);
mysql_close($link); close_connection($link);
} }
$operator = check_login(); $operator = check_login();
@ -101,4 +101,4 @@ prepare_menu($operator, false);
start_html_output(); start_html_output();
require('../view/cannededit.php'); require('../view/cannededit.php');
exit; exit;
?> ?>

View File

@ -35,7 +35,7 @@ function group_by_name($name)
$link = connect(); $link = connect();
$group = select_one_row( $group = select_one_row(
"select * from ${mysqlprefix}chatgroup where vclocalname = '" . mysql_real_escape_string($name) . "'", $link); "select * from ${mysqlprefix}chatgroup where vclocalname = '" . mysql_real_escape_string($name) . "'", $link);
mysql_close($link); close_connection($link);
return $group; return $group;
} }
@ -55,7 +55,7 @@ function create_group($name, $descr, $commonname, $commondescr, $email)
$id = mysql_insert_id($link); $id = mysql_insert_id($link);
$newdep = select_one_row("select * from ${mysqlprefix}chatgroup where groupid = $id", $link); $newdep = select_one_row("select * from ${mysqlprefix}chatgroup where groupid = $id", $link);
mysql_close($link); close_connection($link);
return $newdep; return $newdep;
} }
@ -73,7 +73,7 @@ function update_group($groupid, $name, $descr, $commonname, $commondescr, $email
$groupid); $groupid);
perform_query($query, $link); perform_query($query, $link);
mysql_close($link); close_connection($link);
} }

View File

@ -31,7 +31,7 @@ function get_group_members($groupid)
$link = connect(); $link = connect();
$query = "select operatorid from ${mysqlprefix}chatgroupoperator where groupid = $groupid"; $query = "select operatorid from ${mysqlprefix}chatgroupoperator where groupid = $groupid";
$result = select_multi_assoc($query, $link); $result = select_multi_assoc($query, $link);
mysql_close($link); close_connection($link);
return $result; return $result;
} }
@ -43,7 +43,7 @@ function update_group_members($groupid, $newvalue)
foreach ($newvalue as $opid) { foreach ($newvalue as $opid) {
perform_query("insert into ${mysqlprefix}chatgroupoperator (groupid, operatorid) values ($groupid,$opid)", $link); perform_query("insert into ${mysqlprefix}chatgroupoperator (groupid, operatorid) values ($groupid,$opid)", $link);
} }
mysql_close($link); close_connection($link);
} }
function get_operators() function get_operators()
@ -53,7 +53,7 @@ function get_operators()
$query = "select * from ${mysqlprefix}chatoperator order by vclogin"; $query = "select * from ${mysqlprefix}chatoperator order by vclogin";
$result = select_multi_assoc($query, $link); $result = select_multi_assoc($query, $link);
mysql_close($link); close_connection($link);
return $result; return $result;
} }
@ -93,4 +93,4 @@ prepare_menu($operator);
setup_group_settings_tabs($groupid, 1); setup_group_settings_tabs($groupid, 1);
start_html_output(); start_html_output();
require('../view/groupmembers.php'); require('../view/groupmembers.php');
?> ?>

View File

@ -41,7 +41,7 @@ if (isset($_GET['act']) && $_GET['act'] == 'del') {
perform_query("delete from ${mysqlprefix}chatgroup where groupid = $groupid", $link); perform_query("delete from ${mysqlprefix}chatgroup where groupid = $groupid", $link);
perform_query("delete from ${mysqlprefix}chatgroupoperator where groupid = $groupid", $link); perform_query("delete from ${mysqlprefix}chatgroupoperator where groupid = $groupid", $link);
perform_query("update ${mysqlprefix}chatthread set groupid = 0 where groupid = $groupid", $link); perform_query("update ${mysqlprefix}chatthread set groupid = 0 where groupid = $groupid", $link);
mysql_close($link); close_connection($link);
header("Location: $webimroot/operator/groups.php"); header("Location: $webimroot/operator/groups.php");
exit; exit;
} }
@ -63,10 +63,10 @@ function is_away($group)
$page = array(); $page = array();
$link = connect(); $link = connect();
$page['groups'] = get_groups($link, true); $page['groups'] = get_groups($link, true);
mysql_close($link); close_connection($link);
$page['canmodify'] = is_capable($can_administrate, $operator); $page['canmodify'] = is_capable($can_administrate, $operator);
prepare_menu($operator); prepare_menu($operator);
start_html_output(); start_html_output();
require('../view/groups.php'); require('../view/groups.php');
?> ?>

View File

@ -60,7 +60,7 @@ if ($query !== false) {
"order by created DESC", "order by created DESC",
"DISTINCT ${mysqlprefix}chatthread.dtmcreated", $link); "DISTINCT ${mysqlprefix}chatthread.dtmcreated", $link);
mysql_close($link); close_connection($link);
$page['formq'] = topage($query); $page['formq'] = topage($query);
} else { } else {

View File

@ -28,7 +28,7 @@ force_password($operator);
$link = connect(); $link = connect();
loadsettings_($link); loadsettings_($link);
$isonline = is_operator_online($operator['operatorid'], $link); $isonline = is_operator_online($operator['operatorid'], $link);
mysql_close($link); close_connection($link);
$page = array( $page = array(
'version' => $version, 'version' => $version,

View File

@ -33,7 +33,7 @@ $errors = array();
$link = connect(); $link = connect();
$invitation = invitation_state($visitorid, $link); $invitation = invitation_state($visitorid, $link);
mysql_close($link); close_connection($link);
start_xml_output(); start_xml_output();
echo '<invitation>'; echo '<invitation>';

View File

@ -33,7 +33,7 @@ $link = connect();
if (!invitation_invite($visitorid, $operator['operatorid'], $link)) { if (!invitation_invite($visitorid, $operator['operatorid'], $link)) {
die("Invitation failed!"); die("Invitation failed!");
} }
mysql_close($link); close_connection($link);
$page = array(); $page = array();
$page['visitor'] = $visitorid; $page['visitor'] = $visitorid;

View File

@ -54,7 +54,7 @@ if (isset($_GET['act']) && $_GET['act'] == 'del') {
$link = connect(); $link = connect();
perform_query("delete from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid", $link); perform_query("delete from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid", $link);
perform_query("delete from ${mysqlprefix}chatoperator where operatorid = $operatorid", $link); perform_query("delete from ${mysqlprefix}chatoperator where operatorid = $operatorid", $link);
mysql_close($link); close_connection($link);
header("Location: $webimroot/operator/operators.php"); header("Location: $webimroot/operator/operators.php");
exit; exit;

View File

@ -33,7 +33,7 @@ function update_operator_groups($operatorid, $newvalue)
foreach ($newvalue as $groupid) { foreach ($newvalue as $groupid) {
perform_query("insert into ${mysqlprefix}chatgroupoperator (groupid, operatorid) values ($groupid,$operatorid)", $link); perform_query("insert into ${mysqlprefix}chatgroupoperator (groupid, operatorid) values ($groupid,$operatorid)", $link);
} }
mysql_close($link); close_connection($link);
} }
@ -41,7 +41,7 @@ $opId = verifyparam("op", "/^\d{1,9}$/");
$page = array('opid' => $opId); $page = array('opid' => $opId);
$link = connect(); $link = connect();
$page['groups'] = get_all_groups($link); $page['groups'] = get_all_groups($link);
mysql_close($link); close_connection($link);
$errors = array(); $errors = array();
$canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator)) $canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator))
@ -87,4 +87,4 @@ prepare_menu($operator);
setup_operator_settings_tabs($opId, 2); setup_operator_settings_tabs($opId, 2);
start_html_output(); start_html_output();
require('../view/operator_groups.php'); require('../view/operator_groups.php');
?> ?>

View File

@ -32,7 +32,7 @@ function update_operator_permissions($operatorid, $newvalue)
$query = "update ${mysqlprefix}chatoperator set iperm = $newvalue where operatorid = $operatorid"; $query = "update ${mysqlprefix}chatoperator set iperm = $newvalue where operatorid = $operatorid";
perform_query($query, $link); perform_query($query, $link);
mysql_close($link); close_connection($link);
} }
$opId = verifyparam("op", "/^\d{1,9}$/"); $opId = verifyparam("op", "/^\d{1,9}$/");
@ -89,4 +89,4 @@ prepare_menu($operator);
setup_operator_settings_tabs($opId, 3); setup_operator_settings_tabs($opId, 3);
start_html_output(); start_html_output();
require('../view/permissions.php'); require('../view/permissions.php');
?> ?>

View File

@ -51,7 +51,7 @@ if (isset($_GET['nextGroup'])) {
post_message_($thread['threadid'], $kind_events, post_message_($thread['threadid'], $kind_events,
getstring2_("chat.status.operator.redirect", getstring2_("chat.status.operator.redirect",
array(get_operator_name($operator)), $thread['locale']), $link); array(get_operator_name($operator)), $thread['locale']), $link);
mysql_close($link); close_connection($link);
} else { } else {
$errors[] = getlocal("chat.redirect.cannot"); $errors[] = getlocal("chat.redirect.cannot");
} }
@ -77,7 +77,7 @@ if (isset($_GET['nextGroup'])) {
post_message_($thread['threadid'], $kind_events, post_message_($thread['threadid'], $kind_events,
getstring2_("chat.status.operator.redirect", getstring2_("chat.status.operator.redirect",
array(get_operator_name($operator)), $thread['locale']), $link); array(get_operator_name($operator)), $thread['locale']), $link);
mysql_close($link); close_connection($link);
} else { } else {
$errors[] = getlocal("chat.redirect.cannot"); $errors[] = getlocal("chat.redirect.cannot");
} }

View File

@ -55,7 +55,7 @@ if (count($errors) == 0 && isset($_POST['password'])) {
$link = connect(); $link = connect();
$query = "update ${mysqlprefix}chatoperator set vcpassword = '" . md5($password) . "', vcrestoretoken = '' where operatorid = " . $opId; $query = "update ${mysqlprefix}chatoperator set vcpassword = '" . md5($password) . "', vcrestoretoken = '' where operatorid = " . $opId;
perform_query($query, $link); perform_query($query, $link);
mysql_close($link); close_connection($link);
start_html_output(); start_html_output();
require('../view/resetpwd.php'); require('../view/resetpwd.php');
@ -68,4 +68,4 @@ $page['token'] = $token;
$page['isdone'] = false; $page['isdone'] = false;
start_html_output(); start_html_output();
require('../view/resetpwd.php'); require('../view/resetpwd.php');
?> ?>

View File

@ -50,7 +50,7 @@ if (isset($_POST['loginoremail'])) {
$href = get_app_location(true, false) . "/operator/resetpwd.php?id=" . $torestore['operatorid'] . "&token=$token"; $href = get_app_location(true, false) . "/operator/resetpwd.php?id=" . $torestore['operatorid'] . "&token=$token";
webim_mail($email, $email, getstring("restore.mailsubj"), getstring2("restore.mailtext", array(get_operator_name($torestore), $href)), $link); webim_mail($email, $email, getstring("restore.mailsubj"), getstring2("restore.mailtext", array(get_operator_name($torestore), $href)), $link);
mysql_close($link); close_connection($link);
$page['isdone'] = true; $page['isdone'] = true;
require('../view/restore.php'); require('../view/restore.php');
@ -64,4 +64,4 @@ $page['localeLinks'] = get_locale_links("$webimroot/operator/restore.php");
$page['isdone'] = false; $page['isdone'] = false;
start_html_output(); start_html_output();
require('../view/restore.php'); require('../view/restore.php');
?> ?>

View File

@ -82,7 +82,7 @@ $page['reportByAgent'] = select_multi_assoc("select vclocalename as name, COUNT(
$page['showresults'] = count($errors) == 0; $page['showresults'] = count($errors) == 0;
mysql_close($link); close_connection($link);
prepare_menu($operator); prepare_menu($operator);
start_html_output(); start_html_output();

View File

@ -40,7 +40,7 @@ function thread_info($id)
"vclocalname as groupName " . "vclocalname as groupName " .
"from ${mysqlprefix}chatthread left join ${mysqlprefix}chatgroup on ${mysqlprefix}chatthread.groupid = ${mysqlprefix}chatgroup.groupid " . "from ${mysqlprefix}chatthread left join ${mysqlprefix}chatgroup on ${mysqlprefix}chatthread.groupid = ${mysqlprefix}chatgroup.groupid " .
"where threadid = " . $id, $link); "where threadid = " . $id, $link);
mysql_close($link); close_connection($link);
return $thread; return $thread;
} }
@ -55,4 +55,4 @@ if (isset($_GET['threadid'])) {
prepare_menu($operator, false); prepare_menu($operator, false);
start_html_output(); start_html_output();
require('../view/thread_log.php'); require('../view/thread_log.php');
?> ?>

View File

@ -53,7 +53,7 @@ else {
die("Wrong visitor!"); die("Wrong visitor!");
} }
} }
mysql_close($link); close_connection($link);
$path = track_retrieve_path($visitor); $path = track_retrieve_path($visitor);

View File

@ -142,7 +142,7 @@ function print_pending_threads($groupids, $since)
$revision = $row['lrevision']; $revision = $row['lrevision'];
} }
mysql_close($link); close_connection($link);
echo "<threads revision=\"$revision\" time=\"" . time() . "000\">"; echo "<threads revision=\"$revision\" time=\"" . time() . "000\">";
foreach ($output as $thr) { foreach ($output as $thr) {
@ -246,7 +246,7 @@ function print_visitors()
$output[] = $visitor; $output[] = $visitor;
} }
mysql_close($link); close_connection($link);
echo "<visitors>"; echo "<visitors>";
foreach ($output as $thr) { foreach ($output as $thr) {
@ -265,7 +265,7 @@ loadsettings_($link);
if (!isset($_SESSION["${mysqlprefix}operatorgroups"])) { if (!isset($_SESSION["${mysqlprefix}operatorgroups"])) {
$_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link); $_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link);
} }
mysql_close($link); close_connection($link);
$groupids = $_SESSION["${mysqlprefix}operatorgroups"]; $groupids = $_SESSION["${mysqlprefix}operatorgroups"];
start_xml_output(); start_xml_output();
@ -281,4 +281,4 @@ echo '</update>';
notify_operator_alive($operator['operatorid'], $status); notify_operator_alive($operator['operatorid'], $status);
exit; exit;
?> ?>

View File

@ -58,7 +58,7 @@ function threads_by_userid($userid)
} }
mysql_free_result($result); mysql_free_result($result);
mysql_close($link); close_connection($link);
return $foundThreads; return $foundThreads;
} }
@ -68,4 +68,4 @@ prepare_menu($operator);
setup_pagination($found, 6); setup_pagination($found, 6);
start_html_output(); start_html_output();
require('../view/userhistory.php'); require('../view/userhistory.php');
?> ?>

View File

@ -33,7 +33,7 @@ notify_operator_alive($operator['operatorid'], $status);
$link = connect(); $link = connect();
loadsettings_($link); loadsettings_($link);
$_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link); $_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link);
mysql_close($link); close_connection($link);
$page = array(); $page = array();
$page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1"; $page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1";

View File

@ -82,7 +82,7 @@ if( $act == "refresh" ) {
if($isuser && $thread["shownmessageid"] == 0) { if($isuser && $thread["shownmessageid"] == 0) {
commit_thread( $thread['threadid'], array('shownmessageid' => $postedid), $link); commit_thread( $thread['threadid'], array('shownmessageid' => $postedid), $link);
} }
mysql_close($link); close_connection($link);
print_thread_messages($thread, $token, $lastid, $isuser, $outformat, $isuser ? null : $operator['operatorid']); print_thread_messages($thread, $token, $lastid, $isuser, $outformat, $isuser ? null : $operator['operatorid']);
exit; exit;