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'] : "-"); if ($threadoperator == "-" && $thread['groupname']) { $threadoperator = "- " . $thread['groupname'] . " -"; } if (!($thread['istate'] == $state_chatting && $thread['agentId'] != $operator['operatorid'] && !is_capable($can_takeover, $operator))) { $result .= " canopen=\"true\""; } if ($thread['agentId'] != $operator['operatorid'] && $thread['nextagent'] != $operator['operatorid'] && is_capable($can_viewthreads, $operator)) { $result .= " canview=\"true\""; } if ($settings['enableban'] == "1") { $result .= " canban=\"true\""; } $banForThread = $settings['enableban'] == "1" ? ban_for_addr_($thread['remote'], $link) : false; if ($banForThread) { $result .= " ban=\"blocked\" banid=\"" . safe_htmlspecialchars(safe_htmlspecialchars($banForThread['banid'])) . "\""; } $result .= " state=\"{$state}\" typing=\"" . safe_htmlspecialchars(safe_htmlspecialchars($thread['userTyping'])) . "\">"; $result .= "<name>"; if ($banForThread) { $result .= safe_htmlspecialchars(getstring('chat.client.spam.prefix')); } $result .= safe_htmlspecialchars(safe_htmlspecialchars(get_user_name($thread['userName'], $thread['remote'], $thread['userid']))) . "</name>"; $result .= "<addr>" . safe_htmlspecialchars(get_user_addr($thread['remote'])) . "</addr>"; $result .= "<agent>" . safe_htmlspecialchars(safe_htmlspecialchars($threadoperator)) . "</agent>"; $result .= "<time>" . safe_htmlspecialchars(safe_htmlspecialchars($thread['unix_timestamp(dtmcreated)'])) . "000</time>"; $result .= "<modified>" . safe_htmlspecialchars(safe_htmlspecialchars($thread['unix_timestamp(dtmmodified)'])) . "000</modified>"; if ($banForThread) { $result .= "<reason>" . safe_htmlspecialchars(safe_htmlspecialchars($banForThread['comment'])) . "</reason>"; } $userAgent = get_useragent_version($thread['userAgent']); $result .= "<useragent>" . safe_htmlspecialchars($userAgent) . "</useragent>"; if ($thread["shownmessageid"] != 0) { $query = "select tmessage from {$mysqlprefix}chatmessage where messageid = " . intval($thread["shownmessageid"]); $line = select_one_row($query, $link); if ($line) { $message = preg_replace("/[\r\n\t]+/", " ", $line["tmessage"]); $result .= "<message>" . safe_htmlspecialchars(safe_htmlspecialchars($message)) . "</message>"; } } $result .= "</thread>"; return $result; }
function tpl_content() { global $page, $webimroot, $errors; $chatthread = $page['thread']; ?> <?php echo getlocal("thread.intro"); ?> <br/><br/> <div class="logpane"> <div class="header"> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_name"); ?> : </div> <div class="wvalue"> <?php echo topage(htmlspecialchars($chatthread['userName'])); ?> </div> <br clear="all"/> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_host"); ?> : </div> <div class="wvalue"> <?php echo get_user_addr(topage($chatthread['remote'])); ?> </div> <br clear="all"/> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_browser"); ?> : </div> <div class="wvalue"> <?php echo get_useragent_version(topage($chatthread['userAgent'])); ?> </div> <br clear="all"/> <?php if ($chatthread['groupName']) { ?> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_group"); ?> : </div> <div class="wvalue"> <?php echo topage(htmlspecialchars($chatthread['groupName'])); ?> </div> <br clear="all"/> <?php } ?> <?php if ($chatthread['agentName']) { ?> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_operator"); ?> : </div> <div class="wvalue"> <?php echo topage(htmlspecialchars($chatthread['agentName'])); ?> </div> <br clear="all"/> <?php } ?> <div class="wlabel"> <?php echo getlocal("page.analysis.search.head_time"); ?> : </div> <div class="wvalue"> <?php echo date_diff_to_text($chatthread['modified'] - $chatthread['created']); ?> (<?php echo date_to_text($chatthread['created']); ?> ) </div> <br clear="all"/> </div> <div class="message"> <?php foreach ($page['threadMessages'] as $message) { echo $message; } ?> </div> </div> <br /> <a href="<?php echo $webimroot; ?> /operator/history.php"> <?php echo getlocal("thread.back_to_search"); ?> </a> <br /> <?php }
/** * Generates a page with a user history. * * @param Request $request * @return string Rendered page content */ public function userAction(Request $request) { $operator = $this->getOperator(); $user_id = $request->attributes->get('user_id', ''); $page = array(); if (!empty($user_id)) { $db = Database::getInstance(); $query = "SELECT {thread}.* " . "FROM {thread} " . "WHERE userid=:user_id " . "AND (invitationstate = :invitation_accepted " . "OR invitationstate = :invitation_not_invited) " . "ORDER BY dtmcreated DESC"; $found = $db->query($query, array(':user_id' => $user_id, ':invitation_accepted' => Thread::INVITATION_ACCEPTED, ':invitation_not_invited' => Thread::INVITATION_NOT_INVITED), array('return_rows' => Database::RETURN_ALL_ROWS)); } else { $found = null; } $page = array_merge($page, prepare_menu($operator)); // Setup pagination $pagination = setup_pagination($found, 6); $page['pagination'] = $pagination['info']; $page['pagination.items'] = $pagination['items']; if (!empty($page['pagination.items'])) { foreach ($page['pagination.items'] as $key => $item) { $thread = Thread::createFromDbInfo($item); $page['pagination.items'][$key] = array('threadId' => $thread->id, 'userName' => $thread->userName, 'userAddress' => get_user_addr($thread->remote), 'agentName' => $thread->agentName, 'chatTime' => $thread->modified - $thread->created, 'chatCreated' => $thread->created); } } $page['title'] = getlocal("Visit history"); $page['menuid'] = "history"; return $this->render('history_user', $page); }
function tpl_content() { global $page, $mibewroot; ?> <?php echo getlocal("page_search.intro"); ?> <br /> <br /> <form name="searchForm" method="get" action="<?php echo $mibewroot; ?> /operator/history.php"> <div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner"> <div class="fieldForm"> <div class="field"> <div class="flabel"><?php echo getlocal("page_analysis.full.text.search"); ?> </div> <div class="fvaluenodesc"> <div id="searchtext"> <input type="text" name="q" size="80" value="<?php echo form_value('q'); ?> " class="formauth"/> </div> <div id="searchbutton"> <input type="image" name="search" src="<?php echo $mibewroot . safe_htmlspecialchars(getlocal("image.button.search")); ?> " alt="<?php echo safe_htmlspecialchars(getlocal("button.search")); ?> "/> </div> </div> <br clear="all"/> </div> </div> </div><div class="formbottom"><div class="formbottomi"></div></div></div> </form> <br/> <?php if ($page['pagination']) { ?> <table class="list"> <thead> <tr class="header"> <th> <?php echo getlocal("page.analysis.search.head_name"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_host"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_operator"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_messages"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_time"); ?> </th></tr> </thead> <tbody> <?php if ($page['pagination.items']) { foreach ($page['pagination.items'] as $chatthread) { ?> <tr> <td> <a href="<?php echo $mibewroot; ?> /operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']); ?> " target="_blank" onclick="this.newWindow = window.open('<?php echo $mibewroot; ?> /operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']); ?> ', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php echo topage(safe_htmlspecialchars($chatthread['userName'])); ?> </a> </td> <td> <?php echo get_user_addr(topage($chatthread['remote'])); ?> </td> <td> <?php if ($chatthread['agentName']) { echo topage(safe_htmlspecialchars($chatthread['agentName'])); } else { if ($chatthread['groupid'] && $chatthread['groupid'] != 0 && isset($page['groupName'][$chatthread['groupid']])) { echo "- " . topage(safe_htmlspecialchars($page['groupName'][$chatthread['groupid']])) . " -"; } } ?> </td> <td> <?php echo topage(safe_htmlspecialchars($chatthread['size'])); ?> </td> <td> <?php echo date_diff_to_text($chatthread['modified'] - $chatthread['created']); ?> , <?php echo date_to_text($chatthread['created']); ?> </td> </tr> <?php } } else { ?> <tr> <td colspan="5"> <?php echo getlocal("tag.pagination.no_items"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php if ($page['pagination.items']) { echo "<br/>"; echo generate_pagination($page['pagination']); } } ?> <?php }
function tpl_content() { global $page, $mibewroot; ?> <?php echo getlocal("page.analysis.userhistory.intro"); ?> <br /> <br /> <?php if ($page['pagination']) { ?> <table class="list"> <thead> <tr class="header"> <th> <?php echo getlocal("page.analysis.search.head_name"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_host"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_operator"); ?> </th><th> <?php echo getlocal("page.analysis.search.head_time"); ?> </th></tr> </thead> <tbody> <?php if ($page['pagination.items']) { foreach ($page['pagination.items'] as $chatthread) { ?> <tr> <td> <a href="<?php echo $mibewroot; ?> /operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']); ?> " target="_blank" onclick="this.newWindow = window.open('<?php echo $mibewroot; ?> /operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']); ?> ', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php echo topage(safe_htmlspecialchars($chatthread['userName'])); ?> </a> </td> <td> <?php echo get_user_addr(topage($chatthread['remote'])); ?> </td> <td> <?php if ($chatthread['agentName']) { echo topage(safe_htmlspecialchars($chatthread['agentName'])); } ?> </td> <td> <?php echo date_diff_to_text($chatthread['modified'] - $chatthread['created']); ?> , <?php echo date_to_text($chatthread['created']); ?> </td> </tr> <?php } } else { ?> <tr> <td colspan="5"> <?php echo getlocal("tag.pagination.no_items"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php if ($page['pagination.items']) { echo "<br/>"; echo generate_pagination($page['pagination']); } } ?> <?php }