format code in operator/

This commit is contained in:
Evgeny Gryaznov 2011-02-26 15:06:19 +01:00
parent a90594235a
commit 0c58691731
29 changed files with 648 additions and 624 deletions

View File

@ -31,7 +31,8 @@ loadsettings();
$errors = array();
$page = array();
function load_canned_messages($locale, $groupid) {
function load_canned_messages($locale, $groupid)
{
global $mysqlprefix;
$link = connect();
$query = "select id, vcvalue from ${mysqlprefix}chatresponses " .

View File

@ -23,7 +23,8 @@ require_once('../libs/common.php');
require_once('../libs/operator.php');
require_once('../libs/pagination.php');
function load_message($key) {
function load_message($key)
{
global $mysqlprefix;
$link = connect();
$result = select_one_row("select vcvalue from ${mysqlprefix}chatresponses where id = $key", $link);
@ -31,7 +32,8 @@ function load_message($key) {
return $result ? $result['vcvalue'] : null;
}
function save_message($key,$message) {
function save_message($key, $message)
{
global $mysqlprefix;
$link = connect();
perform_query("update ${mysqlprefix}chatresponses set vcvalue = '" . mysql_real_escape_string($message, $link) . "' " .
@ -39,7 +41,8 @@ function save_message($key,$message) {
mysql_close($link);
}
function add_message($locale,$groupid,$message) {
function add_message($locale, $groupid, $message)
{
global $mysqlprefix;
$link = connect();
perform_query("insert into ${mysqlprefix}chatresponses (locale,groupid,vcvalue) values ('$locale'," .

View File

@ -23,7 +23,8 @@ require_once('../libs/common.php');
require_once('../libs/operator.php');
require_once('../libs/groups.php');
function generate_button($title,$locale,$style,$group,$inner,$showhost,$forcesecure,$modsecurity) {
function generate_button($title, $locale, $style, $group, $inner, $showhost, $forcesecure, $modsecurity)
{
$link = get_app_location($showhost, $forcesecure) . "/client.php";
if ($locale)
$link = append_query($link, "locale=$locale");

View File

@ -29,7 +29,8 @@ $page = array('grid' => '');
$errors = array();
$groupid = '';
function group_by_name($name) {
function group_by_name($name)
{
global $mysqlprefix;
$link = connect();
$group = select_one_row(
@ -38,7 +39,8 @@ function group_by_name($name) {
return $group;
}
function create_group($name,$descr,$commonname,$commondescr) {
function create_group($name, $descr, $commonname, $commondescr)
{
global $mysqlprefix;
$link = connect();
$query = sprintf(
@ -56,7 +58,8 @@ function create_group($name,$descr,$commonname,$commondescr) {
return $newdep;
}
function update_group($groupid,$name,$descr,$commonname,$commondescr) {
function update_group($groupid, $name, $descr, $commonname, $commondescr)
{
global $mysqlprefix;
$link = connect();
$query = sprintf(

View File

@ -25,7 +25,8 @@ require_once('../libs/groups.php');
$operator = check_login();
function get_group_members($groupid) {
function get_group_members($groupid)
{
global $mysqlprefix;
$link = connect();
$query = "select operatorid from ${mysqlprefix}chatgroupoperator where groupid = $groupid";
@ -34,7 +35,8 @@ function get_group_members($groupid) {
return $result;
}
function update_group_members($groupid,$newvalue) {
function update_group_members($groupid, $newvalue)
{
global $mysqlprefix;
$link = connect();
perform_query("delete from ${mysqlprefix}chatgroupoperator where groupid = $groupid", $link);
@ -44,7 +46,8 @@ function update_group_members($groupid,$newvalue) {
mysql_close($link);
}
function get_operators() {
function get_operators()
{
global $mysqlprefix;
$link = connect();

View File

@ -47,12 +47,14 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
}
}
function is_online($group) {
function is_online($group)
{
global $settings;
return $group['ilastseen'] !== NULL && $group['ilastseen'] < $settings['online_timeout'] ? "1" : "";
}
function is_away($group) {
function is_away($group)
{
global $settings;
return $group['ilastseenaway'] !== NULL && $group['ilastseenaway'] < $settings['online_timeout'] ? "1" : "";
}

View File

@ -25,7 +25,8 @@ require_once('../libs/operator_settings.php');
$operator = check_login();
function update_operator_groups($operatorid,$newvalue) {
function update_operator_groups($operatorid, $newvalue)
{
global $mysqlprefix;
$link = connect();
perform_query("delete from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid", $link);

View File

@ -31,7 +31,8 @@ $page = array();
loadsettings();
setlocale(LC_TIME, getstring("time.locale"));
function thread_info($id) {
function thread_info($id)
{
global $mysqlprefix;
$link = connect();
$thread = select_one_row("select userName,agentName,remote,userAgent," .

View File

@ -23,21 +23,24 @@ require_once('../libs/common.php');
require_once('../libs/operator.php');
require_once('../libs/pagination.php');
function compare_localization_by_l1($a, $b) {
function compare_localization_by_l1($a, $b)
{
if ($a == $b) {
return 0;
}
return ($a['l1'] < $b['l1']) ? -1 : 1;
}
function compare_localization_by_id($a, $b) {
function compare_localization_by_id($a, $b)
{
if ($a == $b) {
return 0;
}
return ($a['id'] < $b['id']) ? -1 : 1;
}
function load_idlist($name) {
function load_idlist($name)
{
$result = array();
$fp = @fopen(dirname(__FILE__) . "/../locales/names/$name", "r");
if ($fp !== FALSE) {
@ -52,7 +55,8 @@ function load_idlist($name) {
return $result;
}
function save_message($locale,$key,$value) {
function save_message($locale, $key, $value)
{
global $webim_encoding;
$result = "";
$added = false;
@ -98,7 +102,8 @@ function save_message($locale,$key,$value) {
}
}
function get_auxiliary($s) {
function get_auxiliary($s)
{
$res = "";
if (preg_match_all("/<[^>]+?>|[:]|\{\d+\}|[Mm]ibew|[Ww]ebim/", $s, $matches, PREG_PATTERN_ORDER)) {
foreach ($matches[0] as $val) {

View File

@ -49,7 +49,8 @@ $threadstate_key = array(
$state_loading => "chat.thread.state_loading"
);
function thread_to_xml($thread,$link) {
function thread_to_xml($thread, $link)
{
global $state_chatting, $threadstate_to_string, $threadstate_key,
$webim_encoding, $operator, $settings,
$can_viewthreads, $can_takeover, $mysqlprefix;
@ -112,7 +113,8 @@ function thread_to_xml($thread,$link) {
return $result;
}
function print_pending_threads($groupids,$since) {
function print_pending_threads($groupids, $since)
{
global $webim_encoding, $settings, $state_closed, $state_left, $mysqlprefix;
$link = connect();
@ -148,7 +150,8 @@ function print_pending_threads($groupids,$since) {
echo "</threads>";
}
function print_operators() {
function print_operators()
{
echo "<operators>";
$operators = operator_get_all();

View File

@ -37,7 +37,8 @@ if( isset($_GET['userid'])) {
$userid = verifyparam("userid", "/^.{0,63}$/", "");
}
function threads_by_userid($userid) {
function threads_by_userid($userid)
{
global $mysqlprefix;
if ($userid == "") {
return null;