本文整理汇总了PHP中CTimeZone::getOffset方法的典型用法代码示例。如果您正苦于以下问题:PHP CTimeZone::getOffset方法的具体用法?PHP CTimeZone::getOffset怎么用?PHP CTimeZone::getOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTimeZone
的用法示例。
在下文中一共展示了CTimeZone::getOffset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public static function getList($userId, $taskId, array $parameters = array())
{
$data = array();
$task = static::getTask($userId, $taskId);
if ($task !== null && $task->checkCanRead()) {
$res = \CTaskLog::GetList(array('CREATED_DATE' => 'DESC'), array('TASK_ID' => $taskId));
$tzDisabled = !\CTimeZone::enabled();
if ($tzDisabled) {
\CTimeZone::enable();
}
$tzOffset = \CTimeZone::getOffset();
if ($tzDisabled) {
\CTimeZone::disable();
}
while (true) {
if ($parameters['ESCAPE_DATA']) {
$item = $res->GetNext();
} else {
$item = $res->fetch();
}
if (!$item) {
break;
}
// Adjust unix timestamps to "bitrix timestamps"
if (isset(\CTaskLog::$arComparedFields[$item['FIELD']]) && \CTaskLog::$arComparedFields[$item['FIELD']] === 'date') {
$item['TO_VALUE'] = $item['TO_VALUE'] + $tzOffset;
$item['FROM_VALUE'] = $item['FROM_VALUE'] + $tzOffset;
}
$data[] = $item;
}
}
return array('DATA' => $data, 'CAN' => array());
}
示例2: getGridData
private function getGridData($gridId)
{
$grid = array('ID' => $gridId);
$securityContext = $this->storage->getCurrentUserSecurityContext();
$parameters = array('with' => array('FILE', 'CREATE_USER'), 'filter' => array('IS_EXPIRED' => false, 'OBJECT.STORAGE_ID' => $this->storage->getId(), 'CREATED_BY' => $this->getUser()->getId()));
$parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('OBJECT_ID', 'OBJECT.CREATED_BY'));
$items = ExternalLink::getModelList($parameters);
Collection::sortByColumn($items, array('CREATE_TIME' => array(SORT_NUMERIC, SORT_ASC)));
$urlManager = Driver::getInstance()->getUrlManager();
$rows = array();
foreach ($items as $externalLink) {
/** @var ExternalLink $externalLink */
$exportData = $externalLink->toArray();
$nameSpecialChars = htmlspecialcharsbx($externalLink->getFile()->getName());
$createDateText = htmlspecialcharsbx((string) $externalLink->getCreateTime());
$columnName = "\n\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$externalLink->getId()}\" class=\"draggable bx-file-icon-container-small bx-disk-file-icon\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$externalLink->getId()}\" href=\"\" data-bx-dateModify=\"{$createDateText}\">{$nameSpecialChars}</a></td>\n\t\t\t\t</tr></table>\n\t\t\t";
$createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $externalLink->getCreatedBy()));
$rows[] = array('data' => $exportData, 'columns' => array('CREATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'UPDATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'NAME' => $columnName, 'FORMATTED_SIZE' => CFile::formatSize($externalLink->getFile()->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($externalLink->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t\t"), 'actions' => array(array("PSEUDO_NAME" => "download", "DEFAULT" => true, "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($externalLink->getFile()) . "')"), array("PSEUDO_NAME" => "disable_external_link", "ICONCLASS" => "disable_external_link", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK'), "SHORT_TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK_SHORT'), "ONCLICK" => "BX.Disk['ExternalLinkListClass_{$this->getComponentId()}'].disableExternalLink({$externalLink->getId()}, {$externalLink->getObjectId()})")));
}
unset($externalLink);
$grid['MODE'] = 'list';
$grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'default' => false, 'show_checkbox' => true), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_NAME'), 'default' => true), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_TIME'), 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_USER'), 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_FORMATTED_SIZE'), 'default' => true));
$grid['ROWS'] = $rows;
$grid['ROWS_COUNT'] = count($rows);
$grid['FOOTER'] = array();
return $grid;
}
示例3: canRead
/**
* @param $userId
* @return bool
*/
public function canRead($userId)
{
if ($this->canRead !== null) {
return $this->canRead;
}
if (!Loader::includeModule('socialnetwork')) {
return false;
}
$cacheTtl = 2592000;
$cacheId = 'blog_post_socnet_general_' . $this->entityId . '_' . LANGUAGE_ID;
$timezoneOffset = \CTimeZone::getOffset();
if ($timezoneOffset != 0) {
$cacheId .= "_" . $timezoneOffset;
}
$cacheDir = '/blog/socnet_post/gen/' . intval($this->entityId / 100) . '/' . $this->entityId;
$cache = new \CPHPCache();
if ($cache->initCache($cacheTtl, $cacheId, $cacheDir)) {
$post = $cache->getVars();
} else {
$cache->startDataCache();
$queryPost = \CBlogPost::getList(array(), array("ID" => $this->entityId), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR_ID", "ENABLE_COMMENTS", "NUM_COMMENTS", "VIEWS", "CODE", "MICRO", "DETAIL_TEXT", "DATE_PUBLISH", "CATEGORY_ID", "HAS_SOCNET_ALL", "HAS_TAGS", "HAS_IMAGES", "HAS_PROPS", "HAS_COMMENT_IMAGES"));
$post = $queryPost->fetch();
$cache->endDataCache($post);
}
if (!$post) {
$this->canRead = false;
return false;
}
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$this->canRead = \CBlogPost::getSocNetPostPerms($this->entityId, true, $userId, $post["AUTHOR_ID"]) >= BLOG_PERMS_READ;
return $this->canRead;
}
示例4: appendIBlockEntry
public function appendIBlockEntry($url, $modifiedDate, $priority = 0)
{
if ($this->isExists()) {
$this->appendEntry(array('XML_LOC' => $this->settings['PROTOCOL'] . '://' . \CBXPunycode::toASCII($this->settings['DOMAIN'], $e = null) . $url, 'XML_LASTMOD' => date('c', $modifiedDate - \CTimeZone::getOffset()), 'XML_PRIORITY' => $priority ? $priority : self::DEFAULT_PRIORITY));
} else {
$this->addHeader();
$this->addIBlockEntry($url, $modifiedDate, $priority);
$this->addFooter();
}
}
示例5: tasksFormatDate
function tasksFormatDate($in_date)
{
$date = $in_date;
$strDate = false;
if (!is_int($in_date)) {
$date = MakeTimeStamp($in_date);
}
if ($date === false || $date === -1 || $date === 0) {
$date = MakeTimeStamp($in_date);
}
// It can be other date on server (relative to client), ...
$bTzWasDisabled = !CTimeZone::enabled();
if ($bTzWasDisabled) {
CTimeZone::enable();
}
$ts = time() + CTimeZone::getOffset();
// ... so shift cur timestamp to compensate it.
if ($bTzWasDisabled) {
CTimeZone::disable();
}
$curDateStrAtClient = date('d.m.Y', $ts);
$yesterdayDateStrAtClient = date('d.m.Y', strtotime('-1 day', $ts));
if ($curDateStrAtClient === date('d.m.Y', $date)) {
$strDate = FormatDate("today", $date);
} elseif ($yesterdayDateStrAtClient === date('d.m.Y', $date)) {
$strDate = FormatDate("yesterday", $date);
} else {
if (defined('FORMAT_DATE')) {
$strDate = FormatDate(CDatabase::DateFormatToPHP(FORMAT_DATE), $date);
} else {
$strDate = FormatDate("d.m.Y", $date);
}
}
return $strDate;
}
示例6: getCacheID
/**
* Function returns an cache identifier based on component parameters and environment.
*
* @param mixed $additionalCacheID
* @return string
*/
public function getCacheID($additionalCacheID = false)
{
if (!$this->getSiteId()) {
$SITE_ID = SITE_ID;
} else {
$SITE_ID = $this->getSiteId();
}
if (!$this->getLanguageId()) {
$LANGUAGE_ID = LANGUAGE_ID;
} else {
$LANGUAGE_ID = $this->getLanguageId();
}
if (!$this->getSiteTemplateId()) {
$SITE_TEMPLATE_ID = defined("SITE_TEMPLATE_ID") ? SITE_TEMPLATE_ID : "";
} else {
$SITE_TEMPLATE_ID = $this->getSiteTemplateId();
}
$cacheID = $SITE_ID . "|" . $LANGUAGE_ID . ($SITE_TEMPLATE_ID != "" ? "|" . $SITE_TEMPLATE_ID : "") . "|" . $this->__name . "|" . $this->getTemplateName() . "|";
foreach ($this->arParams as $k => $v) {
if (strncmp("~", $k, 1)) {
$cacheID .= "," . $k . "=" . serialize($v);
}
}
if (($offset = CTimeZone::getOffset()) != 0) {
$cacheID .= "|" . $offset;
}
if ($additionalCacheID !== false) {
$cacheID .= "|" . serialize($additionalCacheID);
}
return $cacheID;
}
示例7: OnAdminInformerInsertItems
/**
* Shows information about WAF stats in Admin's informer popup
* @return bool|void
*/
public static function OnAdminInformerInsertItems()
{
/** @global CMain $APPLICATION */
global $APPLICATION;
if ($APPLICATION->GetGroupRight("security") < "W")
return false;
$setupLink = '/bitrix/admin/security_filter.php?lang='.LANGUAGE_ID;
$WAFAIParams = array(
"TITLE" => getMessage("SECURITY_FILTER_INFORM_TITLE"),
"COLOR" => "blue",
"FOOTER" => '<a href="'.$setupLink.'">'.getMessage("SECURITY_FILTER_INFORM_LINK_TO_SETUP_ON").'</a>'
);
try
{
if (self::IsActive())
{
$days = COption::getOptionInt("main", "event_log_cleanup_days", 7);
if($days > 7)
$days = 7;
$timestampX = ConvertTimeStamp(time()-$days*24*3600+CTimeZone::getOffset());
$eventLink = '/bitrix/admin/event_log.php?set_filter=Y&find_type=audit_type_id&find_audit_type[]=SECURITY_FILTER_SQL&find_audit_type[]=SECURITY_FILTER_XSS&find_audit_type[]=SECURITY_FILTER_XSS2&find_audit_type[]=SECURITY_FILTER_PHP&mod=security&find_timestamp_x_1='.$timestampX.'&lang='.LANGUAGE_ID;
$eventCount = self::getEventsCount($timestampX);
if($eventCount > 999)
$eventCount = round($eventCount/1000,1).'K';
if($eventCount > 0)
$descriptionText = getMessage("SECURITY_FILTER_INFORM_EVENT_COUNT").'<a href="'.$eventLink.'">'.$eventCount.'</a>';
else
$descriptionText = getMessage("SECURITY_FILTER_INFORM_EVENT_COUNT_EMPTY");
$WAFAIParams["FOOTER"] = '<a href="'.$setupLink.'">'.getMessage("SECURITY_FILTER_INFORM_LINK_TO_SETUP").'</a>';
$WAFAIParams["ALERT"] = false;
$WAFAIParams["HTML"] = '
<div class="adm-informer-item-section">
<span class="adm-informer-item-l">
<span class="adm-informer-strong-text">'.getMessage("SECURITY_FILTER_INFORM_FILTER_ON").'</span>
<span>'.$descriptionText.'</span>
</span>
</div>
';
}
else
{
$WAFAIParams["ALERT"] = true;
$WAFAIParams["HTML"] = '
<div class="adm-informer-item-section">
<span class="adm-informer-item-l">
<span class="adm-informer-strong-text">'.getMessage("SECURITY_FILTER_INFORM_FILTER_OFF").'</span>
<span>'.getMessage("SECURITY_FILTER_INFORM_FILTER_ON_RECOMMENDATION", array("#LINK#" => $setupLink)).'</span>
</span>
</div>
';
}
}
catch (Exception $e)
{
$WAFAIParams["TITLE"] .= " - ".getMessage("top_panel_ai_title_err");
$WAFAIParams["ALERT"] = true;
$WAFAIParams["HTML"] = $e->getMessage();
}
CAdminInformer::AddItem($WAFAIParams);
return true;
}
示例8: getCurrentActivity
public static function getCurrentActivity($departmentId = 0, $section = null)
{
$data = array();
$fieldName = $section === null ? 'TOTAL' : $section;
$currentHour = ConvertTimeStamp(mktime(date('G'), 0, 0), 'FULL');
$previousHour = ConvertTimeStamp(mktime(date('G') - 1, 0, 0), 'FULL');
$currentHourClient = ConvertTimeStamp(mktime(date('G'), 0, 0) + \CTimeZone::getOffset(), 'FULL');
$previousHourClient = ConvertTimeStamp(mktime(date('G') - 1, 0, 0) + \CTimeZone::getOffset(), 'FULL');
$result = DepartmentHourTable::getList(array('select' => array('HOUR', $fieldName), 'filter' => array('=DEPT_ID' => $departmentId, '=HOUR' => array($currentHourClient, $previousHourClient))));
while ($row = $result->fetch()) {
$data[ConvertTimeStamp($row['HOUR']->getTimestamp(), 'FULL')] = $row[$fieldName];
}
$currentActivity = isset($data[$currentHour]) ? (int) $data[$currentHour] : 0;
if (isset($data[$previousHour])) {
// emulation of [60 - CURRENT_MINUTES] of previous hour
$currentActivity += round($data[$previousHour] * (1 - date('i') / 60));
}
return $currentActivity;
}
示例9: setAuthentication
public static function setAuthentication(CurrentUser $user, $isPersistent = false)
{
/** @var $context \Freetrix\Main\HttpContext */
$context = \Freetrix\Main\Application::getInstance()->getContext();
$context->setUser($user);
static::copyToSession($user);
/** @var $response \Freetrix\Main\HttpResponse */
$response = $context->getResponse();
if (!$user->isAuthenticated()) {
$cookie = new \Freetrix\Main\Web\Cookie("UIDH", "", time() - 3600);
$response->addCookie($cookie);
return;
}
$connection = \Freetrix\Main\Application::getDbConnection();
$sqlHelper = $connection->getSqlHelper();
$connection->queryExecute("UPDATE b_user SET " . " STORED_HASH = NULL, " . " LAST_LOGIN = " . $sqlHelper->getCurrentDateTimeFunction() . ", " . " TIMESTAMP_X = TIMESTAMP_X, " . " LOGIN_ATTEMPTS = 0, " . " TIME_ZONE_OFFSET = " . \CTimeZone::getOffset() . " " . "WHERE ID = " . $user->getUserId() . " ");
$cookie = new \Freetrix\Main\Web\Cookie("LOGIN", $user->getLogin(), time() + 60 * 60 * 24 * 30 * 60);
$cookie->setSpread(\Freetrix\Main\Config\Option::get("main", "auth_multisite", "N") == "Y" ? \Freetrix\Main\Web\Cookie::SPREAD_SITES : \Freetrix\Main\Web\Cookie::SPREAD_DOMAIN);
$response->addCookie($cookie);
if ($isPersistent || \Freetrix\Main\Config\Option::get("main", "auth_multisite", "N") == "Y") {
$hash = $user->getSessionHash();
/** @var $request \Freetrix\Main\HttpRequest */
$request = $context->getRequest();
if ($isPersistent) {
$cookie = new \Freetrix\Main\Web\Cookie("UIDH", $hash, time() + 60 * 60 * 24 * 30 * 60);
} else {
$cookie = new \Freetrix\Main\Web\Cookie("UIDH", $hash, 0);
}
$cookie->setSecure(\Freetrix\Main\Config\Option::get("main", "use_secure_password_cookies", "N") == "Y" && $request->isHttps());
$response->addCookie($cookie);
$storedId = static::getStoredHashId($user, $hash);
if ($storedId) {
$connection->queryExecute("UPDATE b_user_stored_auth SET " . "\tLAST_AUTH = " . $sqlHelper->getCurrentDateTimeFunction() . ", " . "\t" . ($user->getAuthType() === static::AUTHENTICATED_BY_HASH ? "" : "TEMP_HASH='" . ($isPersistent ? "N" : "Y") . "', ") . " " . "\tIP_ADDR = '" . sprintf("%u", ip2long($request->getRemoteAddress())) . "' " . "WHERE ID = " . intval($storedId));
} else {
$sqlTmp1 = "";
$sqlTmp2 = "";
if ($connection->getType() === "oracle") {
$storedId = $connection->getIdentity("sq_b_user_stored_auth");
$sqlTmp1 = "ID, ";
$sqlTmp2 = intval($storedId) . ", ";
}
$sql = "INSERT INTO b_user_stored_auth (" . $sqlTmp1 . "USER_ID, DATE_REG, LAST_AUTH, TEMP_HASH, " . " IP_ADDR, STORED_HASH) " . "VALUES (" . $sqlTmp2 . intval($user->getUserId()) . ", " . $sqlHelper->getCurrentDateTimeFunction() . ", " . " " . $sqlHelper->getCurrentDateTimeFunction() . ", '" . ($isPersistent ? "N" : "Y") . "', " . " '" . $sqlHelper->forSql(sprintf("%u", ip2long($request->getRemoteAddress()))) . "', " . " '" . $sqlHelper->forSql($hash) . "')";
$connection->queryExecute($sql);
if ($connection->getType() !== "oracle") {
$storedId = $connection->getIdentity();
}
}
$user->setStoredAuthId($storedId);
}
$event = new Main\Event("main", "OnUserLogin", array("USER" => $user));
$event->send();
if (\Freetrix\Main\Config\Option::get("main", "event_log_login_success", "N") === "Y") {
\CEventLog::log("SECURITY", "USER_AUTHORIZE", "main", $user->getUserId());
}
}
示例10: getDatetimeExpressionTemplate
/**
* Return datetime template for old api emulation.
*
* @return string
*/
public static function getDatetimeExpressionTemplate()
{
if (self::$datetimeTemplate === null) {
$helper = Application::getConnection()->getSqlHelper();
$format = Context::getCurrent()->getCulture()->getDateTimeFormat();
$datetimeFieldName = '#FIELD#';
$datetimeField = $datetimeFieldName;
if (\CTimeZone::enabled()) {
$diff = \CTimeZone::getOffset();
if ($diff != 0) {
$datetimeField = $helper->addSecondsToDateTime($diff, $datetimeField);
}
unset($diff);
}
self::$datetimeTemplate = str_replace(array('%', $datetimeFieldName), array('%%', '%1$s'), $helper->formatDate($format, $datetimeField));
unset($datetimeField, $datetimeFieldName, $format, $helper);
}
return self::$datetimeTemplate;
}
示例11: UnifyFields
public static function UnifyFields(&$value, $key)
{
if (array_key_exists($key, self::$arComparedFields)) {
switch (self::$arComparedFields[$key]) {
case "integer":
$value = intval($value);
break;
case "string":
$value = trim($value);
break;
case "array":
if (!is_array($value)) {
$value = explode(",", $value);
}
$value = array_unique(array_filter(array_map("trim", $value)));
sort($value);
break;
case "date":
$value = MakeTimeStamp($value);
if (!$value) {
$value = strtotime($value);
// There is correct Unix timestamp in return value
// CTimeZone::getOffset() substraction here???
} else {
// It can be other date on server (relative to client), ...
$bTzWasDisabled = !CTimeZone::enabled();
if ($bTzWasDisabled) {
CTimeZone::enable();
}
$value -= CTimeZone::getOffset();
// get correct UnixTimestamp
if ($bTzWasDisabled) {
CTimeZone::disable();
}
// We mustn't store result of MakeTimestamp() in DB,
// because it is shifted for time zone offset already,
// which can't be restored.
}
break;
case "bool":
if ($value != "Y") {
$value = "N";
}
break;
}
}
}
示例12: getSqlForTimestamps
private static function getSqlForTimestamps($key, $val, $userID, $sAliasPrefix, $bGetZombie)
{
static $ts = null;
// some fixed timestamp of "now" (for consistency)
if ($ts === null) {
$ts = CTasksPerHitOption::getHitTimestamp();
}
$bTzWasDisabled = !CTimeZone::enabled();
if ($bTzWasDisabled) {
CTimeZone::enable();
}
// Adjust UNIX TS to "Bitrix timestamp"
$tzOffset = CTimeZone::getOffset();
$val += $tzOffset;
$ts += $tzOffset;
if ($bTzWasDisabled) {
CTimeZone::disable();
}
$arSqlSearch = array();
$arFilter = array('::LOGIC' => 'AND');
$key = ltrim($key);
$res = CTasks::MkOperationFilter($key);
$fieldName = substr($res["FIELD"], 5, -3);
// Cutoff prefix "META:" and suffix "_TS"
$cOperationType = $res["OPERATION"];
$operationSymbol = substr($key, 0, -1 * strlen($res["FIELD"]));
if (substr($cOperationType, 0, 1) !== '#') {
switch ($operationSymbol) {
case '<':
$operationCode = CTaskFilterCtrl::OP_STRICTLY_LESS;
break;
case '>':
$operationCode = CTaskFilterCtrl::OP_STRICTLY_GREATER;
break;
case '<=':
$operationCode = CTaskFilterCtrl::OP_LESS_OR_EQUAL;
break;
case '>=':
$operationCode = CTaskFilterCtrl::OP_GREATER_OR_EQUAL;
break;
case '!=':
$operationCode = CTaskFilterCtrl::OP_NOT_EQUAL;
break;
case '':
case '=':
$operationCode = CTaskFilterCtrl::OP_EQUAL;
break;
default:
CTaskAssert::log('Unknown operation code: ' . $operationSymbol . '; $key = ' . $key . '; it will be silently ignored, incorrect results expected', CTaskAssert::ELL_ERROR);
return $arSqlSearch;
break;
}
} else {
$operationCode = (int) substr($cOperationType, 1);
}
$date1 = $date2 = $cOperationType1 = $cOperationType2 = null;
// Convert cOperationType to format accepted by self::FilterCreate
switch ($operationCode) {
case CTaskFilterCtrl::OP_EQUAL:
case CTaskFilterCtrl::OP_DATE_TODAY:
case CTaskFilterCtrl::OP_DATE_YESTERDAY:
case CTaskFilterCtrl::OP_DATE_TOMORROW:
case CTaskFilterCtrl::OP_DATE_CUR_WEEK:
case CTaskFilterCtrl::OP_DATE_PREV_WEEK:
case CTaskFilterCtrl::OP_DATE_NEXT_WEEK:
case CTaskFilterCtrl::OP_DATE_CUR_MONTH:
case CTaskFilterCtrl::OP_DATE_PREV_MONTH:
case CTaskFilterCtrl::OP_DATE_NEXT_MONTH:
case CTaskFilterCtrl::OP_DATE_NEXT_DAYS:
case CTaskFilterCtrl::OP_DATE_LAST_DAYS:
$cOperationType1 = '>=';
$cOperationType2 = '<=';
break;
case CTaskFilterCtrl::OP_LESS_OR_EQUAL:
$cOperationType1 = '<=';
break;
case CTaskFilterCtrl::OP_GREATER_OR_EQUAL:
$cOperationType1 = '>=';
break;
case CTaskFilterCtrl::OP_NOT_EQUAL:
$cOperationType1 = '<';
$cOperationType2 = '>';
break;
case CTaskFilterCtrl::OP_STRICTLY_LESS:
$cOperationType1 = '<';
break;
case CTaskFilterCtrl::OP_STRICTLY_GREATER:
$cOperationType1 = '>';
break;
default:
CTaskAssert::log('Unknown operation code: ' . $operationCode . '; $key = ' . $key . '; it will be silently ignored, incorrect results expected', CTaskAssert::ELL_ERROR);
return $arSqlSearch;
break;
}
// Convert/generate dates
$ts1 = $ts2 = null;
switch ($operationCode) {
case CTaskFilterCtrl::OP_DATE_TODAY:
$ts1 = $ts2 = $ts;
break;
//.........这里部分代码省略.........
示例13: AddMessage
function AddMessage($mailbox_id, $message, $charset)
{
global $DB;
list($obHeader, $message_body_html, $message_body, $arMessageParts) = CMailMessage::parseMessage($message, $charset);
$arFields = array("MAILBOX_ID" => $mailbox_id, "HEADER" => $obHeader->strHeader, "FIELD_DATE_ORIGINAL" => $obHeader->GetHeader("DATE"), "NEW_MESSAGE" => "Y", "FIELD_FROM" => $obHeader->GetHeader("FROM"), "FIELD_REPLY_TO" => $obHeader->GetHeader("REPLY-TO"), "FIELD_TO" => $obHeader->GetHeader("TO"), "FIELD_CC" => $obHeader->GetHeader("CC"), "FIELD_BCC" => ($obHeader->GetHeader('X-Original-Rcpt-to') != '' ? $obHeader->GetHeader('X-Original-Rcpt-to') . ($obHeader->GetHeader("BCC") != '' ? ', ' : '') : '') . $obHeader->GetHeader("BCC"), "MSG_ID" => trim($obHeader->GetHeader("MESSAGE-ID"), " <>"), "IN_REPLY_TO" => trim($obHeader->GetHeader("IN-REPLY-TO"), " <>"), "FIELD_PRIORITY" => IntVal($obHeader->GetHeader("X-PRIORITY")), "MESSAGE_SIZE" => strlen($message), "SUBJECT" => $obHeader->GetHeader("SUBJECT"), "BODY" => rtrim($message_body));
if (COption::GetOptionString("mail", "save_src", B_MAIL_SAVE_SRC) == "Y") {
$arFields["FULL_TEXT"] = $message;
}
if ($message_body_html !== false) {
$arFields["FOR_SPAM_TEST"] = $obHeader->strHeader . " " . $message_body_html;
} else {
$arFields["FOR_SPAM_TEST"] = $obHeader->strHeader . " " . $message_body;
}
$arFields["SPAM"] = "?";
if (COption::GetOptionString("mail", "spam_check", B_MAIL_CHECK_SPAM) == "Y") {
$arSpam = CMailFilter::GetSpamRating($arFields["FOR_SPAM_TEST"]);
$arFields["SPAM_RATING"] = $arSpam["RATING"];
$arFields["SPAM_WORDS"] = $arSpam["WORDS"];
$arFields["SPAM_LAST_RESULT"] = "Y";
}
if (CMailUtil::IsSizeAllowed(strlen(implode(",", $arFields)))) {
$MESSAGE_ID = CMailMessage::Add($arFields);
CMailLog::AddMessage(array("MAILBOX_ID" => $mailbox_id, "MESSAGE_ID" => $MESSAGE_ID, "STATUS_GOOD" => "Y", "LOG_TYPE" => "NEW_MESSAGE", "MESSAGE" => $arFields["SUBJECT"] . " (" . $arFields["MESSAGE_SIZE"] . ") " . (COption::GetOptionString("mail", "spam_check", B_MAIL_CHECK_SPAM) == "Y" ? "[" . Round($arFields["SPAM_RATING"], 3) . "]" : "")));
$atchCnt = 0;
if (COption::GetOptionString("mail", "save_attachments", B_MAIL_SAVE_ATTACHMENTS) == "Y") {
foreach ($arMessageParts as $part) {
$arField = array("MESSAGE_ID" => $MESSAGE_ID, "FILE_NAME" => $part["FILENAME"], "CONTENT_TYPE" => $part["CONTENT-TYPE"], "FILE_DATA" => $part["BODY"], "CONTENT_ID" => $part["CONTENT-ID"]);
if (CMailMessage::AddAttachment($arField)) {
$atchCnt++;
}
}
// foreach($arMessageParts as $part)
}
$arFields['ID'] = $MESSAGE_ID;
$arFields['ATTACHMENTS'] = $atchCnt;
if (is_set($arFields, 'FIELD_DATE_ORIGINAL') && !is_set($arFields, 'FIELD_DATE')) {
$arFields['FIELD_DATE'] = $DB->formatDate(date('d.m.Y H:i:s', strtotime($arFields['FIELD_DATE_ORIGINAL']) + CTimeZone::getOffset()), 'DD.MM.YYYY HH:MI:SS', CLang::GetDateFormat('FULL'));
}
CMailFilter::Filter($arFields, "R");
return $MESSAGE_ID;
} else {
CMailLog::AddMessage(array("MAILBOX_ID" => $mailbox_id, "STATUS_GOOD" => "N", "LOG_TYPE" => "NEW_MESSAGE", "MESSAGE" => "Big message size, check mysql max_allow_packet."));
}
}
示例14: getTimeZoneOffset
/**
* Not part of public API, for internal use only.
* @deprecated
* @access private
*/
public static function getTimeZoneOffset($userId = false)
{
$bTzWasDisabled = !CTimeZone::enabled();
if ($bTzWasDisabled) {
CTimeZone::enable();
}
if ($userId === false) {
$tzOffset = CTimeZone::getOffset();
} else {
$tzOffset = CTimeZone::getOffset($userId);
}
if ($bTzWasDisabled) {
CTimeZone::disable();
}
return $tzOffset;
}
示例15: ShowError
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule("learning")) {
ShowError(GetMessage("LEARNING_MODULE_NOT_FOUND"));
return;
}
global $USER;
$bTzWasDisabled = !CTimeZone::enabled();
if ($bTzWasDisabled) {
CTimeZone::enable();
}
if ($userId === false) {
$tzOffset = CTimeZone::getOffset();
} else {
$tzOffset = CTimeZone::getOffset($userId);
}
if ($bTzWasDisabled) {
CTimeZone::disable();
}
$nowDateStr = ConvertTimeStamp(time() + $tzOffset, 'FULL');
$rs = CLearningGroup::getList(array(), array('MEMBER_ID' => $USER->getId(), 'ACTIVE' => 'Y', '<ACTIVE_FROM' => $nowDateStr, '>ACTIVE_TO' => $nowDateStr));
while ($ar = $rs->fetch()) {
CLearnParsePermissionsFromFilter::registerAvailableCourse($ar['COURSE_LESSON_ID']);
}
$arParams["SORBY"] = isset($arParams["~SORBY"]) ? trim($arParams["~SORBY"]) : "SORT";
$arParams["SORORDER"] = isset($arParams["~SORORDER"]) ? trim($arParams["~SORORDER"]) : "ASC";
$arParams["CHECK_PERMISSIONS"] = isset($arParams["CHECK_PERMISSIONS"]) && $arParams["CHECK_PERMISSIONS"] == "N" ? "N" : "Y";
$arParams["COURSE_DETAIL_TEMPLATE"] = isset($arParams["COURSE_DETAIL_TEMPLATE"]) ? htmlspecialcharsbx($arParams["COURSE_DETAIL_TEMPLATE"]) : "course/index.php?COURSE_ID=#COURSE_ID#";
$arParams["COURSES_PER_PAGE"] = intval($arParams["COURSES_PER_PAGE"]) > 0 ? intval($arParams["COURSES_PER_PAGE"]) : 20;
//Set Title