mirror of
https://github.com/Mibew/i18n.git
synced 2025-02-02 09:34:41 +03:00
replace " . $mysqlprefix . " -> ${mysqlprefix}
This commit is contained in:
parent
84bd011a11
commit
2bcffd5f4a
11
src/messenger/.idea/inspectionProfiles/Project_Default.xml
Normal file
11
src/messenger/.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0" is_locked="false">
|
||||
<option name="myName" value="Project Default" />
|
||||
<option name="myLocal" value="false" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
$dbtables = array(
|
||||
$mysqlprefix . "chatgroup" => array(
|
||||
"${mysqlprefix}chatgroup" => array(
|
||||
"groupid" => "int NOT NULL auto_increment PRIMARY KEY",
|
||||
"vcemail" => "varchar(64)",
|
||||
"vclocalname" => "varchar(64) NOT NULL",
|
||||
@ -29,7 +29,7 @@ $dbtables = array(
|
||||
"vccommondescription" => "varchar(1024) NOT NULL",
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatthread" => array(
|
||||
"${mysqlprefix}chatthread" => array(
|
||||
"threadid" => "int NOT NULL auto_increment PRIMARY KEY",
|
||||
"userName" => "varchar(64) NOT NULL",
|
||||
"userid" => "varchar(255)",
|
||||
@ -51,12 +51,12 @@ $dbtables = array(
|
||||
"shownmessageid" => "int NOT NULL DEFAULT 0",
|
||||
"userAgent" => "varchar(255)",
|
||||
"messageCount" => "varchar(16)",
|
||||
"groupid" => "int references " . $mysqlprefix . "chatgroup(groupid)",
|
||||
"groupid" => "int references ${mysqlprefix}chatgroup(groupid)",
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatmessage" => array(
|
||||
"${mysqlprefix}chatmessage" => array(
|
||||
"messageid" => "int NOT NULL auto_increment PRIMARY KEY",
|
||||
"threadid" => "int NOT NULL references " . $mysqlprefix . "chatthread(threadid)",
|
||||
"threadid" => "int NOT NULL references ${mysqlprefix}chatthread(threadid)",
|
||||
"ikind" => "int NOT NULL",
|
||||
"agentId" => "int NOT NULL DEFAULT 0",
|
||||
"tmessage" => "text NOT NULL",
|
||||
@ -64,7 +64,7 @@ $dbtables = array(
|
||||
"tname" => "varchar(64)"
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatoperator" => array(
|
||||
"${mysqlprefix}chatoperator" => array(
|
||||
"operatorid" => "int NOT NULL auto_increment PRIMARY KEY",
|
||||
"vclogin" => "varchar(64) NOT NULL",
|
||||
"vcpassword" => "varchar(64) NOT NULL",
|
||||
@ -81,16 +81,16 @@ $dbtables = array(
|
||||
"vcrestoretoken" => "varchar(64)",
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatrevision" => array(
|
||||
"${mysqlprefix}chatrevision" => array(
|
||||
"id" => "INT NOT NULL"
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatgroupoperator" => array(
|
||||
"groupid" => "int NOT NULL references " . $mysqlprefix . "chatgroup(groupid)",
|
||||
"operatorid" => "int NOT NULL references " . $mysqlprefix . "chatoperator(operatorid)",
|
||||
"${mysqlprefix}chatgroupoperator" => array(
|
||||
"groupid" => "int NOT NULL references ${mysqlprefix}chatgroup(groupid)",
|
||||
"operatorid" => "int NOT NULL references ${mysqlprefix}chatoperator(operatorid)",
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatban" => array(
|
||||
"${mysqlprefix}chatban" => array(
|
||||
"banid" => "INT NOT NULL auto_increment PRIMARY KEY",
|
||||
"dtmcreated" => "datetime DEFAULT 0",
|
||||
"dtmtill" => "datetime DEFAULT 0",
|
||||
@ -99,20 +99,20 @@ $dbtables = array(
|
||||
"blockedCount" => "int DEFAULT 0"
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatconfig" => array (
|
||||
"${mysqlprefix}chatconfig" => array (
|
||||
"id" => "INT NOT NULL auto_increment PRIMARY KEY",
|
||||
"vckey" => "varchar(255)",
|
||||
"vcvalue" => "varchar(255)",
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatresponses" => array(
|
||||
"${mysqlprefix}chatresponses" => array(
|
||||
"id" => "INT NOT NULL auto_increment PRIMARY KEY",
|
||||
"locale" => "varchar(8)",
|
||||
"groupid" => "int references " . $mysqlprefix . "chatgroup(groupid)",
|
||||
"groupid" => "int references ${mysqlprefix}chatgroup(groupid)",
|
||||
"vcvalue" => "varchar(1024) NOT NULL",
|
||||
),
|
||||
|
||||
$mysqlprefix . "chatnotification" => array(
|
||||
"${mysqlprefix}chatnotification" => array(
|
||||
"id" => "INT NOT NULL auto_increment PRIMARY KEY",
|
||||
"locale" => "varchar(8)",
|
||||
"vckind" => "varchar(16)",
|
||||
@ -120,21 +120,21 @@ $dbtables = array(
|
||||
"dtmcreated" => "datetime DEFAULT 0",
|
||||
"vcsubject" => "varchar(256)",
|
||||
"tmessage" => "text NOT NULL",
|
||||
"refoperator" => "int NOT NULL references " . $mysqlprefix . "chatoperator(operatorid)",
|
||||
"refoperator" => "int NOT NULL references ${mysqlprefix}chatoperator(operatorid)",
|
||||
),
|
||||
);
|
||||
|
||||
$memtables = array();
|
||||
|
||||
$dbtables_can_update = array(
|
||||
$mysqlprefix . "chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount", "nextagent", "shownmessageid", "userid", "userAgent", "groupid"),
|
||||
$mysqlprefix . "chatmessage" => array("agentId"),
|
||||
$mysqlprefix . "chatoperator" => array("vcavatar", "vcjabbername", "iperm", "istatus", "vcemail", "dtmrestore", "vcrestoretoken", "inotify"),
|
||||
$mysqlprefix . "chatban" => array(),
|
||||
$mysqlprefix . "chatgroup" => array("vcemail"),
|
||||
$mysqlprefix . "chatgroupoperator" => array(),
|
||||
$mysqlprefix . "chatresponses" => array(),
|
||||
$mysqlprefix . "chatnotification" => array(),
|
||||
"${mysqlprefix}chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount", "nextagent", "shownmessageid", "userid", "userAgent", "groupid"),
|
||||
"${mysqlprefix}chatmessage" => array("agentId"),
|
||||
"${mysqlprefix}chatoperator" => array("vcavatar", "vcjabbername", "iperm", "istatus", "vcemail", "dtmrestore", "vcrestoretoken", "inotify"),
|
||||
"${mysqlprefix}chatban" => array(),
|
||||
"${mysqlprefix}chatgroup" => array("vcemail"),
|
||||
"${mysqlprefix}chatgroupoperator" => array(),
|
||||
"${mysqlprefix}chatresponses" => array(),
|
||||
"${mysqlprefix}chatnotification" => array(),
|
||||
);
|
||||
|
||||
function show_install_err($text) {
|
||||
@ -173,10 +173,10 @@ function create_table($id,$link) {
|
||||
|
||||
mysql_query($query,$link) or show_install_err(' Query failed: '.mysql_error());
|
||||
|
||||
if( $id == $mysqlprefix . 'chatoperator' ) {
|
||||
if( $id == "${mysqlprefix}chatoperator" ) {
|
||||
create_operator_("admin", "", "", "", "Administrator", "Administrator", 0, $link);
|
||||
} else if( $id == $mysqlprefix . 'chatrevision' ) {
|
||||
perform_query("INSERT INTO " . $mysqlprefix . "chatrevision VALUES (1)",$link);
|
||||
} else if( $id == "${mysqlprefix}chatrevision" ) {
|
||||
perform_query("INSERT INTO ${mysqlprefix}chatrevision VALUES (1)",$link);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,90 +77,90 @@ if ($act == "silentcreateall") {
|
||||
}
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatmessage.agentId", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatmessage ADD agentId int NOT NULL DEFAULT 0 AFTER ikind", $link);
|
||||
runsql("update " . $mysqlprefix . "chatmessage, " . $mysqlprefix . "chatoperator set agentId = operatorid where agentId = 0 AND ikind = 2 AND (vclocalename = tname OR vccommonname = tname)", $link);
|
||||
if( in_array("${mysqlprefix}chatmessage.agentId", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatmessage ADD agentId int NOT NULL DEFAULT 0 AFTER ikind", $link);
|
||||
runsql("update ${mysqlprefix}chatmessage, ${mysqlprefix}chatoperator set agentId = operatorid where agentId = 0 AND ikind = 2 AND (vclocalename = tname OR vccommonname = tname)", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.agentId", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD agentId int NOT NULL DEFAULT 0 AFTER agentName", $link);
|
||||
runsql("update " . $mysqlprefix . "chatthread, " . $mysqlprefix . "chatoperator set agentId = operatorid where agentId = 0 AND (vclocalename = agentName OR vccommonname = agentName)", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.agentId", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD agentId int NOT NULL DEFAULT 0 AFTER agentName", $link);
|
||||
runsql("update ${mysqlprefix}chatthread, ${mysqlprefix}chatoperator set agentId = operatorid where agentId = 0 AND (vclocalename = agentName OR vccommonname = agentName)", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.agentTyping", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD agentTyping int DEFAULT 0", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.agentTyping", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD agentTyping int DEFAULT 0", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.userTyping", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD userTyping int DEFAULT 0", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.userTyping", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD userTyping int DEFAULT 0", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.messageCount", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD messageCount varchar(16)", $link);
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatmessage ADD INDEX idx_threadid_ikind (threadid, ikind)", $link);
|
||||
runsql("UPDATE " . $mysqlprefix . "chatthread t SET t.messageCount = (SELECT COUNT(*) FROM " . $mysqlprefix . "chatmessage WHERE " . $mysqlprefix . "chatmessage.threadid = t.threadid AND ikind = 1)", $link);
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatmessage DROP INDEX idx_threadid_ikind", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.messageCount", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD messageCount varchar(16)", $link);
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatmessage ADD INDEX idx_threadid_ikind (threadid, ikind)", $link);
|
||||
runsql("UPDATE ${mysqlprefix}chatthread t SET t.messageCount = (SELECT COUNT(*) FROM ${mysqlprefix}chatmessage WHERE ${mysqlprefix}chatmessage.threadid = t.threadid AND ikind = 1)", $link);
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatmessage DROP INDEX idx_threadid_ikind", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.nextagent", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD nextagent int NOT NULL DEFAULT 0", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.nextagent", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD nextagent int NOT NULL DEFAULT 0", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.shownmessageid", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD shownmessageid int NOT NULL DEFAULT 0", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.shownmessageid", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD shownmessageid int NOT NULL DEFAULT 0", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.userid", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD userid varchar(255) DEFAULT \"\"", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.userid", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD userid varchar(255) DEFAULT \"\"", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatoperator.iperm", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatoperator ADD iperm int DEFAULT 65535", $link);
|
||||
if( in_array("${mysqlprefix}chatoperator.iperm", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD iperm int DEFAULT 65535", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatoperator.istatus", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatoperator ADD istatus int DEFAULT 0", $link);
|
||||
if( in_array("${mysqlprefix}chatoperator.istatus", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD istatus int DEFAULT 0", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatoperator.inotify", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatoperator ADD inotify int DEFAULT 0", $link);
|
||||
if( in_array("${mysqlprefix}chatoperator.inotify", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD inotify int DEFAULT 0", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatoperator.vcavatar", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatoperator ADD vcavatar varchar(255)", $link);
|
||||
if( in_array("${mysqlprefix}chatoperator.vcavatar", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD vcavatar varchar(255)", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatoperator.vcjabbername", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatoperator ADD vcjabbername varchar(255)", $link);
|
||||
if( in_array("${mysqlprefix}chatoperator.vcjabbername", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD vcjabbername varchar(255)", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatoperator.vcemail", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatoperator ADD vcemail varchar(64)", $link);
|
||||
if( in_array("${mysqlprefix}chatoperator.vcemail", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD vcemail varchar(64)", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatoperator.dtmrestore", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatoperator ADD dtmrestore datetime DEFAULT 0", $link);
|
||||
if( in_array("${mysqlprefix}chatoperator.dtmrestore", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD dtmrestore datetime DEFAULT 0", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatoperator.vcrestoretoken", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatoperator ADD vcrestoretoken varchar(64)", $link);
|
||||
if( in_array("${mysqlprefix}chatoperator.vcrestoretoken", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD vcrestoretoken varchar(64)", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.groupid", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD groupid int references " . $mysqlprefix . "chatgroup(groupid)", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.groupid", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD groupid int references ${mysqlprefix}chatgroup(groupid)", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatthread.userAgent", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatthread ADD userAgent varchar(255)", $link);
|
||||
if( in_array("${mysqlprefix}chatthread.userAgent", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD userAgent varchar(255)", $link);
|
||||
}
|
||||
|
||||
if( in_array($mysqlprefix . "chatgroup.vcemail", $absent) ) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatgroup ADD vcemail varchar(64)", $link);
|
||||
if( in_array("${mysqlprefix}chatgroup.vcemail", $absent) ) {
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatgroup ADD vcemail varchar(64)", $link);
|
||||
}
|
||||
|
||||
$res = mysql_query("select null from information_schema.statistics where table_name = '". $mysqlprefix . "chatmessage' and index_name = 'idx_agentid'", $link);
|
||||
$res = mysql_query("select null from information_schema.statistics where table_name = '${mysqlprefix}chatmessage' and index_name = 'idx_agentid'", $link);
|
||||
if($res && mysql_num_rows($res) == 0) {
|
||||
runsql("ALTER TABLE " . $mysqlprefix . "chatmessage ADD INDEX idx_agentid (agentid)", $link);
|
||||
runsql("ALTER TABLE ${mysqlprefix}chatmessage ADD INDEX idx_agentid (agentid)", $link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ function next_token() {
|
||||
|
||||
function next_revision($link) {
|
||||
global $mysqlprefix;
|
||||
perform_query("update " . $mysqlprefix . "chatrevision set id=LAST_INSERT_ID(id+1)",$link);
|
||||
perform_query("update ${mysqlprefix}chatrevision set id=LAST_INSERT_ID(id+1)",$link);
|
||||
$val = mysql_insert_id($link);
|
||||
return $val;
|
||||
}
|
||||
@ -61,7 +61,7 @@ function next_revision($link) {
|
||||
function post_message_($threadid,$kind,$message,$link,$from=null,$utime=null,$opid=null) {
|
||||
global $mysqlprefix;
|
||||
$query = sprintf(
|
||||
"insert into " . $mysqlprefix . "chatmessage (threadid,ikind,tmessage,tname,agentId,dtmcreated) values (%s, %s,'%s',%s,%s,%s)",
|
||||
"insert into ${mysqlprefix}chatmessage (threadid,ikind,tmessage,tname,agentId,dtmcreated) values (%s, %s,'%s',%s,%s,%s)",
|
||||
$threadid,
|
||||
$kind,
|
||||
mysql_real_escape_string($message,$link),
|
||||
@ -119,7 +119,7 @@ function get_messages($threadid,$meth,$isuser,&$lastid) {
|
||||
$link = connect();
|
||||
|
||||
$query = sprintf(
|
||||
"select messageid,ikind,unix_timestamp(dtmcreated) as created,tname,tmessage from " . $mysqlprefix . "chatmessage ".
|
||||
"select messageid,ikind,unix_timestamp(dtmcreated) as created,tname,tmessage from ${mysqlprefix}chatmessage ".
|
||||
"where threadid = %s and messageid > %s %s order by messageid",
|
||||
$threadid, $lastid, $isuser ? "and ikind <> $kind_for_agent" : "" );
|
||||
|
||||
@ -374,7 +374,7 @@ function load_canned_messages($locale, $groupid) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$result = select_multi_assoc(
|
||||
"select vcvalue from " . $mysqlprefix . "chatresponses where locale = '".$locale."' ".
|
||||
"select vcvalue from ${mysqlprefix}chatresponses where locale = '".$locale."' ".
|
||||
"AND (groupid is NULL OR groupid = 0) order by vcvalue", $link);
|
||||
if(count($result) == 0) {
|
||||
foreach(explode("\n", getstring_('chat.predefined_answers', $locale)) as $answer) {
|
||||
@ -383,7 +383,7 @@ function load_canned_messages($locale, $groupid) {
|
||||
}
|
||||
if($groupid) {
|
||||
$result2 = select_multi_assoc(
|
||||
"select vcvalue from " . $mysqlprefix . "chatresponses where locale = '".$locale."' ".
|
||||
"select vcvalue from ${mysqlprefix}chatresponses where locale = '".$locale."' ".
|
||||
"AND groupid = $groupid order by vcvalue", $link);
|
||||
foreach($result as $r) {
|
||||
$result2[] = $r;
|
||||
@ -444,7 +444,7 @@ function update_thread_access($threadid, $params, $link) {
|
||||
$clause .= $k."=".$v;
|
||||
}
|
||||
perform_query(
|
||||
"update " . $mysqlprefix . "chatthread set $clause ".
|
||||
"update ${mysqlprefix}chatthread set $clause ".
|
||||
"where threadid = ".$threadid,$link);
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@ function ping_thread($thread, $isuser,$istyping) {
|
||||
|
||||
function commit_thread($threadid,$params,$link) {
|
||||
global $mysqlprefix;
|
||||
$query = "update " . $mysqlprefix . "chatthread t set lrevision = ".next_revision($link).", dtmmodified = CURRENT_TIMESTAMP";
|
||||
$query = "update ${mysqlprefix}chatthread t set lrevision = ".next_revision($link).", dtmmodified = CURRENT_TIMESTAMP";
|
||||
foreach( $params as $k => $v ) {
|
||||
$query .= ", ".$k."=".$v;
|
||||
}
|
||||
@ -515,7 +515,7 @@ function close_thread($thread,$isuser) {
|
||||
$link = connect();
|
||||
if( $thread['istate'] != $state_closed ) {
|
||||
commit_thread( $thread['threadid'], array('istate' => $state_closed,
|
||||
"messageCount" => "(SELECT COUNT(*) FROM " . $mysqlprefix . "chatmessage WHERE " . $mysqlprefix . "chatmessage.threadid = t.threadid AND ikind = 1)"), $link);
|
||||
'messageCount' => "(SELECT COUNT(*) FROM ${mysqlprefix}chatmessage WHERE ${mysqlprefix}chatmessage.threadid = t.threadid AND ikind = 1)"), $link);
|
||||
}
|
||||
|
||||
$message = $isuser ? getstring2_("chat.status.user.left", array($thread['userName']), $thread['locale'])
|
||||
@ -529,12 +529,12 @@ function thread_by_id_($id,$link) {
|
||||
return select_one_row("select threadid,userName,agentName,agentId,lrevision,istate,ltoken,userTyping,agentTyping".
|
||||
",unix_timestamp(dtmmodified) as modified, unix_timestamp(dtmcreated) as created".
|
||||
",remote,referer,locale,unix_timestamp(lastpinguser) as lpuser,unix_timestamp(lastpingagent) as lpagent, unix_timestamp(CURRENT_TIMESTAMP) as current,nextagent,shownmessageid,userid,userAgent,groupid".
|
||||
" from " . $mysqlprefix . "chatthread where threadid = ". $id, $link );
|
||||
" from ${mysqlprefix}chatthread where threadid = ". $id, $link );
|
||||
}
|
||||
|
||||
function ban_for_addr_($addr,$link) {
|
||||
global $mysqlprefix;
|
||||
return select_one_row("select banid,comment from " . $mysqlprefix . "chatban where unix_timestamp(dtmtill) > unix_timestamp(CURRENT_TIMESTAMP) AND address = '".mysql_real_escape_string($addr,$link)."'", $link );
|
||||
return select_one_row("select banid,comment from ${mysqlprefix}chatban where unix_timestamp(dtmtill) > unix_timestamp(CURRENT_TIMESTAMP) AND address = '".mysql_real_escape_string($addr,$link)."'", $link );
|
||||
}
|
||||
|
||||
function thread_by_id($id) {
|
||||
@ -547,7 +547,7 @@ function thread_by_id($id) {
|
||||
function create_thread($groupid,$username,$remoteHost,$referer,$lang,$userid,$userbrowser,$initialState,$link) {
|
||||
global $mysqlprefix;
|
||||
$query = sprintf(
|
||||
"insert into " . $mysqlprefix . "chatthread (userName,userid,ltoken,remote,referer,lrevision,locale,userAgent,dtmcreated,dtmmodified,istate".($groupid?",groupid":"").") values ".
|
||||
"insert into ${mysqlprefix}chatthread (userName,userid,ltoken,remote,referer,lrevision,locale,userAgent,dtmcreated,dtmmodified,istate".($groupid?",groupid":"").") values ".
|
||||
"('%s','%s',%s,'%s','%s',%s,'%s','%s',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,$initialState".($groupid?",$groupid":"").")",
|
||||
mysql_real_escape_string($username, $link),
|
||||
mysql_real_escape_string($userid, $link),
|
||||
@ -655,9 +655,9 @@ function notify_operators($thread,$firstmessage,$link) {
|
||||
global $settings, $mysqlprefix;
|
||||
if($settings['enablejabber'] == 1) {
|
||||
$groupid = $thread['groupid'];
|
||||
$query = "select " . $mysqlprefix . "chatoperator.operatorid as opid, inotify, vcjabbername, vcemail, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time from " . $mysqlprefix . "chatoperator";
|
||||
$query = "select ${mysqlprefix}chatoperator.operatorid as opid, inotify, vcjabbername, vcemail, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time from ${mysqlprefix}chatoperator";
|
||||
if($groupid) {
|
||||
$query .= ", " . $mysqlprefix . "chatgroupoperator where groupid = $groupid and " . $mysqlprefix . "chatoperator.operatorid = " . $mysqlprefix . "chatgroupoperator.operatorid and istatus = 0";
|
||||
$query .= ", ${mysqlprefix}chatgroupoperator where groupid = $groupid and ${mysqlprefix}chatoperator.operatorid = ${mysqlprefix}chatgroupoperator.operatorid and istatus = 0";
|
||||
} else {
|
||||
$query .= " where istatus = 0";
|
||||
}
|
||||
@ -684,7 +684,7 @@ function check_connections_from_remote($remote,$link) {
|
||||
return true;
|
||||
}
|
||||
$result = select_one_row(
|
||||
"select count(*) as opened from " . $mysqlprefix . "chatthread ".
|
||||
"select count(*) as opened from ${mysqlprefix}chatthread ".
|
||||
"where remote = '". mysql_real_escape_string($remote, $link)."' AND istate <> $state_closed AND istate <> $state_left", $link );
|
||||
if($result && isset($result['opened'])) {
|
||||
return $result['opened'] < $settings['max_connections_from_one_host'];
|
||||
@ -707,7 +707,6 @@ function visitor_from_request() {
|
||||
$userName = getgetparam('name', $userName);
|
||||
}
|
||||
|
||||
$userId = "";
|
||||
if (isset($_COOKIE[$usercookie])) {
|
||||
$userId = $_COOKIE[$usercookie];
|
||||
} else {
|
||||
|
@ -600,7 +600,7 @@ function loadsettings_($link) {
|
||||
}
|
||||
$settingsloaded = true;
|
||||
|
||||
$sqlresult = mysql_query("select vckey,vcvalue from " . $mysqlprefix . "chatconfig",$link) or die(' Query failed: '.mysql_error($link).": ".$query);
|
||||
$sqlresult = mysql_query("select vckey,vcvalue from ${mysqlprefix}chatconfig", $link) or die(' Query failed: '.mysql_error($link));
|
||||
|
||||
while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) {
|
||||
$name = $row['vckey'];
|
||||
|
@ -23,7 +23,7 @@ function group_by_id($id) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$group = select_one_row(
|
||||
"select * from " . $mysqlprefix . "chatgroup where groupid = $id", $link );
|
||||
"select * from ${mysqlprefix}chatgroup where groupid = $id", $link );
|
||||
mysql_close($link);
|
||||
return $group;
|
||||
}
|
||||
@ -52,7 +52,7 @@ function get_operator_groupslist($operatorid, $link) {
|
||||
global $settings, $mysqlprefix;
|
||||
if($settings['enablegroups'] == '1') {
|
||||
$groupids = array(0);
|
||||
$allgroups = select_multi_assoc("select groupid from " . $mysqlprefix . "chatgroupoperator where operatorid = $operatorid order by groupid",$link);
|
||||
$allgroups = select_multi_assoc("select groupid from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid order by groupid",$link);
|
||||
foreach($allgroups as $g) {
|
||||
$groupids[] = $g['groupid'];
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
function log_notification($locale,$kind,$to,$subj,$text,$refop,$link) {
|
||||
global $mysqlprefix;
|
||||
$query = sprintf(
|
||||
"insert into " . $mysqlprefix . "chatnotification (locale,vckind,vcto,vcsubject,tmessage,refoperator,dtmcreated) values ('%s','%s','%s','%s','%s',%s,%s)",
|
||||
"insert into ${mysqlprefix}chatnotification (locale,vckind,vcto,vcsubject,tmessage,refoperator,dtmcreated) values ('%s','%s','%s','%s','%s',%s,%s)",
|
||||
$locale,
|
||||
$kind,
|
||||
mysql_real_escape_string($to,$link),
|
||||
|
@ -37,7 +37,7 @@ function operator_by_login($login) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$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);
|
||||
return $operator;
|
||||
}
|
||||
@ -46,7 +46,7 @@ function operator_by_email($mail) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$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);
|
||||
return $operator;
|
||||
}
|
||||
@ -54,7 +54,7 @@ function operator_by_email($mail) {
|
||||
function operator_by_id_($id,$link) {
|
||||
global $mysqlprefix;
|
||||
return select_one_row(
|
||||
"select * from " .$mysqlprefix . "chatoperator where operatorid = $id", $link );
|
||||
"select * from ${mysqlprefix}chatoperator where operatorid = $id", $link );
|
||||
}
|
||||
|
||||
function operator_by_id($id) {
|
||||
@ -69,7 +69,7 @@ function operator_get_all() {
|
||||
$link = connect();
|
||||
|
||||
$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);
|
||||
mysql_close($link);
|
||||
return $operators;
|
||||
@ -94,7 +94,7 @@ function update_operator($operatorid,$login,$email,$jabber,$password,$localename
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = sprintf(
|
||||
"update " . $mysqlprefix . "chatoperator set vclogin = '%s',%s vclocalename = '%s', vccommonname = '%s'".
|
||||
"update ${mysqlprefix}chatoperator set vclogin = '%s',%s vclocalename = '%s', vccommonname = '%s'".
|
||||
", vcemail = '%s', vcjabbername= '%s', inotify = %s".
|
||||
" where operatorid = %s",
|
||||
mysql_real_escape_string($login),
|
||||
@ -114,7 +114,7 @@ function update_operator_avatar($operatorid,$avatar) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = sprintf(
|
||||
"update " . $mysqlprefix . "chatoperator set vcavatar = '%s' where operatorid = %s",
|
||||
"update ${mysqlprefix}chatoperator set vcavatar = '%s' where operatorid = %s",
|
||||
mysql_real_escape_string($avatar), $operatorid );
|
||||
|
||||
perform_query($query,$link);
|
||||
@ -124,7 +124,7 @@ function update_operator_avatar($operatorid,$avatar) {
|
||||
function create_operator_($login,$email,$jabber,$password,$localename,$commonname,$notify,$link) {
|
||||
global $mysqlprefix;
|
||||
$query = sprintf(
|
||||
"insert into " . $mysqlprefix . "chatoperator (vclogin,vcpassword,vclocalename,vccommonname,vcavatar,vcemail,vcjabbername,inotify) values ('%s','%s','%s','%s','%s','%s','%s',%s)",
|
||||
"insert into ${mysqlprefix}chatoperator (vclogin,vcpassword,vclocalename,vccommonname,vcavatar,vcemail,vcjabbername,inotify) values ('%s','%s','%s','%s','%s','%s','%s',%s)",
|
||||
mysql_real_escape_string($login),
|
||||
md5($password),
|
||||
mysql_real_escape_string($localename),
|
||||
@ -137,7 +137,7 @@ function create_operator_($login,$email,$jabber,$password,$localename,$commonnam
|
||||
perform_query($query,$link);
|
||||
$id = mysql_insert_id($link);
|
||||
|
||||
return select_one_row("select * from " . $mysqlprefix . "chatoperator where operatorid = $id", $link );
|
||||
return select_one_row("select * from ${mysqlprefix}chatoperator where operatorid = $id", $link );
|
||||
}
|
||||
|
||||
function create_operator($login,$email,$jabber,$password,$localename,$commonname,$notify) {
|
||||
@ -150,7 +150,7 @@ function create_operator($login,$email,$jabber,$password,$localename,$commonname
|
||||
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);
|
||||
perform_query("update ${mysqlprefix}chatoperator set istatus = $istatus, dtmlastvisited = CURRENT_TIMESTAMP where operatorid = $operatorid",$link);
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
@ -158,10 +158,10 @@ function has_online_operators($groupid="") {
|
||||
global $settings, $mysqlprefix;
|
||||
loadsettings();
|
||||
$link = connect();
|
||||
$query = "select count(*) as total, min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time from " . $mysqlprefix . "chatoperator";
|
||||
$query = "select count(*) as total, min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time from ${mysqlprefix}chatoperator";
|
||||
if($groupid) {
|
||||
$query .= ", " . $mysqlprefix . "chatgroupoperator where groupid = $groupid and " . $mysqlprefix . "chatoperator.operatorid = " .
|
||||
$mysqlprefix . "chatgroupoperator.operatorid and istatus = 0";
|
||||
$query .= ", ${mysqlprefix}chatgroupoperator where groupid = $groupid and ${mysqlprefix}chatoperator.operatorid = " .
|
||||
"${mysqlprefix}chatgroupoperator.operatorid and istatus = 0";
|
||||
} else {
|
||||
$query .= " where istatus = 0";
|
||||
}
|
||||
@ -174,7 +174,7 @@ function is_operator_online($operatorid, $link) {
|
||||
global $settings, $mysqlprefix;
|
||||
loadsettings_($link);
|
||||
$query = "select count(*) as total, min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
|
||||
"from " . $mysqlprefix . "chatoperator where operatorid = $operatorid";
|
||||
"from ${mysqlprefix}chatoperator where operatorid = $operatorid";
|
||||
$row = select_one_row($query,$link);
|
||||
return $row['time'] < $settings['online_timeout'] && $row['total'] == 1;
|
||||
}
|
||||
@ -196,12 +196,12 @@ function append_query($link,$pv) {
|
||||
|
||||
function check_login($redirect=true) {
|
||||
global $webimroot, $mysqlprefix;
|
||||
if( !isset( $_SESSION[$mysqlprefix . 'operator'] ) ) {
|
||||
if( !isset( $_SESSION["${mysqlprefix}operator"] ) ) {
|
||||
if( isset($_COOKIE['webim_lite']) ) {
|
||||
list($login,$pwd) = preg_split("/,/", $_COOKIE['webim_lite'], 2);
|
||||
$op = operator_by_login($login);
|
||||
if( $op && isset($pwd) && isset($op['vcpassword']) && md5($op['vcpassword']) == $pwd ) {
|
||||
$_SESSION[$mysqlprefix . 'operator'] = $op;
|
||||
$_SESSION["${mysqlprefix}operator"] = $op;
|
||||
return $op;
|
||||
}
|
||||
}
|
||||
@ -217,17 +217,17 @@ function check_login($redirect=true) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return $_SESSION[$mysqlprefix . 'operator'];
|
||||
return $_SESSION["${mysqlprefix}operator"];
|
||||
}
|
||||
|
||||
function get_logged_in() {
|
||||
global $mysqlprefix;
|
||||
return isset( $_SESSION[$mysqlprefix . 'operator'] ) ? $_SESSION[$mysqlprefix . 'operator'] : FALSE;
|
||||
return isset( $_SESSION["${mysqlprefix}operator"] ) ? $_SESSION["${mysqlprefix}operator"] : FALSE;
|
||||
}
|
||||
|
||||
function login_operator($operator,$remember) {
|
||||
global $webimroot, $mysqlprefix;
|
||||
$_SESSION[$mysqlprefix . 'operator'] = $operator;
|
||||
$_SESSION["${mysqlprefix}operator"] = $operator;
|
||||
if( $remember ) {
|
||||
$value = $operator['vclogin'].",".md5($operator['vcpassword']);
|
||||
setcookie('webim_lite', $value, time()+60*60*24*1000, "$webimroot/");
|
||||
@ -239,7 +239,7 @@ function login_operator($operator,$remember) {
|
||||
|
||||
function logout_operator() {
|
||||
global $webimroot, $mysqlprefix;
|
||||
unset($_SESSION[$mysqlprefix . 'operator']);
|
||||
unset($_SESSION["${mysqlprefix}operator"]);
|
||||
unset($_SESSION['backpath']);
|
||||
if( isset($_COOKIE['webim_lite']) ) {
|
||||
setcookie('webim_lite', '', time() - 3600, "$webimroot/");
|
||||
@ -251,11 +251,11 @@ function setup_redirect_links($threadid,$token) {
|
||||
loadsettings();
|
||||
$link = connect();
|
||||
|
||||
$operatorscount = db_rows_count($mysqlprefix . "chatoperator", array(), "", $link);
|
||||
$operatorscount = db_rows_count("${mysqlprefix}chatoperator", array(), "", $link);
|
||||
|
||||
$groupscount = 0;
|
||||
$groups = array();
|
||||
if($settings['enablegroups'] == "1") {
|
||||
$groups = array();
|
||||
foreach(get_groups($link, true) as $group) {
|
||||
if($group['inumofagents'] == 0) {
|
||||
continue;
|
||||
@ -271,10 +271,9 @@ function setup_redirect_links($threadid,$token) {
|
||||
|
||||
$operators = select_multi_assoc(db_build_select(
|
||||
"operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time",
|
||||
$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']);
|
||||
|
||||
mysql_close($link);
|
||||
|
||||
$agent_list = "";
|
||||
@ -348,34 +347,34 @@ function prepare_menu($operator,$hasright=true) {
|
||||
|
||||
function get_all_groups($link) {
|
||||
global $mysqlprefix;
|
||||
$query = "select " . $mysqlprefix . "chatgroup.groupid as groupid, vclocalname, vclocaldescription from " . $mysqlprefix . "chatgroup order by vclocalname";
|
||||
$query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription from ${mysqlprefix}chatgroup order by vclocalname";
|
||||
return select_multi_assoc($query, $link);
|
||||
}
|
||||
|
||||
function get_groups($link,$checkaway) {
|
||||
global $mysqlprefix;
|
||||
$query = "select " . $mysqlprefix . "chatgroup.groupid as groupid, vclocalname, vclocaldescription".
|
||||
", (SELECT count(*) from " . $mysqlprefix . "chatgroupoperator where " . $mysqlprefix . "chatgroup.groupid = " .
|
||||
$mysqlprefix . "chatgroupoperator.groupid) as inumofagents".
|
||||
$query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription".
|
||||
", (SELECT count(*) from ${mysqlprefix}chatgroupoperator where ${mysqlprefix}chatgroup.groupid = " .
|
||||
"${mysqlprefix}chatgroupoperator.groupid) as inumofagents".
|
||||
", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
|
||||
"from " . $mysqlprefix . "chatgroupoperator, " . $mysqlprefix . "chatoperator where istatus = 0 and " .
|
||||
$mysqlprefix . "chatgroup.groupid = " . $mysqlprefix . "chatgroupoperator.groupid ".
|
||||
"and " . $mysqlprefix . "chatgroupoperator.operatorid = " . $mysqlprefix . "chatoperator.operatorid) as ilastseen".
|
||||
"from ${mysqlprefix}chatgroupoperator, ${mysqlprefix}chatoperator where istatus = 0 and " .
|
||||
"${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid ".
|
||||
"and ${mysqlprefix}chatgroupoperator.operatorid = ${mysqlprefix}chatoperator.operatorid) as ilastseen".
|
||||
($checkaway
|
||||
? ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
|
||||
"from " . $mysqlprefix . "chatgroupoperator, " . $mysqlprefix . "chatoperator where istatus <> 0 and " .
|
||||
$mysqlprefix . "chatgroup.groupid = " . $mysqlprefix . "chatgroupoperator.groupid ".
|
||||
"and " . $mysqlprefix . "chatgroupoperator.operatorid = " . $mysqlprefix . "chatoperator.operatorid) as ilastseenaway"
|
||||
"from ${mysqlprefix}chatgroupoperator, ${mysqlprefix}chatoperator where istatus <> 0 and " .
|
||||
"${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid ".
|
||||
"and ${mysqlprefix}chatgroupoperator.operatorid = ${mysqlprefix}chatoperator.operatorid) as ilastseenaway"
|
||||
: ""
|
||||
).
|
||||
" from " . $mysqlprefix . "chatgroup order by vclocalname";
|
||||
" from ${mysqlprefix}chatgroup order by vclocalname";
|
||||
return select_multi_assoc($query, $link);
|
||||
}
|
||||
|
||||
function get_operator_groupids($operatorid) {
|
||||
global $mysqlprefix;
|
||||
$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);
|
||||
mysql_close($link);
|
||||
return $result;
|
||||
|
@ -24,9 +24,9 @@ function update_settings() {
|
||||
$link = connect();
|
||||
foreach ($settings as $key => $value) {
|
||||
if(!isset($settings_in_db[$key])) {
|
||||
perform_query("insert into " . $mysqlprefix . "chatconfig (vckey) values ('$key')",$link);
|
||||
perform_query("insert into ${mysqlprefix}chatconfig (vckey) values ('$key')",$link);
|
||||
}
|
||||
$query = sprintf("update " . $mysqlprefix . "chatconfig set vcvalue='%s' where vckey='$key'", mysql_real_escape_string($value));
|
||||
$query = sprintf("update ${mysqlprefix}chatconfig set vcvalue='%s' where vckey='$key'", mysql_real_escape_string($value));
|
||||
perform_query($query,$link);
|
||||
}
|
||||
|
||||
|
@ -64,14 +64,14 @@ if( isset($_POST['address']) ) {
|
||||
$utime = time() + $days * 24*60*60;
|
||||
if (!$banId) {
|
||||
$query = sprintf(
|
||||
"insert into " . $mysqlprefix . "chatban (dtmcreated,dtmtill,address,comment) values (CURRENT_TIMESTAMP,%s,'%s','%s')",
|
||||
"insert into ${mysqlprefix}chatban (dtmcreated,dtmtill,address,comment) values (CURRENT_TIMESTAMP,%s,'%s','%s')",
|
||||
"FROM_UNIXTIME($utime)",
|
||||
mysql_real_escape_string($address,$link),
|
||||
mysql_real_escape_string($comment,$link));
|
||||
perform_query($query,$link);
|
||||
} else {
|
||||
$query = sprintf(
|
||||
"update " . $mysqlprefix . "chatban set dtmtill = %s,address = '%s',comment = '%s' where banid = $banId",
|
||||
"update ${mysqlprefix}chatban set dtmtill = %s,address = '%s',comment = '%s' where banid = $banId",
|
||||
"FROM_UNIXTIME($utime)",
|
||||
mysql_real_escape_string($address,$link),
|
||||
mysql_real_escape_string($comment,$link));
|
||||
@ -96,7 +96,7 @@ if( isset($_POST['address']) ) {
|
||||
} else if(isset($_GET['id'])) {
|
||||
$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);
|
||||
$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);
|
||||
|
||||
if( $ban ) {
|
||||
|
@ -40,13 +40,13 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
|
||||
}
|
||||
|
||||
if( count($errors) == 0 ) {
|
||||
perform_query("delete from " . $mysqlprefix . "chatban where banid = $banId",$link);
|
||||
perform_query("delete from ${mysqlprefix}chatban where banid = $banId",$link);
|
||||
header("Location: $webimroot/operator/blocked.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$result = mysql_query("select banid,unix_timestamp(dtmtill) as till,address,comment from " . $mysqlprefix . "chatban", $link)
|
||||
$result = mysql_query("select banid,unix_timestamp(dtmtill) as till,address,comment from ${mysqlprefix}chatban", $link)
|
||||
or die(' Query failed: ' .mysql_error());
|
||||
|
||||
$blockedList = array();
|
||||
|
@ -34,7 +34,7 @@ $page = array();
|
||||
function load_canned_messages($locale, $groupid) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = "select id, vcvalue from " . $mysqlprefix . "chatresponses ".
|
||||
$query = "select id, vcvalue from ${mysqlprefix}chatresponses ".
|
||||
"where locale = '".$locale."' AND (".
|
||||
($groupid
|
||||
? "groupid = $groupid"
|
||||
@ -47,7 +47,7 @@ function load_canned_messages($locale, $groupid) {
|
||||
$result[] = array('id' => '', 'vcvalue' => $answer);
|
||||
}
|
||||
if(count($result) > 0) {
|
||||
$updatequery = "insert into " . $mysqlprefix . "chatresponses (vcvalue,locale,groupid) values ";
|
||||
$updatequery = "insert into ${mysqlprefix}chatresponses (vcvalue,locale,groupid) values ";
|
||||
for($i=0;$i<count($result);$i++) {
|
||||
if($i > 0) {
|
||||
$updatequery .= ", ";
|
||||
@ -110,7 +110,7 @@ if(isset($_GET['act']) && $_GET['act'] == 'delete') {
|
||||
|
||||
if( count($errors) == 0 ) {
|
||||
$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);
|
||||
header("Location: $webimroot/operator/canned.php?lang=$lang&group=$groupid");
|
||||
exit;
|
||||
|
@ -26,7 +26,7 @@ require_once('../libs/pagination.php');
|
||||
function load_message($key) {
|
||||
global $mysqlprefix;
|
||||
$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);
|
||||
return $result ? $result['vcvalue'] : null;
|
||||
}
|
||||
@ -34,7 +34,7 @@ function load_message($key) {
|
||||
function save_message($key,$message) {
|
||||
global $mysqlprefix;
|
||||
$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);
|
||||
mysql_close($link);
|
||||
}
|
||||
@ -42,7 +42,7 @@ function save_message($key,$message) {
|
||||
function add_message($locale,$groupid,$message) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
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, ").
|
||||
"'".mysql_real_escape_string($message,$link)."')", $link);
|
||||
mysql_close($link);
|
||||
|
@ -33,7 +33,7 @@ function group_by_name($name) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$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);
|
||||
return $group;
|
||||
}
|
||||
@ -42,7 +42,7 @@ function create_group($name,$descr,$commonname,$commondescr) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = sprintf(
|
||||
"insert into " . $mysqlprefix . "chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription) values ('%s','%s','%s','%s')",
|
||||
"insert into ${mysqlprefix}chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription) values ('%s','%s','%s','%s')",
|
||||
mysql_real_escape_string($name),
|
||||
mysql_real_escape_string($descr),
|
||||
mysql_real_escape_string($commonname),
|
||||
@ -51,7 +51,7 @@ function create_group($name,$descr,$commonname,$commondescr) {
|
||||
perform_query($query,$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);
|
||||
return $newdep;
|
||||
}
|
||||
@ -60,7 +60,7 @@ function update_group($groupid,$name,$descr,$commonname,$commondescr) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = sprintf(
|
||||
"update " . $mysqlprefix . "chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s' where groupid = %s",
|
||||
"update ${mysqlprefix}chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s' where groupid = %s",
|
||||
mysql_real_escape_string($name),
|
||||
mysql_real_escape_string($descr),
|
||||
mysql_real_escape_string($commonname),
|
||||
|
@ -28,7 +28,7 @@ $operator = check_login();
|
||||
function get_group_members($groupid) {
|
||||
global $mysqlprefix;
|
||||
$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);
|
||||
mysql_close($link);
|
||||
return $result;
|
||||
@ -37,9 +37,9 @@ function get_group_members($groupid) {
|
||||
function update_group_members($groupid,$newvalue) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
perform_query("delete from " . $mysqlprefix . "chatgroupoperator where groupid = $groupid", $link);
|
||||
perform_query("delete from ${mysqlprefix}chatgroupoperator where groupid = $groupid", $link);
|
||||
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);
|
||||
}
|
||||
@ -48,7 +48,7 @@ function get_operators() {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
|
||||
$query = "select * from " . $mysqlprefix . "chatoperator order by vclogin";
|
||||
$query = "select * from ${mysqlprefix}chatoperator order by vclogin";
|
||||
$result = select_multi_assoc($query, $link);
|
||||
mysql_close($link);
|
||||
return $result;
|
||||
|
@ -38,9 +38,9 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
|
||||
|
||||
if( count($errors) == 0 ) {
|
||||
$link = connect();
|
||||
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);
|
||||
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);
|
||||
header("Location: $webimroot/operator/groups.php");
|
||||
exit;
|
||||
|
@ -36,8 +36,8 @@ $query = isset($_GET['q']) ? myiconv(getoutputenc(), $webim_encoding, $_GET['q']
|
||||
if($query !== false) {
|
||||
$link = connect();
|
||||
|
||||
$result = mysql_query("select " . $mysqlprefix . "chatgroup.groupid as groupid, vclocalname ".
|
||||
"from " . $mysqlprefix . "chatgroup order by vclocalname", $link);
|
||||
$result = mysql_query("select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname ".
|
||||
"from ${mysqlprefix}chatgroup order by vclocalname", $link);
|
||||
$groupName = array();
|
||||
while ($group = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||
$groupName[$group['groupid']] = $group['vclocalname'];
|
||||
@ -46,17 +46,17 @@ if($query !== false) {
|
||||
$page['groupName'] = $groupName;
|
||||
|
||||
$escapedQuery = mysql_real_escape_string($query,$link);
|
||||
select_with_pagintation("DISTINCT unix_timestamp(" . $mysqlprefix . "chatthread.dtmcreated) as created, ".
|
||||
"unix_timestamp(" . $mysqlprefix . "chatthread.dtmmodified) as modified, " . $mysqlprefix . "chatthread.threadid, ".
|
||||
$mysqlprefix . "chatthread.remote, " . $mysqlprefix . "chatthread.agentName, " . $mysqlprefix . "chatthread.userName, groupid, ".
|
||||
select_with_pagintation("DISTINCT unix_timestamp(${mysqlprefix}chatthread.dtmcreated) as created, ".
|
||||
"unix_timestamp(${mysqlprefix}chatthread.dtmmodified) as modified, ${mysqlprefix}chatthread.threadid, ".
|
||||
"${mysqlprefix}chatthread.remote, ${mysqlprefix}chatthread.agentName, ${mysqlprefix}chatthread.userName, groupid, ".
|
||||
"messageCount as size",
|
||||
$mysqlprefix . "chatthread, " . $mysqlprefix . "chatmessage",
|
||||
"${mysqlprefix}chatthread, ${mysqlprefix}chatmessage",
|
||||
array(
|
||||
$mysqlprefix . "chatmessage.threadid = " . $mysqlprefix . "chatthread.threadid",
|
||||
"((" . $mysqlprefix . "chatthread.userName LIKE '%%$escapedQuery%%') or (" . $mysqlprefix . "chatmessage.tmessage LIKE '%%$escapedQuery%%'))"
|
||||
"${mysqlprefix}chatmessage.threadid = ${mysqlprefix}chatthread.threadid",
|
||||
"((${mysqlprefix}chatthread.userName LIKE '%%$escapedQuery%%') or (${mysqlprefix}chatmessage.tmessage LIKE '%%$escapedQuery%%'))"
|
||||
),
|
||||
"order by created DESC",
|
||||
"DISTINCT " . $mysqlprefix . "chatthread.dtmcreated", $link);
|
||||
"DISTINCT ${mysqlprefix}chatthread.dtmcreated", $link);
|
||||
|
||||
mysql_close($link);
|
||||
|
||||
|
@ -33,7 +33,7 @@ function notification_info($id) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$notification = select_one_row(db_build_select(
|
||||
"id, locale, vckind, vcto, unix_timestamp(dtmcreated) as created, vcsubject, tmessage, refoperator", $mysqlprefix . "chatnotification",
|
||||
"id, locale, vckind, vcto, unix_timestamp(dtmcreated) as created, vcsubject, tmessage, refoperator", "${mysqlprefix}chatnotification",
|
||||
array("id = $id"), ""), $link);
|
||||
mysql_close($link);
|
||||
return $notification;
|
||||
|
@ -65,7 +65,7 @@ if($lang) {
|
||||
|
||||
$link = connect();
|
||||
select_with_pagintation(
|
||||
"id, locale, vckind, vcto, unix_timestamp(dtmcreated) as created, vcsubject, tmessage, refoperator", $mysqlprefix . "chatnotification",
|
||||
"id, locale, vckind, vcto, unix_timestamp(dtmcreated) as created, vcsubject, tmessage, refoperator", "${mysqlprefix}chatnotification",
|
||||
$conditions,
|
||||
"order by created desc", "", $link);
|
||||
|
||||
|
@ -50,8 +50,8 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
|
||||
|
||||
if( count($errors) == 0 ) {
|
||||
$link = connect();
|
||||
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}chatgroupoperator where operatorid = $operatorid",$link);
|
||||
perform_query("delete from ${mysqlprefix}chatoperator where operatorid = $operatorid",$link);
|
||||
mysql_close($link);
|
||||
|
||||
header("Location: $webimroot/operator/operators.php");
|
||||
|
@ -28,9 +28,9 @@ $operator = check_login();
|
||||
function update_operator_groups($operatorid,$newvalue) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
perform_query("delete from " . $mysqlprefix . "chatgroupoperator where operatorid = $operatorid", $link);
|
||||
perform_query("delete from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid", $link);
|
||||
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);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ $operator = check_login();
|
||||
function update_operator_permissions($operatorid,$newvalue) {
|
||||
global $mysqlprefix;
|
||||
$link = connect();
|
||||
$query = "update " . $mysqlprefix . "chatoperator set iperm = $newvalue where operatorid = $operatorid";
|
||||
$query = "update ${mysqlprefix}chatoperator set iperm = $newvalue where operatorid = $operatorid";
|
||||
|
||||
perform_query($query,$link);
|
||||
mysql_close($link);
|
||||
@ -62,8 +62,8 @@ if( !$op ) {
|
||||
if(count($errors) == 0) {
|
||||
update_operator_permissions($op['operatorid'],$new_permissions);
|
||||
|
||||
if ($opId && $_SESSION[$mysqlprefix . 'operator'] && $operator['operatorid'] == $opId) {
|
||||
$_SESSION[$mysqlprefix . 'operator']['iperm'] = $new_permissions;
|
||||
if ($opId && $_SESSION["${mysqlprefix}operator"] && $operator['operatorid'] == $opId) {
|
||||
$_SESSION["${mysqlprefix}operator"]['iperm'] = $new_permissions;
|
||||
}
|
||||
header("Location: $webimroot/operator/permissions.php?op=$opId&stored");
|
||||
exit;
|
||||
|
@ -69,7 +69,7 @@ if(isset($_GET['nextGroup'])) {
|
||||
$link = connect();
|
||||
$threadupdate = array("istate" => $state_waiting, "nextagent" => $nextid, "agentId" => 0);
|
||||
if($thread['groupid'] != 0) {
|
||||
if(FALSE === select_one_row("select groupid from " . $mysqlprefix . "chatgroupoperator where operatorid = $nextid and groupid = ".$thread['groupid'], $link)) {
|
||||
if(FALSE === select_one_row("select groupid from ${mysqlprefix}chatgroupoperator where operatorid = $nextid and groupid = ".$thread['groupid'], $link)) {
|
||||
$threadupdate['groupid'] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ if (count($errors) == 0 && isset($_POST['password'])) {
|
||||
$page['isdone'] = true;
|
||||
|
||||
$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);
|
||||
mysql_close($link);
|
||||
|
||||
|
@ -45,7 +45,7 @@ if (isset($_POST['loginoremail'])) {
|
||||
$token = md5((time() + microtime()).rand(0,99999999));
|
||||
|
||||
$link = connect();
|
||||
$query = "update " . $mysqlprefix . "chatoperator set dtmrestore = CURRENT_TIMESTAMP, vcrestoretoken = '$token' where operatorid = ".$torestore['operatorid'];
|
||||
$query = "update ${mysqlprefix}chatoperator set dtmrestore = CURRENT_TIMESTAMP, vcrestoretoken = '$token' where operatorid = ".$torestore['operatorid'];
|
||||
perform_query($query, $link);
|
||||
|
||||
$href = get_app_location(true,false)."/operator/resetpwd.php?id=".$torestore['operatorid']."&token=$token";
|
||||
|
@ -69,14 +69,14 @@ if( $start > $end ) {
|
||||
|
||||
$link = connect();
|
||||
|
||||
$page['reportByDate'] = select_multi_assoc("select DATE(dtmcreated) as date, COUNT(distinct threadid) as threads, SUM(" . $mysqlprefix . "chatmessage.ikind = $kind_agent) as agents, SUM(" . $mysqlprefix . "chatmessage.ikind = $kind_user) as users ".
|
||||
"from " . $mysqlprefix . "chatmessage where unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end group by DATE(dtmcreated) order by dtmcreated desc", $link);
|
||||
$page['reportByDate'] = select_multi_assoc("select DATE(dtmcreated) as date, COUNT(distinct threadid) as threads, SUM(${mysqlprefix}chatmessage.ikind = $kind_agent) as agents, SUM(${mysqlprefix}chatmessage.ikind = $kind_user) as users ".
|
||||
"from ${mysqlprefix}chatmessage where unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end group by DATE(dtmcreated) order by dtmcreated desc", $link);
|
||||
|
||||
$page['reportByDateTotal'] = select_one_row("select COUNT(distinct threadid) as threads, SUM(" . $mysqlprefix . "chatmessage.ikind = $kind_agent) as agents, SUM(" . $mysqlprefix . "chatmessage.ikind = $kind_user) as users ".
|
||||
"from " . $mysqlprefix . "chatmessage where unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end", $link);
|
||||
$page['reportByDateTotal'] = select_one_row("select COUNT(distinct threadid) as threads, SUM(${mysqlprefix}chatmessage.ikind = $kind_agent) as agents, SUM(${mysqlprefix}chatmessage.ikind = $kind_user) as users ".
|
||||
"from ${mysqlprefix}chatmessage where unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end", $link);
|
||||
|
||||
$page['reportByAgent'] = select_multi_assoc("select vclocalename as name, COUNT(distinct threadid) as threads, SUM(ikind = $kind_agent) as msgs, AVG(CHAR_LENGTH(tmessage)) as avglen ".
|
||||
"from " . $mysqlprefix . "chatmessage, " . $mysqlprefix . "chatoperator ".
|
||||
"from ${mysqlprefix}chatmessage, ${mysqlprefix}chatoperator ".
|
||||
"where agentId = operatorid AND unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end group by operatorid", $link);
|
||||
|
||||
$page['showresults'] = count($errors) == 0;
|
||||
|
@ -37,7 +37,7 @@ function thread_info($id) {
|
||||
$thread = select_one_row("select userName,agentName,remote,userAgent,".
|
||||
"unix_timestamp(dtmmodified) as modified, unix_timestamp(dtmcreated) as created,".
|
||||
"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 );
|
||||
mysql_close($link);
|
||||
return $thread;
|
||||
|
@ -50,9 +50,9 @@ $threadstate_key = array(
|
||||
);
|
||||
|
||||
function thread_to_xml($thread,$link) {
|
||||
global $state_chatting, $threadstate_to_string, $threadstate_key, $mysqlprefix,
|
||||
global $state_chatting, $threadstate_to_string, $threadstate_key,
|
||||
$webim_encoding, $operator, $settings,
|
||||
$can_viewthreads, $can_takeover;
|
||||
$can_viewthreads, $can_takeover, $mysqlprefix;
|
||||
$state = $threadstate_to_string[$thread['istate']];
|
||||
$result = "<thread id=\"".$thread['threadid']."\" stateid=\"$state\"";
|
||||
if( $state == "closed" )
|
||||
@ -101,7 +101,7 @@ function thread_to_xml($thread,$link) {
|
||||
$userAgent = get_useragent_version($thread['userAgent']);
|
||||
$result .= "<useragent>".$userAgent."</useragent>";
|
||||
if( $thread["shownmessageid"] != 0 ) {
|
||||
$query = "select tmessage from " . $mysqlprefix . "chatmessage where messageid = ".$thread["shownmessageid"];
|
||||
$query = "select tmessage from ${mysqlprefix}chatmessage where messageid = ".$thread["shownmessageid"];
|
||||
$line = select_one_row($query, $link);
|
||||
if( $line ) {
|
||||
$message = preg_replace("/[\r\n\t]+/", " ", $line["tmessage"]);
|
||||
@ -119,8 +119,8 @@ function print_pending_threads($groupids,$since) {
|
||||
$revision = $since;
|
||||
$output = array();
|
||||
$query = "select threadid, userName, agentName, unix_timestamp(dtmcreated), userTyping, ".
|
||||
"unix_timestamp(dtmmodified), lrevision, istate, remote, nextagent, agentId, userid, shownmessageid, userAgent, (select vclocalname from " . $mysqlprefix . "chatgroup where " . $mysqlprefix . "chatgroup.groupid = " . $mysqlprefix . "chatthread.groupid) as groupname ".
|
||||
"from " . $mysqlprefix . "chatthread where lrevision > $since ".
|
||||
"unix_timestamp(dtmmodified), lrevision, istate, remote, nextagent, agentId, userid, shownmessageid, userAgent, (select vclocalname from ${mysqlprefix}chatgroup where ${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatthread.groupid) as groupname ".
|
||||
"from ${mysqlprefix}chatthread where lrevision > $since ".
|
||||
($since <= 0
|
||||
? "AND istate <> $state_closed AND istate <> $state_left "
|
||||
: "").
|
||||
@ -151,8 +151,7 @@ function print_pending_threads($groupids,$since) {
|
||||
function print_operators() {
|
||||
echo "<operators>";
|
||||
$operators = operator_get_all();
|
||||
$names = array();
|
||||
|
||||
|
||||
foreach($operators as $operator) {
|
||||
if (!operator_is_online($operator))
|
||||
continue;
|
||||
|
@ -46,7 +46,7 @@ function threads_by_userid($userid) {
|
||||
|
||||
$query = sprintf("select unix_timestamp(dtmcreated) as created, unix_timestamp(dtmmodified) as modified, ".
|
||||
" threadid, remote, agentName, userName ".
|
||||
"from " . $mysqlprefix . "chatthread ".
|
||||
"from ${mysqlprefix}chatthread ".
|
||||
"where userid=\"$userid\" order by created DESC", $userid);
|
||||
|
||||
$result = mysql_query($query, $link) or die(' Query failed: ' .mysql_error().": ".$query);
|
||||
|
Loading…
Reference in New Issue
Block a user