本文整理汇总了PHP中verify_param函数的典型用法代码示例。如果您正苦于以下问题:PHP verify_param函数的具体用法?PHP verify_param怎么用?PHP verify_param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verify_param函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pagination_info
/**
* Returns information about pagination.
*
* @param int $items_count Count of items which are separated by pages.
* @param int $default_items_per_page Count of items per page.
* @return array|boolean Associative array of pagination info or FALSE if the
* info array cannot be build. Info array contatins the following keys:
* - page: int, number of current page.
* - total: int, total pages count.
* - items: int, items per page.
* - count: int, total items count.
* - start: int, index of item to start from.
* - end: int, index of item to end at.
*/
function pagination_info($items_count, $default_items_per_page = 15)
{
if ($items_count) {
$items_per_page = verify_param("items", "/^\\d{1,3}\$/", $default_items_per_page);
if ($items_per_page < 2) {
$items_per_page = 2;
}
$total_pages = div($items_count + $items_per_page - 1, $items_per_page);
$curr_page = verify_param("page", "/^\\d{1,6}\$/", 1);
if ($curr_page < 1) {
$curr_page = 1;
}
if ($curr_page > $total_pages) {
$curr_page = $total_pages;
}
$start_index = ($curr_page - 1) * $items_per_page;
$end_index = min($start_index + $items_per_page, $items_count);
return array("page" => $curr_page, "items" => $items_per_page, "total" => $total_pages, "count" => $items_count, "start" => $start_index, "end" => $end_index);
} else {
return false;
}
}
开发者ID:abhijitroy07,项目名称:mibew,代码行数:36,代码来源:pagination.php
示例2: setup_pagination
function setup_pagination($items, $default_items_per_page = 15)
{
$pagination = array();
if (!empty($items)) {
$items_per_page = verify_param("items", "/^\\d{1,3}\$/", $default_items_per_page);
if ($items_per_page < 2) {
$items_per_page = 2;
}
$total_pages = div(count($items) + $items_per_page - 1, $items_per_page);
$curr_page = verify_param("page", "/^\\d{1,6}\$/", 1);
if ($curr_page < 1) {
$curr_page = 1;
}
if ($curr_page > $total_pages) {
$curr_page = $total_pages;
}
$start_index = ($curr_page - 1) * $items_per_page;
$end_index = min($start_index + $items_per_page, count($items));
$pagination['pagination_items'] = array_slice($items, $start_index, $end_index - $start_index);
$pagination['pagination'] = array("page" => $curr_page, "items" => $items_per_page, "total" => $total_pages, "count" => count($items), "start" => $start_index, "end" => $end_index);
}
return $pagination;
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:23,代码来源:class.pagination.php
示例3: getCurrentStyle
/**
* Returns name of the style which shoud be used for the current request.
*
* Result of the method can depends on user role, requested page or any
* other criteria.
*
* @return string Name of a style
* @throws \RuntimeException
*/
public static function getCurrentStyle()
{
// Ceck if request contains chat style
$style_name = verify_param("style", "/^\\w+\$/", "");
if (!$style_name) {
// Use the default style
$style_name = self::getDefaultStyle();
}
// Get all style list and make sure that in has at least one style.
$available_styles = self::getAvailableStyles();
if (empty($available_styles)) {
throw new \RuntimeException('There are no dialog styles in the system');
}
// Check if selected style exists. If it does not exist try to fall back
// to "default". Finally, if there is no appropriate style in the system
// throw an exception.
if (in_array($style_name, $available_styles)) {
return $style_name;
} elseif (in_array('default', $available_styles)) {
return 'default';
} else {
throw new \RuntimeException('There is no appropriate dialog style in the system');
}
}
开发者ID:abhijitroy07,项目名称:mibew,代码行数:33,代码来源:ChatStyle.php
示例4: get_current_locale
/**
* Retrieves locale for the current request.
*
* @return string Locale code
*/
function get_current_locale()
{
static $current_locale = null;
if (is_null($current_locale)) {
$locale = verify_param("locale", "/./", "");
// Check if locale code passed in as a param is valid
$locale_param_valid = $locale && locale_pattern_check($locale) && locale_is_available($locale);
// Check if locale code stored in session data is valid
$session_locale_valid = isset($_SESSION[SESSION_PREFIX . 'locale']) && locale_pattern_check($_SESSION[SESSION_PREFIX . 'locale']) && locale_is_available($_SESSION[SESSION_PREFIX . 'locale']);
if ($locale_param_valid) {
$_SESSION[SESSION_PREFIX . 'locale'] = $locale;
} elseif ($session_locale_valid) {
$locale = $_SESSION[SESSION_PREFIX . 'locale'];
} else {
$locale = get_user_locale();
}
$current_locale = $locale;
}
return $current_locale;
}
开发者ID:aburakovskiy,项目名称:mibew,代码行数:25,代码来源:locale.php
示例5: array
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
require_once 'classes/functions.php';
require_once 'classes/class.thread.php';
require_once 'classes/class.smartyclass.php';
require_once 'classes/class.visitsession.php';
$errors = array();
$page = array();
$token = verify_param("token", "/^\\d{1,8}\$/");
$threadid = verify_param("threadid", "/^\\d{1,8}\$/");
$thread = Thread::getInstance()->GetThreadById($threadid);
if (!$thread || !isset($thread['token']) || $token != $thread['token']) {
die("wrong thread");
}
$email = !empty($_POST['email']) ? trim($_POST['email']) : false;
$email_from = !empty($_POST['email_from']) ? trim($_POST['email_from']) : false;
$mode = !empty($_POST['mode']) ? trim($_POST['mode']) : false;
$dept = !empty($_POST['dept']) ? trim($_POST['dept']) : false;
// отправке диалогов из мессенджера ----------
if ($dept && isset($aDko[$dept]['email'])) {
$email = $aDko[$dept]['email'];
}
$TML = new SmartyClass();
$TML->assignCompanyInfoAndTheme();
$has_errors = false;
开发者ID:notUserDeveloper,项目名称:fl-ru-damp,代码行数:31,代码来源:mail.php
示例6: SmartyClass
require_once '../classes/class.browser.php';
$TML = new SmartyClass($TITLE_KEY);
$errors = array();
if (isset($_REQUEST['login']) && isset($_REQUEST['password'])) {
$login = get_mandatory_param('login');
$password = get_mandatory_param('password');
$remember = isset($_REQUEST['isRemember']) && $_REQUEST['isRemember'] == "on";
$e = Operator::getInstance()->DoLogin($login, $password, $remember);
if (isset($e)) {
$errors[] = $e;
}
if (empty($errors)) {
if (!empty($_REQUEST['redir'])) {
header("Location: " . $_REQUEST['redir']);
} else {
header("Location: " . WEBIM_ROOT . "/");
}
exit;
}
}
$TML->assign('errors', $errors);
$TML->assign('isRemember', true);
if (!empty($_REQUEST['redir'])) {
$TML->assign('redir', htmlspecialchars($_REQUEST['redir']));
}
$status = verify_param("status", "/^(new)\$/", "");
if ($status == "new") {
$introduction = "true";
$TML->assign('introduction', $introduction);
}
$TML->display('../templates/login.tpl');
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:login.php
示例7: isset
$show_empty = isset($_REQUEST['show_empty']) && $_REQUEST['show_empty'] == 1 ? true : false;
if (isset($_REQUEST['q'])) {
$q = $_REQUEST['q'];
$items_per_page = verify_param('items', "/^\\d{1,3}\$/", DEFAULT_ITEMS_PER_PAGE);
$op_param = verify_param('operator', "/^\\d+\$/");
// TODO should be operatorid
$departmentidParam = verify_param('departmentid', "/^\\d+\$/");
$localeParam = verify_param($_REQUEST['locale'], '/^[a-z]{2}$/');
$rateParam = verify_param('rate', "/^\\w+\$/");
$startday = verify_param('startday', "/^\\d+\$/");
$startmonth = verify_param('startmonth', "/^\\d{2}.\\d{2}\$/");
$endday = verify_param('endday', "/^\\d+\$/");
$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'])) {
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:adv_history.php
示例8: array
require_once 'classes/functions.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';
$trackStateStrings = array(INVITATION_UNINITIALIZED => "uninitialized", INVITATION_CAN_BE_SENT => "can-be-sent", INVITATION_SENT => "sent", INVITATION_ACCEPTED => "accepted", INVITATION_REJECTED => "rejected", INVITATION_TIMEOUT => "timeout", INVITATION_MISSED => "missed");
if (!Operator::getInstance()->hasViewTrackerOperators()) {
die;
}
$event = verify_param("event", "/^(init|poll|accept|reject|timeout|left)\$/");
$visitsessionid = VisitSession::GetInstance()->updateCurrentOrCreateSession();
if ($event == "init") {
initVisitedPage($visitsessionid, Browser::getCurrentTheme());
exit;
}
$pageid = verify_param("pageid", "/^[a-z0-9]{32}\$/");
// FIXME: do we really need this udpate?
VisitSession::GetInstance()->UpdateVisitSession($visitsessionid);
VisitedPage::GetInstance()->UpdateVisitedPage($pageid);
$visitedpage = VisitedPage::GetInstance()->GetVisitedPageById($pageid);
$state = Invitation::GetInstance()->GetInvitationState($pageid);
$showInvitation = NULL;
$nextState = $state;
switch ($state) {
case INVITATION_UNINITIALIZED:
switch ($event) {
case "poll":
if (VisitedPage::GetInstance()->HasPendingInvitation($pageid)) {
$showInvitation = true;
$nextState = INVITATION_SENT;
} else {
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:track.php
示例9: redirectToPageWithToken
function redirectToPageWithToken($thread, $viewonly, $remote_level)
{
$token = $thread['token'];
$lang = verify_param("lang", "/^[\\w-]{2,5}\$/", "");
$lang_param = !empty($lang) ? "&lang={$lang}" : "";
$viewonly_param = !empty($viewonly) ? "&viewonly=true" : "";
$url = WEBIM_ROOT . "/operator/agent.php?thread=" . $thread['threadid'] . "&token=" . $token . "&level=" . $remote_level . $viewonly_param . $lang_param;
header("Location: " . $url);
exit;
}
开发者ID:notUserDeveloper,项目名称:fl-ru-damp,代码行数:10,代码来源:agent.php
示例10: elseif
* http://webim.ru/license.html
*
*/
$TITLE_KEY = 'page.visit.title';
require_once '../classes/functions.php';
require_once '../classes/class.visitsession.php';
require_once '../classes/class.visitedpage.php';
require_once '../classes/class.pagination.php';
require_once '../classes/class.smartyclass.php';
require_once '../classes/class.geoiplookup.php';
$operator = Operator::getInstance()->GetLoggedOperator();
$visitSession = null;
if (isset($_GET['visitsessionid'])) {
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($_GET['visitsessionid']);
} elseif (isset($_GET['pageid'])) {
$visitdpageid = verify_param('pageid', '/^[a-z0-9]{32}$/');
$vistedpage = VisitedPage::GetInstance()->GetVisitedPageById($_GET['pageid']);
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($vistedpage['visitsessionid']);
}
if (empty($visitSession)) {
die('Invalid or no visitsessionid or pageid');
}
$visitedPages = VisitedPage::GetInstance()->enumVisitedPagesByVisitSessionId($visitSession['visitsessionid']);
$landingPage = end($visitedPages);
$exitPage = reset($visitedPages);
$timeend = 0;
$timestart = 0;
foreach ($visitedPages as $k => $vp) {
$timeend = $timeend == 0 ? $vp['updated'] : max($timeend, $vp['updated']);
$timestart = $timestart == 0 ? $vp['opened'] : min($timestart, $vp['opened']);
$visitedPages[$k]['sessionduration'] = $vp['updated'] - $vp['opened'];
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:visit.php
示例11: switch
$TML->assign('messages', Thread::getInstance()->GetMessages($threadid, "html", false, $lastid));
$TML->assign('threadid', $threadid);
$TML->assign('is_admin', Operator::getInstance()->isCurrentUserAdmin());
if (isset($_REQUEST['act'])) {
switch ($_REQUEST['act']) {
case 'removerate':
Operator::getInstance()->IsCurrentUserAdminOrRedirect();
$rateid = verify_param("rateid", "/^(\\d{1,9})?\$/");
$url = WEBIM_ROOT . "/operator/threadprocessor.php?threadid=" . $threadid;
Thread::getInstance()->removeRate($rateid);
header("Location: " . $url);
exit;
break;
case 'removethread':
Operator::getInstance()->IsCurrentUserAdminOrRedirect();
$threadid = verify_param("threadid", "/^(\\d{1,9})?\$/");
$url = WEBIM_ROOT . "/operator/threadprocessor.php?threadid=" . $threadid;
$TML->assign("removed_thread", true);
MapperFactory::getMapper("Thread")->delete($threadid);
//Thread::getInstance()->removeRate($rateid);
//header("Location: ".$url);
//exit();
break;
case 'removehistory':
Operator::getInstance()->IsCurrentUserAdminOrRedirect();
$url = WEBIM_ROOT . "/operator/history.php";
// TODO history
Thread::getInstance()->removeHistory($threadid);
header("Location: " . $url);
exit;
break;
开发者ID:notUserDeveloper,项目名称:fl-ru-damp,代码行数:31,代码来源:threadprocessor.php
示例12: redirectToPageWithToken
function redirectToPageWithToken($thread, $viewonly, $remote_level)
{
$token = $thread['token'];
$lang = verify_param('lang', "/^[\\w-]{2,5}\$/", '');
$lang_param = !empty($lang) ? "&lang={$lang}" : '';
$viewonly_param = !empty($viewonly) ? '&viewonly=true' : '';
$url = WEBIM_ROOT . '/operator/agent.php?thread=' . $thread['threadid'] . '&token=' . $token . '&level=' . $remote_level . $viewonly_param . $lang_param;
header('Location: ' . $url);
exit;
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:10,代码来源:agent.php
示例13: dirname
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
$TITLE_KEY = 'topMenu.visitors';
require_once dirname(__FILE__) . '/inc/admin_prolog.php';
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.smartyclass.php';
$TML = new SmartyClass($TITLE_KEY);
$o = Operator::getInstance();
$operator = $o->GetLoggedOperator();
if ($o->isOperatorsLimitExceeded()) {
$TML->display('operators_limit.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';
die;
}
$o->UpdateOperatorStatus($operator);
$lang = verify_param("lang", "/^[\\w-]{2,5}\$/", "");
if (!empty($lang)) {
$TML->assign('lang_param', "?lang={$lang}");
$TML->assign('lang_and_is_operator_param', "?isoperator=true&lang={$lang}");
} else {
$TML->assign('lang_and_is_operator_param', "?isoperator=true");
}
$TML->display('pending_visitors.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:visitors.php
示例14: SmartyClass
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);
}
$errors = array();
ThreadProcessor::getInstance()->ProcessThread($threadid, 'redirect', array('nextoperatorid' => $nextid, 'nextdepartmentid' => $nextdepartmentid, 'operator' => Operator::getInstance()->GetLoggedOperator()));
$TML->assign('page_settings', $page);
if (count($errors) > 0) {
$TML->assign('errors', $errors);
$TML->display('chat_error.tpl');
开发者ID:notUserDeveloper,项目名称:fl-ru-damp,代码行数:31,代码来源:redirect.php
示例15: dirname
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
$TITLE_KEY = 'topMenu.visitors';
require_once dirname(__FILE__) . '/inc/admin_prolog.php';
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.smartyclass.php';
$TML = new SmartyClass($TITLE_KEY);
$o = Operator::getInstance();
$operator = $o->GetLoggedOperator();
if ($o->isOperatorsLimitExceeded()) {
$TML->display('operators_limit.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';
die;
}
$o->UpdateOperatorStatus($operator);
$lang = verify_param('lang', "/^[\\w-]{2,5}\$/", '');
if (!empty($lang)) {
$TML->assign('lang_param', "?lang={$lang}");
$TML->assign('lang_and_is_operator_param', "?isoperator=true&lang={$lang}");
} else {
$TML->assign('lang_and_is_operator_param', '?isoperator=true');
}
$TML->display('pending_visitors.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:visitors.php
示例16: dirname
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
$TITLE_KEY = 'page_analysis.search.title';
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'];
开发者ID:notUserDeveloper,项目名称:fl-ru-damp,代码行数:31,代码来源:history.php
示例17: verify_param
*
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (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';
require_once '../classes/class.threadprocessor.php';
require_once '../classes/class.eventcontroller.php';
require_once '../classes/events_register.php';
ThreadProcessor::getInstance()->ProcessOpenThreads();
$o = Operator::getInstance();
$operator = $o->GetLoggedOperator(false);
$f = "i" . "s" . "Op" . "er" . "a" . "to" . "rsL" . "im" . "it" . "E" . "x" . "ce" . "ed" . "ed";
if ($o->{$f}()) {
die;
}
$status = verify_param("status", "/^\\d{1,9}\$/", OPERATOR_STATUS_ONLINE);
EventController::getInstance()->dispatchEvent(EventController::EVENT_OPERATOR_STATUS, array($operator));
if ($status != 0) {
$since = verify_param("since", "/^\\d{1,9}\$/", 0);
$xml = Thread::getInstance()->buildPendingThreadsXml($since, $operator);
Browser::SendXmlHeaders();
echo $xml;
}
exit;
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:update.php
示例18: GetMessages
function GetMessages($threadid, $meth, $isvisitor, &$lastid, $forceShowingRates = false)
{
if ($forceShowingRates || $isvisitor == false && Operator::getInstance()->isCurrentUserAdmin()) {
$crm = MapperFactory::getMapper('Rate');
$rates = $crm->getByThreadidWithOperator($threadid);
$current_rate = array_shift($rates);
} else {
$current_rate = null;
}
$res = MapperFactory::getMapper("Message")->getListMessages($threadid, $lastid, $isvisitor);
$messages = array();
foreach ($res as $msg) {
$message = "";
switch ($meth) {
case 'xml':
if ($msg['kind'] == KIND_AVATAR) {
$message = "<avatar>" . Browser::AddCdata($msg['message']) . "</avatar>";
} else {
$message = "<message>" . Browser::AddCdata($this->messageToHtml($msg)) . "</message>\n";
}
break;
case 'text':
$message = $this->messageToText($msg);
break;
case 'html':
if ($current_rate && $current_rate['date'] < $msg['created']) {
$messages[] = $this->rateToHtml($current_rate);
$current_rate = array_shift($rates);
}
$isvisitor = verify_param("visitor", "/^true\$/", "false") == 'true';
$cleanup_special_tags = !$isvisitor;
$message = $this->messageToHtml($msg, $cleanup_special_tags);
break;
}
if (!empty($message)) {
$messages[] = $message;
}
if ($msg['messageid'] > $lastid) {
$lastid = $msg['messageid'];
}
}
return $messages;
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:43,代码来源:class.thread.php
示例19: getCurrentTime
$currTime = getCurrentTime();
$tmlPage['availableMonth'] = get_month_selection($currTime - 400 * 24 * 60 * 60, $currTime + 50 * 24 * 60 * 60);
$tmlPage['showresults'] = false;
$tmlPage['departments'] = MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale());
$tmlPage['locales'] = getAvailableLocalesForChat();
Operator::getInstance()->ensureOperatorsAreInLastAccess();
$errors = array();
if (isset($_GET['startday'])) {
$startday = verify_param("startday", "/^\\d+\$/");
$startmonth = verify_param("startmonth", "/^\\d{2}.\\d{2}\$/");
$endday = verify_param("endday", "/^\\d+\$/");
$endmonth = verify_param("endmonth", "/^\\d{2}.\\d{2}\$/");
$start = get_form_date($startday, $startmonth);
$end = get_form_date($endday, $endmonth) + 24 * 60 * 60;
$locale = verify_param("locale", "/^(en|ru)\$/");
$departmentid = verify_param("departmentid", "/^\\d+\$/");
if ($start > $end) {
$errors[] = Resources::Get("statistics.wrong.dates");
}
Operator::getInstance()->loadOnlineStatsIntoDB();
$tmlPage['reportByDate'] = MapperFactory::getMapper("Thread")->getReportByDate($start, $end, $departmentid, $locale);
$tmlPage['reportByDateTotal'] = MapperFactory::getMapper("Thread")->getReportTotalByDate($start, $end, $departmentid, $locale);
$tmlPage['reportByAgent'] = Thread::getInstance()->GetReportByAgent($start, $end, $departmentid, $locale);
$tmlPage['reportLostVisitors'] = MapperFactory::getMapper("LostVisitor")->getReportByOperator($start, $end, $departmentid, $locale);
$tmlPage['reportInterceptedVisitors'] = MapperFactory::getMapper("LostVisitor")->getReportInterceptedByOperator($start, $end, $departmentid, $locale);
$tmlPage['reportByAgentByDate'] = MapperFactory::getMapper("Operator")->getAdvancedReportByDate($start, $end, $departmentid, $locale);
$tmlPage['locale'] = $locale;
$tmlPage['departmentid'] = $departmentid;
$tmlPage['showresults'] = count($errors) ? 0 : 1;
$tmlPage["formstartday"] = date("d", $start);
$tmlPage["formstartmonth"] = date("m.y", $start);
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:statistics.php
示例20: 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');
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:invite.php
注:本文中的verify_param函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论