From 1cd6926f4fbf685a2d6250bbc67ecc62189b9357 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Wed, 9 Nov 2011 14:16:37 +0000 Subject: [PATCH] Replaced all mysql_close by close_connection, except for the directory /install --- src/messenger/webim/b.php | 2 +- src/messenger/webim/client.php | 4 +-- src/messenger/webim/invite.php | 2 +- src/messenger/webim/leavemessage.php | 4 +-- src/messenger/webim/libs/chat.php | 28 +++++++++---------- src/messenger/webim/libs/common.php | 2 +- src/messenger/webim/libs/getcode.php | 2 +- src/messenger/webim/libs/groups.php | 4 +-- src/messenger/webim/libs/operator.php | 22 +++++++-------- src/messenger/webim/libs/settings.php | 4 +-- src/messenger/webim/mail.php | 2 +- src/messenger/webim/operator/ban.php | 8 +++--- src/messenger/webim/operator/blocked.php | 4 +-- src/messenger/webim/operator/canned.php | 6 ++-- src/messenger/webim/operator/cannededit.php | 8 +++--- src/messenger/webim/operator/group.php | 6 ++-- src/messenger/webim/operator/groupmembers.php | 8 +++--- src/messenger/webim/operator/groups.php | 6 ++-- src/messenger/webim/operator/history.php | 2 +- src/messenger/webim/operator/index.php | 2 +- .../webim/operator/invitationstate.php | 2 +- src/messenger/webim/operator/invite.php | 2 +- src/messenger/webim/operator/operators.php | 2 +- src/messenger/webim/operator/opgroups.php | 6 ++-- src/messenger/webim/operator/permissions.php | 4 +-- src/messenger/webim/operator/redirect.php | 4 +-- src/messenger/webim/operator/resetpwd.php | 4 +-- src/messenger/webim/operator/restore.php | 4 +-- src/messenger/webim/operator/statistics.php | 2 +- .../webim/operator/threadprocessor.php | 4 +-- src/messenger/webim/operator/tracked.php | 2 +- src/messenger/webim/operator/update.php | 8 +++--- src/messenger/webim/operator/userhistory.php | 4 +-- src/messenger/webim/operator/users.php | 2 +- src/messenger/webim/thread.php | 2 +- 35 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/messenger/webim/b.php b/src/messenger/webim/b.php index 4780c50f..97671c68 100644 --- a/src/messenger/webim/b.php +++ b/src/messenger/webim/b.php @@ -32,7 +32,7 @@ if($referer && isset($_SESSION['threadid'])) { $msg = getstring2_("chat.client.visited.page", array($referer), $thread['locale']); post_message_($thread['threadid'], $kind_for_agent,$msg,$link); } - mysql_close($link); + close_connection($link); } $image = verifyparam(isset($_GET['image']) ? "image" : "i", "/^\w+$/", "webim"); diff --git a/src/messenger/webim/client.php b/src/messenger/webim/client.php index 936a09f4..c3b64685 100644 --- a/src/messenger/webim/client.php +++ b/src/messenger/webim/client.php @@ -110,7 +110,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) { $link = connect(); 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"); } $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']); commit_thread( $thread['threadid'], array('shownmessageid' => $postedid), $link); } - mysql_close($link); + close_connection($link); } $threadid = $thread['threadid']; $token = $thread['ltoken']; diff --git a/src/messenger/webim/invite.php b/src/messenger/webim/invite.php index 9c0471c1..3f7161f8 100644 --- a/src/messenger/webim/invite.php +++ b/src/messenger/webim/invite.php @@ -51,7 +51,7 @@ if ($settings['enabletracking'] == '1') { $operator = operator_by_id_($invited, $link); } - mysql_close($link); + close_connection($link); } start_xml_output(); diff --git a/src/messenger/webim/leavemessage.php b/src/messenger/webim/leavemessage.php index 15ee680f..12a407c9 100644 --- a/src/messenger/webim/leavemessage.php +++ b/src/messenger/webim/leavemessage.php @@ -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_user,$message,$link,$name); - mysql_close($link); + close_connection($link); } $groupid = ""; @@ -118,7 +118,7 @@ if (isset($group) && !empty($group['vcemail'])) { if($inbox_mail) { $link = connect(); webim_mail($inbox_mail, $email, $subject, $body, $link); - mysql_close($link); + close_connection($link); } setup_logo(); diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 2390a524..dc383cd6 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -83,7 +83,7 @@ function post_message($threadid, $kind, $message, $from = null, $agentid = null) { $link = connect(); $id = post_message_($threadid, $kind, $message, $link, $from, null, $agentid); - mysql_close($link); + close_connection($link); return $id; } @@ -158,7 +158,7 @@ function get_messages($threadid, $meth, $isuser, &$lastid) } } - mysql_close($link); + close_connection($link); return $messages; } @@ -328,7 +328,7 @@ function setup_survey($name, $email, $groupid, $info, $referrer) if ($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") { $link = connect(); $allgroups = get_groups($link, false); - mysql_close($link); + close_connection($link); $val = ""; foreach ($allgroups as $k) { $groupname = $k['vclocalname']; @@ -414,7 +414,7 @@ function load_canned_messages($locale, $groupid) } $result = $result2; } - mysql_close($link); + close_connection($link); return $result; } @@ -452,7 +452,7 @@ function setup_chatview_for_operator($thread, $operator) $visitor = track_get_visitor_by_threadid($thread['threadid'], $link); $page['trackedParams'] = array("visitor" => "" . $visitor['visitorid']); $page['trackedParamsLink'] = add_params($webimroot . "/operator/tracked.php", $page['trackedParams']); - mysql_close($link); + close_connection($link); } $predefinedres = ""; $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) { $params['istate'] = $state_queue; commit_thread($thread['threadid'], $params, $link); - mysql_close($link); + close_connection($link); return; } @@ -510,13 +510,13 @@ function ping_thread($thread, $isuser, $istyping) $params['istate'] = $state_waiting; $params['nextagent'] = 0; commit_thread($thread['threadid'], $params, $link); - mysql_close($link); + close_connection($link); return; } } update_thread_access($thread['threadid'], $params, $link); - mysql_close($link); + close_connection($link); } function commit_thread($threadid, $params, $link) @@ -542,7 +542,7 @@ function rename_user($thread, $newname) post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.user.changedname", array($thread['userName'], $newname), $thread['locale']), $link); } - mysql_close($link); + close_connection($link); } 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']) : getstring2_("chat.status.operator.left", array($thread['agentName']), $thread['locale']); post_message_($thread['threadid'], $kind_events, $message, $link); - mysql_close($link); + close_connection($link); } function thread_by_id_($id, $link) @@ -580,7 +580,7 @@ function thread_by_id($id) { $link = connect(); $thread = thread_by_id_($id, $link); - mysql_close($link); + close_connection($link); return $thread; } @@ -615,7 +615,7 @@ function do_take_thread($threadid, $operatorId, $operatorName) "nextagent" => 0, "agentId" => $operatorId, "agentName" => "'" . mysql_real_escape_string($operatorName, $link) . "'"), $link); - mysql_close($link); + close_connection($link); } 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); - mysql_close($link); + close_connection($link); return $thread; } @@ -746,4 +746,4 @@ function get_remote_host() return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr; } -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index 43c53e77..46f43cea 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -687,7 +687,7 @@ function loadsettings() if (!$settingsloaded) { $link = connect(); loadsettings_($link); - mysql_close($link); + close_connection($link); } } diff --git a/src/messenger/webim/libs/getcode.php b/src/messenger/webim/libs/getcode.php index 64f3b13f..475ec3c6 100644 --- a/src/messenger/webim/libs/getcode.php +++ b/src/messenger/webim/libs/getcode.php @@ -84,7 +84,7 @@ function get_groups_list() if ($settings['enablegroups'] == '1') { $link = connect(); $allgroups = get_all_groups($link); - mysql_close($link); + close_connection($link); $result[] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); foreach ($allgroups as $g) { $result[] = $g; diff --git a/src/messenger/webim/libs/groups.php b/src/messenger/webim/libs/groups.php index 27beb5fe..1a02c3f8 100644 --- a/src/messenger/webim/libs/groups.php +++ b/src/messenger/webim/libs/groups.php @@ -25,7 +25,7 @@ function group_by_id($id) $link = connect(); $group = select_one_row( "select * from ${mysqlprefix}chatgroup where groupid = $id", $link); - mysql_close($link); + close_connection($link); return $group; } @@ -66,4 +66,4 @@ function get_operator_groupslist($operatorid, $link) } } -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index ecfed251..0e130892 100755 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -39,7 +39,7 @@ function operator_by_login($login) $link = connect(); $operator = select_one_row( "select * from ${mysqlprefix}chatoperator where vclogin = '" . mysql_real_escape_string($login) . "'", $link); - mysql_close($link); + close_connection($link); return $operator; } @@ -49,7 +49,7 @@ function operator_by_email($mail) $link = connect(); $operator = select_one_row( "select * from ${mysqlprefix}chatoperator where vcemail = '" . mysql_real_escape_string($mail) . "'", $link); - mysql_close($link); + close_connection($link); return $operator; } @@ -64,7 +64,7 @@ function operator_by_id($id) { $link = connect(); $operator = operator_by_id_($id, $link); - mysql_close($link); + close_connection($link); 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 " . "from ${mysqlprefix}chatoperator order by vclogin"; $operators = select_multi_assoc($query, $link); - mysql_close($link); + close_connection($link); return $operators; } @@ -115,7 +115,7 @@ function update_operator($operatorid, $login, $email, $password, $localename, $c $operatorid); perform_query($query, $link); - mysql_close($link); + close_connection($link); // update the session password if (isset($password)) { @@ -133,7 +133,7 @@ function update_operator_avatar($operatorid, $avatar) mysql_real_escape_string($avatar), $operatorid); perform_query($query, $link); - mysql_close($link); + close_connection($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(); $newop = create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link); - mysql_close($link); + close_connection($link); return $newop; } @@ -167,7 +167,7 @@ function notify_operator_alive($operatorid, $istatus) global $mysqlprefix; $link = connect(); 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 = "") @@ -183,7 +183,7 @@ function has_online_operators($groupid = "") $query .= " where istatus = 0"; } $row = select_one_row($query, $link); - mysql_close($link); + close_connection($link); 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); $groups = array_slice($groups, $p['start'], $p['end'] - $p['start']); - mysql_close($link); + close_connection($link); $agent_list = ""; $params = array('thread' => $threadid, 'token' => $token); @@ -418,7 +418,7 @@ function get_operator_groupids($operatorid) $link = connect(); $query = "select groupid from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid"; $result = select_multi_assoc($query, $link); - mysql_close($link); + close_connection($link); return $result; } diff --git a/src/messenger/webim/libs/settings.php b/src/messenger/webim/libs/settings.php index 24fbbf6e..9b5f1fd2 100644 --- a/src/messenger/webim/libs/settings.php +++ b/src/messenger/webim/libs/settings.php @@ -31,7 +31,7 @@ function update_settings() perform_query($query, $link); } - mysql_close($link); + close_connection($link); } function setup_settings_tabs($active) @@ -45,4 +45,4 @@ function setup_settings_tabs($active) ); } -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/mail.php b/src/messenger/webim/mail.php index d79d23a3..bfe7166d 100644 --- a/src/messenger/webim/mail.php +++ b/src/messenger/webim/mail.php @@ -66,7 +66,7 @@ $body = getstring2("mail.user.history.body", array($thread['userName'],$history) $link = connect(); webim_mail($email, $webim_mailbox, $subject, $body, $link); -mysql_close($link); +close_connection($link); setup_logo(); expand("styles", getchatstyle(), "mailsent.tpl"); diff --git a/src/messenger/webim/operator/ban.php b/src/messenger/webim/operator/ban.php index 8aee9b76..6e1edb2a 100644 --- a/src/messenger/webim/operator/ban.php +++ b/src/messenger/webim/operator/ban.php @@ -52,7 +52,7 @@ if (isset($_POST['address'])) { $link = connect(); $existing_ban = ban_for_addr_($address, $link); - mysql_close($link); + close_connection($link); if ((!$banId && $existing_ban) || ($banId && $existing_ban && $banId != $existing_ban['banid'])) { @@ -77,7 +77,7 @@ if (isset($_POST['address'])) { mysql_real_escape_string($comment, $link)); perform_query($query, $link); } - mysql_close($link); + close_connection($link); if (!$threadid) { header("Location: $webimroot/operator/blocked.php"); @@ -97,7 +97,7 @@ if (isset($_POST['address'])) { $banId = verifyparam('id', "/^\d{1,9}$/"); $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); - mysql_close($link); + close_connection($link); if ($ban) { $page['banId'] = topage($ban['banid']); @@ -122,4 +122,4 @@ prepare_menu($operator, false); start_html_output(); require('../view/ban.php'); exit; -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/blocked.php b/src/messenger/webim/operator/blocked.php index 80f5329f..abbdc80e 100644 --- a/src/messenger/webim/operator/blocked.php +++ b/src/messenger/webim/operator/blocked.php @@ -55,7 +55,7 @@ while ($ban = mysql_fetch_array($result, MYSQL_ASSOC)) { } mysql_free_result($result); -mysql_close($link); +close_connection($link); setup_pagination($blockedList); @@ -64,4 +64,4 @@ start_html_output(); require('../view/blocked_visitors.php'); exit; -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/canned.php b/src/messenger/webim/operator/canned.php index c665ddf0..eee6d7a5 100644 --- a/src/messenger/webim/operator/canned.php +++ b/src/messenger/webim/operator/canned.php @@ -61,7 +61,7 @@ function load_canned_messages($locale, $groupid) $result = select_multi_assoc($query, $link); } } - mysql_close($link); + close_connection($link); return $result; } @@ -94,7 +94,7 @@ if ($settings['enablegroups'] == '1') { $link = connect(); $allgroups = get_all_groups($link); - mysql_close($link); + close_connection($link); $page['groups'] = array(); $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); foreach ($allgroups as $g) { @@ -114,7 +114,7 @@ if (isset($_GET['act']) && $_GET['act'] == 'delete') { if (count($errors) == 0) { $link = connect(); 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"); exit; } diff --git a/src/messenger/webim/operator/cannededit.php b/src/messenger/webim/operator/cannededit.php index 6d208aff..bdb128c4 100644 --- a/src/messenger/webim/operator/cannededit.php +++ b/src/messenger/webim/operator/cannededit.php @@ -28,7 +28,7 @@ function load_message($key) global $mysqlprefix; $link = connect(); $result = select_one_row("select vcvalue from ${mysqlprefix}chatresponses where id = $key", $link); - mysql_close($link); + close_connection($link); return $result ? $result['vcvalue'] : null; } @@ -38,7 +38,7 @@ function save_message($key, $message) $link = connect(); perform_query("update ${mysqlprefix}chatresponses set vcvalue = '" . mysql_real_escape_string($message, $link) . "' " . "where id = $key", $link); - mysql_close($link); + close_connection($link); } 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'," . ($groupid ? "$groupid, " : "null, ") . "'" . mysql_real_escape_string($message, $link) . "')", $link); - mysql_close($link); + close_connection($link); } $operator = check_login(); @@ -101,4 +101,4 @@ prepare_menu($operator, false); start_html_output(); require('../view/cannededit.php'); exit; -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/group.php b/src/messenger/webim/operator/group.php index 745c46b8..eedca5eb 100644 --- a/src/messenger/webim/operator/group.php +++ b/src/messenger/webim/operator/group.php @@ -35,7 +35,7 @@ function group_by_name($name) $link = connect(); $group = select_one_row( "select * from ${mysqlprefix}chatgroup where vclocalname = '" . mysql_real_escape_string($name) . "'", $link); - mysql_close($link); + close_connection($link); return $group; } @@ -55,7 +55,7 @@ function create_group($name, $descr, $commonname, $commondescr, $email) $id = mysql_insert_id($link); $newdep = select_one_row("select * from ${mysqlprefix}chatgroup where groupid = $id", $link); - mysql_close($link); + close_connection($link); return $newdep; } @@ -73,7 +73,7 @@ function update_group($groupid, $name, $descr, $commonname, $commondescr, $email $groupid); perform_query($query, $link); - mysql_close($link); + close_connection($link); } diff --git a/src/messenger/webim/operator/groupmembers.php b/src/messenger/webim/operator/groupmembers.php index 6a717ae0..00991776 100644 --- a/src/messenger/webim/operator/groupmembers.php +++ b/src/messenger/webim/operator/groupmembers.php @@ -31,7 +31,7 @@ function get_group_members($groupid) $link = connect(); $query = "select operatorid from ${mysqlprefix}chatgroupoperator where groupid = $groupid"; $result = select_multi_assoc($query, $link); - mysql_close($link); + close_connection($link); return $result; } @@ -43,7 +43,7 @@ function update_group_members($groupid, $newvalue) foreach ($newvalue as $opid) { perform_query("insert into ${mysqlprefix}chatgroupoperator (groupid, operatorid) values ($groupid,$opid)", $link); } - mysql_close($link); + close_connection($link); } function get_operators() @@ -53,7 +53,7 @@ function get_operators() $query = "select * from ${mysqlprefix}chatoperator order by vclogin"; $result = select_multi_assoc($query, $link); - mysql_close($link); + close_connection($link); return $result; } @@ -93,4 +93,4 @@ prepare_menu($operator); setup_group_settings_tabs($groupid, 1); start_html_output(); require('../view/groupmembers.php'); -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/groups.php b/src/messenger/webim/operator/groups.php index af0ae20a..b6ae2bfe 100644 --- a/src/messenger/webim/operator/groups.php +++ b/src/messenger/webim/operator/groups.php @@ -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}chatgroupoperator 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"); exit; } @@ -63,10 +63,10 @@ function is_away($group) $page = array(); $link = connect(); $page['groups'] = get_groups($link, true); -mysql_close($link); +close_connection($link); $page['canmodify'] = is_capable($can_administrate, $operator); prepare_menu($operator); start_html_output(); require('../view/groups.php'); -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/history.php b/src/messenger/webim/operator/history.php index 015ce66d..2ff373a8 100644 --- a/src/messenger/webim/operator/history.php +++ b/src/messenger/webim/operator/history.php @@ -60,7 +60,7 @@ if ($query !== false) { "order by created DESC", "DISTINCT ${mysqlprefix}chatthread.dtmcreated", $link); - mysql_close($link); + close_connection($link); $page['formq'] = topage($query); } else { diff --git a/src/messenger/webim/operator/index.php b/src/messenger/webim/operator/index.php index 244fc239..d9acd6c4 100644 --- a/src/messenger/webim/operator/index.php +++ b/src/messenger/webim/operator/index.php @@ -28,7 +28,7 @@ force_password($operator); $link = connect(); loadsettings_($link); $isonline = is_operator_online($operator['operatorid'], $link); -mysql_close($link); +close_connection($link); $page = array( 'version' => $version, diff --git a/src/messenger/webim/operator/invitationstate.php b/src/messenger/webim/operator/invitationstate.php index 191ceeb6..d9bfde45 100644 --- a/src/messenger/webim/operator/invitationstate.php +++ b/src/messenger/webim/operator/invitationstate.php @@ -33,7 +33,7 @@ $errors = array(); $link = connect(); $invitation = invitation_state($visitorid, $link); -mysql_close($link); +close_connection($link); start_xml_output(); echo ''; diff --git a/src/messenger/webim/operator/invite.php b/src/messenger/webim/operator/invite.php index 17c35504..5c118607 100644 --- a/src/messenger/webim/operator/invite.php +++ b/src/messenger/webim/operator/invite.php @@ -33,7 +33,7 @@ $link = connect(); if (!invitation_invite($visitorid, $operator['operatorid'], $link)) { die("Invitation failed!"); } -mysql_close($link); +close_connection($link); $page = array(); $page['visitor'] = $visitorid; diff --git a/src/messenger/webim/operator/operators.php b/src/messenger/webim/operator/operators.php index eeb01e37..47937d35 100644 --- a/src/messenger/webim/operator/operators.php +++ b/src/messenger/webim/operator/operators.php @@ -54,7 +54,7 @@ if (isset($_GET['act']) && $_GET['act'] == 'del') { $link = connect(); perform_query("delete from ${mysqlprefix}chatgroupoperator 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"); exit; diff --git a/src/messenger/webim/operator/opgroups.php b/src/messenger/webim/operator/opgroups.php index c821d5dc..26018736 100644 --- a/src/messenger/webim/operator/opgroups.php +++ b/src/messenger/webim/operator/opgroups.php @@ -33,7 +33,7 @@ function update_operator_groups($operatorid, $newvalue) foreach ($newvalue as $groupid) { 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); $link = connect(); $page['groups'] = get_all_groups($link); -mysql_close($link); +close_connection($link); $errors = array(); $canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator)) @@ -87,4 +87,4 @@ prepare_menu($operator); setup_operator_settings_tabs($opId, 2); start_html_output(); require('../view/operator_groups.php'); -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/permissions.php b/src/messenger/webim/operator/permissions.php index 308f3957..00713e2c 100644 --- a/src/messenger/webim/operator/permissions.php +++ b/src/messenger/webim/operator/permissions.php @@ -32,7 +32,7 @@ function update_operator_permissions($operatorid, $newvalue) $query = "update ${mysqlprefix}chatoperator set iperm = $newvalue where operatorid = $operatorid"; perform_query($query, $link); - mysql_close($link); + close_connection($link); } $opId = verifyparam("op", "/^\d{1,9}$/"); @@ -89,4 +89,4 @@ prepare_menu($operator); setup_operator_settings_tabs($opId, 3); start_html_output(); require('../view/permissions.php'); -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/redirect.php b/src/messenger/webim/operator/redirect.php index 2397477c..bb27d0eb 100644 --- a/src/messenger/webim/operator/redirect.php +++ b/src/messenger/webim/operator/redirect.php @@ -51,7 +51,7 @@ if (isset($_GET['nextGroup'])) { post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale']), $link); - mysql_close($link); + close_connection($link); } else { $errors[] = getlocal("chat.redirect.cannot"); } @@ -77,7 +77,7 @@ if (isset($_GET['nextGroup'])) { post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale']), $link); - mysql_close($link); + close_connection($link); } else { $errors[] = getlocal("chat.redirect.cannot"); } diff --git a/src/messenger/webim/operator/resetpwd.php b/src/messenger/webim/operator/resetpwd.php index 285f909e..84dfe4f5 100644 --- a/src/messenger/webim/operator/resetpwd.php +++ b/src/messenger/webim/operator/resetpwd.php @@ -55,7 +55,7 @@ if (count($errors) == 0 && isset($_POST['password'])) { $link = connect(); $query = "update ${mysqlprefix}chatoperator set vcpassword = '" . md5($password) . "', vcrestoretoken = '' where operatorid = " . $opId; perform_query($query, $link); - mysql_close($link); + close_connection($link); start_html_output(); require('../view/resetpwd.php'); @@ -68,4 +68,4 @@ $page['token'] = $token; $page['isdone'] = false; start_html_output(); require('../view/resetpwd.php'); -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/restore.php b/src/messenger/webim/operator/restore.php index 37c392fd..3bc19dc3 100644 --- a/src/messenger/webim/operator/restore.php +++ b/src/messenger/webim/operator/restore.php @@ -50,7 +50,7 @@ if (isset($_POST['loginoremail'])) { $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); - mysql_close($link); + close_connection($link); $page['isdone'] = true; require('../view/restore.php'); @@ -64,4 +64,4 @@ $page['localeLinks'] = get_locale_links("$webimroot/operator/restore.php"); $page['isdone'] = false; start_html_output(); require('../view/restore.php'); -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/statistics.php b/src/messenger/webim/operator/statistics.php index dc5b0af2..1cd2dc03 100644 --- a/src/messenger/webim/operator/statistics.php +++ b/src/messenger/webim/operator/statistics.php @@ -82,7 +82,7 @@ $page['reportByAgent'] = select_multi_assoc("select vclocalename as name, COUNT( $page['showresults'] = count($errors) == 0; -mysql_close($link); +close_connection($link); prepare_menu($operator); start_html_output(); diff --git a/src/messenger/webim/operator/threadprocessor.php b/src/messenger/webim/operator/threadprocessor.php index 158e63ae..1d979f70 100644 --- a/src/messenger/webim/operator/threadprocessor.php +++ b/src/messenger/webim/operator/threadprocessor.php @@ -40,7 +40,7 @@ function thread_info($id) "vclocalname as groupName " . "from ${mysqlprefix}chatthread left join ${mysqlprefix}chatgroup on ${mysqlprefix}chatthread.groupid = ${mysqlprefix}chatgroup.groupid " . "where threadid = " . $id, $link); - mysql_close($link); + close_connection($link); return $thread; } @@ -55,4 +55,4 @@ if (isset($_GET['threadid'])) { prepare_menu($operator, false); start_html_output(); require('../view/thread_log.php'); -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/tracked.php b/src/messenger/webim/operator/tracked.php index 91d63c88..9b6f8565 100644 --- a/src/messenger/webim/operator/tracked.php +++ b/src/messenger/webim/operator/tracked.php @@ -53,7 +53,7 @@ else { die("Wrong visitor!"); } } -mysql_close($link); +close_connection($link); $path = track_retrieve_path($visitor); diff --git a/src/messenger/webim/operator/update.php b/src/messenger/webim/operator/update.php index b23e6cdf..b63999d5 100644 --- a/src/messenger/webim/operator/update.php +++ b/src/messenger/webim/operator/update.php @@ -142,7 +142,7 @@ function print_pending_threads($groupids, $since) $revision = $row['lrevision']; } - mysql_close($link); + close_connection($link); echo ""; foreach ($output as $thr) { @@ -246,7 +246,7 @@ function print_visitors() $output[] = $visitor; } - mysql_close($link); + close_connection($link); echo ""; foreach ($output as $thr) { @@ -265,7 +265,7 @@ loadsettings_($link); if (!isset($_SESSION["${mysqlprefix}operatorgroups"])) { $_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link); } -mysql_close($link); +close_connection($link); $groupids = $_SESSION["${mysqlprefix}operatorgroups"]; start_xml_output(); @@ -281,4 +281,4 @@ echo ''; notify_operator_alive($operator['operatorid'], $status); exit; -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/userhistory.php b/src/messenger/webim/operator/userhistory.php index 20926b42..41b66845 100644 --- a/src/messenger/webim/operator/userhistory.php +++ b/src/messenger/webim/operator/userhistory.php @@ -58,7 +58,7 @@ function threads_by_userid($userid) } mysql_free_result($result); - mysql_close($link); + close_connection($link); return $foundThreads; } @@ -68,4 +68,4 @@ prepare_menu($operator); setup_pagination($found, 6); start_html_output(); require('../view/userhistory.php'); -?> \ No newline at end of file +?> diff --git a/src/messenger/webim/operator/users.php b/src/messenger/webim/operator/users.php index c73fb037..55a730bf 100644 --- a/src/messenger/webim/operator/users.php +++ b/src/messenger/webim/operator/users.php @@ -33,7 +33,7 @@ notify_operator_alive($operator['operatorid'], $status); $link = connect(); loadsettings_($link); $_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link); -mysql_close($link); +close_connection($link); $page = array(); $page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1"; diff --git a/src/messenger/webim/thread.php b/src/messenger/webim/thread.php index 00b23a1a..b117ce9c 100644 --- a/src/messenger/webim/thread.php +++ b/src/messenger/webim/thread.php @@ -82,7 +82,7 @@ if( $act == "refresh" ) { if($isuser && $thread["shownmessageid"] == 0) { 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']); exit;