コード例 #1
0
ファイル: demothread.php プロジェクト: paulcn/mibew
function demo_print_message($msg, $format)
{
    global $webim_encoding;
    if ($format == "xml") {
        print "<message>" . myiconv($webim_encoding, "utf-8", escape_with_cdata(message_to_html($msg))) . "</message>\n";
    } else {
        print topage(message_to_html($msg));
    }
}
コード例 #2
0
ファイル: onsite.php プロジェクト: Nikitian/fl-ru-damp
<?php

/* 
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.thread.php';
$operator = Operator::getInstance()->GetLoggedOperator(false);
// папка online в мэмкэш --------------------
//touch_online_file(OPERATOR_VIEW_TRACKER_FILE);
$mem_buff->set('OPERATOR_VIEW_TRACKER_FILE', time(), 1800);
if (!$operator) {
    Browser::SendXmlHeaders();
    echo "<error><descr>" . escape_with_cdata(getstring("agent.not_logged_in")) . "</descr></error>";
    exit;
}
$xml = Thread::getInstance()->BuildVisitorsXml();
Browser::SendXmlHeaders();
echo $xml;
コード例 #3
0
ファイル: chat.php プロジェクト: laiello/cartonbank
function get_messages($threadid, $meth, $isuser, &$lastid)
{
    global $kind_for_agent, $kind_avatar, $webim_encoding, $mysqlprefix;
    $link = connect();
    $query = sprintf("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}" : "");
    $messages = array();
    $msgs = select_multi_assoc($query, $link);
    foreach ($msgs as $msg) {
        $message = "";
        if ($meth == 'xml') {
            switch ($msg['ikind']) {
                case $kind_avatar:
                    $message = "<avatar>" . myiconv($webim_encoding, "utf-8", escape_with_cdata($msg['tmessage'])) . "</avatar>";
                    break;
                default:
                    $message = "<message>" . myiconv($webim_encoding, "utf-8", escape_with_cdata(message_to_html($msg))) . "</message>\n";
            }
        } else {
            if ($msg['ikind'] != $kind_avatar) {
                $message = $meth == 'text' ? message_to_text($msg) : topage(message_to_html($msg));
            }
        }
        $messages[] = $message;
        if ($msg['messageid'] > $lastid) {
            $lastid = $msg['messageid'];
        }
    }
    mysql_close($link);
    return $messages;
}
コード例 #4
0
ファイル: onsite.php プロジェクト: kapai69/fl-ru-damp
<?php

/* 
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.thread.php';
$operator = Operator::getInstance()->GetLoggedOperator(false);
// папка online в мэмкэш --------------------
//touch_online_file(OPERATOR_VIEW_TRACKER_FILE);
$mem_buff->set('OPERATOR_VIEW_TRACKER_FILE', time(), 1800);
if (!$operator) {
    Browser::SendXmlHeaders();
    echo '<error><descr>' . escape_with_cdata(getstring('agent.not_logged_in')) . '</descr></error>';
    exit;
}
$xml = Thread::getInstance()->BuildVisitorsXml();
Browser::SendXmlHeaders();
echo $xml;
コード例 #5
0
ファイル: update.php プロジェクト: kuell/chat
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once '../libs/common.php';
require_once '../libs/chat.php';
require_once '../libs/userinfo.php';
require_once '../libs/operator.php';
require_once '../libs/groups.php';
$operator = get_logged_in();
if (!$operator) {
    start_xml_output();
    echo "<error><descr>" . escape_with_cdata(safe_htmlspecialchars(myiconv($mibew_encoding, "utf-8", getstring("agent.not_logged_in")))) . "</descr></error>";
    exit;
}
$threadstate_to_string = array($state_queue => "wait", $state_waiting => "prio", $state_chatting => "chat", $state_closed => "closed", $state_loading => "wait", $state_left => "closed");
$threadstate_key = array($state_queue => "chat.thread.state_wait", $state_waiting => "chat.thread.state_wait_for_another_agent", $state_chatting => "chat.thread.state_chatting_with_agent", $state_closed => "chat.thread.state_closed", $state_loading => "chat.thread.state_loading");
function thread_to_xml($thread, $link)
{
    global $state_chatting, $threadstate_to_string, $threadstate_key, $mibew_encoding, $operator, $settings, $can_viewthreads, $can_takeover, $mysqlprefix;
    $state = $threadstate_to_string[$thread['istate']];
    $result = "<thread id=\"" . safe_htmlspecialchars(safe_htmlspecialchars($thread['threadid'])) . "\" stateid=\"{$state}\"";
    if ($state == "closed") {
        return $result . "/>";
    }
    $state = getstring($threadstate_key[$thread['istate']]);
    $nextagent = $thread['nextagent'] != 0 ? operator_by_id_($thread['nextagent'], $link) : null;
    $threadoperator = $nextagent ? get_operator_name($nextagent) : ($thread['agentName'] ? $thread['agentName'] : "-");
コード例 #6
0
ファイル: update.php プロジェクト: laiello/cartonbank
 * not to allow others to use your version of this file under the terms of the
 * EPL, indicate your decision by deleting the provisions above and replace them
 * with the notice and other provisions required by the GPL.
 * 
 * Contributors:
 *    Evgeny Gryaznov - initial API and implementation
 */
require_once '../libs/common.php';
require_once '../libs/chat.php';
require_once '../libs/userinfo.php';
require_once '../libs/operator.php';
require_once '../libs/groups.php';
$operator = get_logged_in();
if (!$operator) {
    start_xml_output();
    echo "<error><descr>" . myiconv($webim_encoding, "utf-8", escape_with_cdata(getstring("agent.not_logged_in"))) . "</descr></error>";
    exit;
}
$threadstate_to_string = array($state_queue => "wait", $state_waiting => "prio", $state_chatting => "chat", $state_closed => "closed", $state_loading => "wait", $state_left => "closed");
$threadstate_key = array($state_queue => "chat.thread.state_wait", $state_waiting => "chat.thread.state_wait_for_another_agent", $state_chatting => "chat.thread.state_chatting_with_agent", $state_closed => "chat.thread.state_closed", $state_loading => "chat.thread.state_loading");
function thread_to_xml($thread, $link)
{
    global $state_chatting, $threadstate_to_string, $threadstate_key, $webim_encoding, $operator, $settings, $can_viewthreads, $can_takeover, $mysqlprefix;
    $state = $threadstate_to_string[$thread['istate']];
    $result = "<thread id=\"" . $thread['threadid'] . "\" stateid=\"{$state}\"";
    if ($state == "closed") {
        return $result . "/>";
    }
    $state = getstring($threadstate_key[$thread['istate']]);
    $nextagent = $thread['nextagent'] != 0 ? operator_by_id_($thread['nextagent'], $link) : null;
    $threadoperator = $nextagent ? get_operator_name($nextagent) : ($thread['agentName'] ? $thread['agentName'] : "-");