本文整理汇总了PHP中Thread::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Thread::getInstance方法的具体用法?PHP Thread::getInstance怎么用?PHP Thread::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thread
的用法示例。
在下文中一共展示了Thread::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SmartyClass
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
require_once '../classes/functions.php';
require_once '../classes/class.thread.php';
require_once '../classes/class.department.php';
require_once '../classes/class.smartyclass.php';
$TML = new SmartyClass();
$operator = Operator::getInstance()->GetLoggedOperator();
$threadid = verify_param("thread", "/^\\d{1,8}\$/");
$token = verify_param("token", "/^\\d{1,8}\$/");
$thread = Thread::getInstance()->GetThreadById($threadid);
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
$TML->assign('visit_session', $visitSession);
if (!$thread || !isset($thread['token']) || $token != $thread['token']) {
die("wrong thread");
}
$nextid = verify_param("nextoperatorid", "/^\\d{1,8}\$/");
$nextdepartmentid = verify_param("nextdepartmentid", "/^\\d{1,8}\$/");
$page = array();
if (!empty($nextid)) {
$nextOperator = Operator::getInstance()->GetOperatorById($nextid);
$TML->assign('nextoperator', $nextOperator);
}
if (!empty($nextdepartmentid)) {
$nextdepartment = Department::getInstance()->getById($nextdepartmentid, Resources::getCurrentLocale());
$TML->assign('nextdepartment', $nextdepartment);
示例2: updateThreadState
private function updateThreadState($threadid, $state)
{
$hash = array('state' => $state);
Thread::getInstance()->CommitThread($threadid, $hash);
}
示例3: isset
}
VisitSession::GetInstance()->setVisitSessionCurrentPage($visitor['id'], $referer, $referer_title);
if($user_in_chat) {
if(empty($referer_title)) {
$referer_title = Resources::Get("chat.visited_page.no_title");
}
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "";
if (empty($visitor)) {
return;
}
Thread::getInstance()->SendVisitedPageForOpenThreads($visitor['id'], $referer, $referer_title);
}
header('Content-type: text/javascript; charset='.BROWSER_CHARSET);
?>
var rules = [
<?php
$rules = MapperFactory::getMapper("AutoInvite")->getAll();
foreach ($rules as $rule):
if(WEBIM_ENCODING != 'UTF-8') {
$rule['text'] = smarticonv('cp1251', 'utf-8', $rule['text']);
}
?>
{
示例4: verify_param
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
require_once 'classes/common.php';
require_once 'classes/class.thread.php';
require_once 'classes/class.visitsession.php';
require_once 'classes/class.visitedpage.php';
require_once 'classes/class.invitation.php';
require_once 'classes/class.operator.php';
require_once 'classes/class.smartyclass.php';
$pageId = verify_param("pageid", "/^[a-z0-9]{32}\$/");
$isSecure = verify_param("issecure", "/^\\d+\$/", 0) == 1;
$visitSession = VisitSession::GetInstance()->GetVisitSessionByPageId($pageId);
$invitation = Invitation::GetInstance()->GetInvitationByVisitedPageId($pageId);
$thread = Thread::getInstance()->GetThreadById($invitation['threadid']);
$message = getInvitationMessage($invitation);
// set invitation parameters
$p_location = get_app_location(true, $isSecure);
$p_theme = Browser::getCurrentTheme();
$p_message = $message . " <img src=\"{$p_location}/themes/{$p_theme}/images/invite/bullet5.gif\"/>";
$p_sound = $p_location . "/sounds/default_invite.wav";
$p_hideanim = $p_location . "/track.php?issecure={$isSecure}&";
$p_level = Browser::GetRemoteLevel($visitSession['useragent']);
$p_threadid = $thread['threadid'];
$p_token = $thread['token'];
$p_pageid = $pageId;
$p_lang = WEBIM_CURRENT_LOCALE;
$p_invitation = getInvitationContent(getAvatar($thread['operatorid']), $message, $isSecure);
$p_amination_duration = INVITE_ANIMATION_DURATION;
header('Content-type: text/javascript; charset=' . BROWSER_CHARSET);
示例5: verify_param
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
require_once '../classes/functions.php';
require_once '../classes/class.thread.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.visitsession.php';
require_once '../classes/class.visitedpage.php';
require_once '../classes/class.invitation.php';
$operator = Operator::getInstance()->GetLoggedOperator();
$pageId = verify_param('pageid', '/^([a-z0-9]{32})?$/', '');
if (empty($pageId)) {
die('invalid or absent pageid');
}
$visitSession = VisitSession::GetInstance()->GetVisitSessionByPageId($pageId);
$remoteLevel = Browser::GetRemoteLevel($visitSession['useragent']);
$thread = VisitedPage::GetInstance()->GetInvitationThread($pageId);
if (empty($thread) || $thread['state'] == STATE_CLOSED) {
$thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_INVITE, array('operatorfullname' => $operator['fullname'], 'operatorid' => $operator['operatorid'], 'visitsessionid' => $visitSession['visitsessionid']));
VisitSession::GetInstance()->UpdateVisitSession($visitSession['visitsessionid'], array('hasthread' => 1));
$introMessage = Resources::Get('invite.intro.message', array($visitSession['visitorname']), WEBIM_CURRENT_LOCALE);
Thread::getInstance()->PostMessage($thread['threadid'], KIND_FOR_AGENT, $introMessage);
$invitationId = Invitation::getInstance()->CreateInvitation($thread['threadid']);
VisitedPage::GetInstance()->UpdateVisitedPage($pageId, array('invitationid' => $invitationId));
}
header('Location: ' . WEBIM_ROOT . '/operator/agent.php?thread=' . $thread['threadid'] . '&token=' . $thread['token'] . '&level=' . $remoteLevel . '&force=false');
exit;
示例6: time
<?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;
示例7: handleWithoutToken
function handleWithoutToken($threadid, $viewonly)
{
$TML = new SmartyClass();
$operator = Operator::getInstance()->GetLoggedOperator();
$remote_level = Browser::GetRemoteLevel($_SERVER['HTTP_USER_AGENT']);
if ($remote_level != "ajaxed") {
die("old browser is used, please update it");
}
$thread = Thread::getInstance()->GetThreadById($threadid);
if (!$thread || !isset($thread['token'])) {
die("wrong thread");
}
if ($viewonly && $operator['operatorid'] != $thread['operatorid']) {
redirectToPageWithToken($thread, $viewonly, $remote_level);
}
$forcetake = verify_param("force", "/^true\$/", false);
if ($forcetake) {
ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'operator_force_join', array("operatorid" => $operator["operatorid"]));
redirectToPageWithToken($thread, null, $remote_level);
} else {
// is taken by another
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
if ($thread['state'] != STATE_CLOSED && !empty($thread['operatorid']) && $operator['operatorid'] != $thread['operatorid'] && $operator['operatorid'] != $thread['nextoperatorid']) {
$page = array('visitor' => $visitSession['visitorname'], 'agent' => $thread['operatorfullname'], 'force' => true, 'takelink' => $_SERVER['PHP_SELF'] . "?thread={$threadid}&force=true", 'viewlink' => $_SERVER['PHP_SELF'] . "?thread={$threadid}&viewonly=true", 'priority' => $thread['state'] == STATE_QUEUE_EXACT_OPERATOR || $thread['state'] == STATE_CHATTING_OPERATOR_BROWSER_CLOSED_REFRESHED);
// TODO get rid of STATE_WAIT_ANOTHER_OPERATOR
$TML->assign('link_arguments', "&thread={$threadid}");
$TML->assign('page', $page);
$TML->display('confirm.tpl');
exit;
}
// is closed
if ($thread['state'] == STATE_CLOSED) {
$page = array('viewlink' => $_SERVER['PHP_SELF'] . "?thread=" . $threadid . "&viewonly=true", 'force' => false, 'thread_id' => $threadid, 'closed' => true);
$TML->assign('link_arguments', "&thread={$threadid}");
$TML->assign('page', $page);
$TML->display('confirm.tpl');
exit;
}
}
ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'operator_join', array('operatorid' => $operator['operatorid']));
redirectToPageWithToken($thread, $viewonly, $remote_level);
}
示例8: verify_param
$endmonth = verify_param('endmonth', "/^\\d{2}.\\d{2}\$/");
$start = get_form_date($startday, $startmonth);
$end = get_form_date($endday, $endmonth) + 24 * 60 * 60;
$offlineParam = verify_param('offline', "/^\\d+\$/");
if ($offlineParam !== null) {
$offlineParam = $offlineParam == 1 ? 0 : 1;
}
if ($start > $end) {
$errors[] = Resources::Get('search.wrong.dates');
} else {
$nTotal = Thread::getInstance()->GetListThreadsAdvCount($operator['operatorid'], $q, $start, $end, $op_param, $show_empty, $departmentidParam, $localeParam, $rateParam, $offlineParam);
if ($nTotal) {
$pagination = setup_pagination_cnt($nTotal, $items_per_page);
$nLimit = $pagination['items'];
$nOffset = $pagination['start'];
$threads = Thread::getInstance()->GetListThreadsAdv($operator['operatorid'], $q, $start, $end, $op_param, $show_empty, $departmentidParam, $localeParam, $rateParam, $offlineParam, $nLimit, $nOffset);
$tmlPage['pagination'] = $pagination;
$tmlPage['pagination_items'] = $threads;
if (!empty($tmlPage['pagination_items'])) {
for ($i = 0; $i < count($tmlPage['pagination_items']); ++$i) {
$tmlPage['pagination_items'][$i]['diff'] = webim_date_diff($tmlPage['pagination_items'][$i]['modified'] - $tmlPage['pagination_items'][$i]['created']);
}
$TML->assign('pagination', generate_pagination($tmlPage['pagination']));
}
}
$tmlPage['formq'] = $q;
$tmlPage['formoperator'] = $op_param;
$tmlPage['formstartday'] = date('d', $start);
$tmlPage['formstartmonth'] = date('m.y', $start);
$tmlPage['formendday'] = date('d', $end - 24 * 60 * 60);
$tmlPage['formendmonth'] = date('m.y', $end - 24 * 60 * 60);
示例9: getSecureText
$TML->assign('phone', getSecureText($phone));
$TML->assign('message', getSecureText($message));
$TML->assign('canChangeName', getSecureText($canChangeName));
$TML->assign('captcha_num', '');
$TML->display('leave-message.tpl');
exit;
}
$visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession();
$params = array();
$params['visitsessionid'] = $visitSessionId;
$params['lastpingvisitor'] = null;
$params['offline'] = 1;
$threads_count = MapperFactory::getMapper('Thread')->getNonEmptyThreadsCountByVisitorId($visitorid);
$thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_CLOSED, $params);
VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1));
Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread);
Thread::getInstance()->PostMessage($thread['threadid'], KIND_USER, Resources::Get('chat.window.offline_message', array($message)));
MapperFactory::getMapper('Thread')->incrementVisitorMessageCount($thread['threadid']);
$first_message = MapperFactory::getMapper('Message')->getFirstMessage($thread['threadid']);
Visitor::getInstance()->setVisitorNameCookie($visitor_name);
// отправке диалогов из мессенджера
$subject = $dept && isset($aDko[$dept]['subject']) ? $subject = $aDko[$dept]['subject'] : Resources::Get('leavemail.subject', array($visitor_name), WEBIM_CURRENT_LOCALE);
$body = Resources::Get('leavemail.body', array($visitor_name, $email, $message, $phone, Thread::getInstance()->formatOpenerWithTitle(), HTTP_PREFIX . $_SERVER['HTTP_HOST'] . WEBIM_ROOT . '/operator/threadprocessor.php?threadid=' . $thread['threadid'], str_replace("\n", "\n\n", $first_message['message'])), WEBIM_CURRENT_LOCALE);
// отправке диалогов из мессенджера
if ($dept && ($feedback = feedbackAdd($dept, $visitor_name, $email, $body, get_uid(false)))) {
$body .= "\n" . '[[UCODE::{' . $feedback['uc'] . '},FID::{' . $feedback['id'] . '}]]';
}
// отправке диалогов из мессенджера
$inbox_mail = $dept && isset($aDko[$dept]['email']) ? $aDko[$dept]['email'] : Settings::Get('offline_email');
webim_mail($inbox_mail, $visitor_name . '<' . $email . '>', $subject, $body);
$TML->display('leave-message-sent.tpl');
示例10: rand
$TML->assign('RAND', rand(1000, 9999));
$args = array();
foreach ($_GET as $key => $item) {
if ($key != 'action') {
$args[] = "{$key}={$item}";
}
}
$TML->assign('chaturi', "./?a=5" . join('&', $args));
$TML->assign('MAX_FILES', feedback::MAX_FILES);
$TML->assign('u_token_key', $_SESSION['rand']);
if ($has_errors) {
echo "Error:{$errors[0]};{$errors['1']}" . ($errors[2] ? ';' . $errors[2] : '');
exit;
}
$visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession();
$params = array();
$params['visitsessionid'] = $visitSessionId;
$params['lastpingvisitor'] = null;
$params['offline'] = 1;
$threads_count = MapperFactory::getMapper("Thread")->getNonEmptyThreadsCountByVisitorId($visitorid);
$thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_CLOSED, $params);
VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1));
Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread);
Visitor::getInstance()->setVisitorNameCookie($visitor_name);
$feedback = new feedback();
$uid = get_uid(false);
$login = $_SESSION['webim_uname'];
$email = $_SESSION['webim_email'];
$feedback->Add($uid, $login, $email, $department, iconv("UTF-8", "WINDOWS-1251//IGNORE", $message), $attach);
echo "Success: ok";
exit;
示例11: SmartyClass
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
require_once '../classes/functions.php';
require_once '../classes/class.thread.php';
require_once '../classes/class.pagination.php';
require_once '../classes/class.smartyclass.php';
require_once '../classes/class.visitsession.php';
$operator = Operator::getInstance()->GetLoggedOperator();
$TML = new SmartyClass();
$items_per_page = verify_param("items", "/^\\d{1,3}\$/", DEFAULT_ITEMS_PER_PAGE);
$visitsessionid = verify_param("visitsessionid", "/^\\d{0,63}\\.?\\d{0,63}\$/", "");
$threadid = verify_param("threadid", "/^\\d{1,8}\$/", "");
$found = Thread::getInstance()->GetThreadsByVisitSessionID($visitsessionid);
$tmlPage = array();
if ($found) {
$pagination = setup_pagination($found);
$tmlPage['pagination'] = $pagination['pagination'];
$tmlPage['pagination_items'] = $pagination['pagination_items'];
$TML->assign('pagination', generate_pagination($tmlPage['pagination']));
for ($i = 0; $i < count($tmlPage['pagination_items']); $i++) {
$tmlPage['pagination_items'][$i]['diff'] = webim_date_diff($tmlPage['pagination_items'][$i]['modified'] - $tmlPage['pagination_items'][$i]['created']);
}
}
$TML->assign('page_settings', $tmlPage);
$TML->display('visit_info.tpl');
示例12: GetInvitationThread
function GetInvitationThread($visitedpageid)
{
$invitation = Invitation::GetInstance()->GetInvitationByVisitedPageId($visitedpageid);
if (!empty($invitation['threadid'])) {
return Thread::getInstance()->GetThreadById($invitation['threadid']);
}
return NULL;
}
示例13:
<?php
/**
* ManiaLive - TrackMania dedicated server manager in PHP
*
* @copyright Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version $Revision$:
* @author $Author$:
* @date $Date$:
*/
namespace ManiaLive\Threading;
/**
* This is what is run on each new process
* that is being created by the ThreadPool.
*/
// include the __autoload function
require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php';
Thread::getInstance()->run();
示例14: updateContacts
function updateContacts($name, $email, $phone, $threadid, $visitsessionid)
{
$visitSession = MapperFactory::getMapper("VisitSession")->getById($visitsessionid);
if ($visitSession['visitorname'] != $name) {
Thread::getInstance()->RenameVisitor(array("threadid" => $threadid), $name);
Visitor::getInstance()->setVisitorNameCookie($name);
MapperFactory::getMapper("VisitSession")->save(array('visitsessionid' => $visitsessionid, 'visitorname' => $name));
}
}
示例15: dirname
require_once dirname(__FILE__) . '/inc/admin_prolog.php';
require_once '../classes/functions.php';
require_once '../classes/class.thread.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.smartyclass.php';
require_once '../classes/class.pagination.php';
$TML = new SmartyClass($TITLE_KEY);
$tmlPage = null;
$operator = Operator::getInstance()->GetLoggedOperator();
$items_per_page = verify_param("items", "/^\\d{1,3}\$/", DEFAULT_ITEMS_PER_PAGE);
$show_empty = isset($_REQUEST['show_empty']) && $_REQUEST['show_empty'] == 1 ? true : false;
if (isset($_REQUEST['q'])) {
$nTotal = Thread::getInstance()->GetListThreadsCount($operator['operatorid'], $_REQUEST['q'], $show_empty);
if ($nTotal) {
$pagination = setup_pagination_cnt($nTotal, $items_per_page);
$nLimit = $pagination['items'];
$nOffset = $pagination['start'];
$res = Thread::getInstance()->GetListThreads($operator['operatorid'], $_REQUEST['q'], $show_empty, $nLimit, $nOffset);
$tmlPage['pagination'] = $pagination;
$tmlPage['pagination_items'] = $res;
}
if (!empty($tmlPage['pagination_items'])) {
$TML->assign('pagination', generate_pagination($tmlPage['pagination']));
}
$tmlPage['formq'] = $_GET['q'];
$tmlPage['show_empty'] = $show_empty;
}
$TML->assign('advanced', false);
$TML->assign('page_settings', $tmlPage);
$TML->display('thread_search.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';