5use Bitrix\Bitrix24\Form\AbuseZoneMap;
24 private const PAY_ATTENTION_TO_NEW_SHARING_JOINT_FEATURE_OPTION_NAME =
'payAttentionToNewSharingJointFeature';
25 private const PAY_ATTENTION_TO_NEW_FEATURE_JOINT =
'joint-sharing';
26 private const WEEK_TIMESTAMP = 604800;
29 public const ICS =
'ics';
47 $defaultValue =
'unset';
48 $optionValue = CUserOptions::getOption(
50 self::PAY_ATTENTION_TO_NEW_SHARING_JOINT_FEATURE_OPTION_NAME,
54 if ($optionValue === $defaultValue)
56 CUserOptions::setOption(
58 self::PAY_ATTENTION_TO_NEW_SHARING_JOINT_FEATURE_OPTION_NAME,
65 if ($optionValue ===
'N')
70 $timestamp = (int)$optionValue;
71 if ($timestamp && ($now > $timestamp + self::WEEK_TIMESTAMP))
73 return self::PAY_ATTENTION_TO_NEW_FEATURE_JOINT;
86 $defaultValue =
'unset';
87 $optionValue = CUserOptions::getOption(
89 self::PAY_ATTENTION_TO_NEW_SHARING_JOINT_FEATURE_OPTION_NAME,
93 if ($optionValue === $defaultValue)
98 CUserOptions::setOption(
100 self::PAY_ATTENTION_TO_NEW_SHARING_JOINT_FEATURE_OPTION_NAME,
121 if (Loader::includeModule(
'bitrix24'))
123 return \CBitrix24::isEmailConfirmed();
136 return \CCalendar::GetServerPath() . \CBXShortUri::getShortUri($url);
146 $culture = Main\Application::getInstance()->getContext()->getCulture();
147 $nameFormat = is_null($culture) ?
'#NAME# #LAST_NAME#' : $culture->getNameFormat();
149 return trim(str_replace(
150 [
'#NAME#',
'#LAST_NAME#'],
151 [$name ??
'', $lastName ??
''],
162 $user = CUser::GetByID($id)->Fetch();
163 $arFileTmp = CFile::ResizeImageGet(
164 $user[
"PERSONAL_PHOTO"],
165 array(
'width' => 512,
'height' => 512),
166 BX_RESIZE_IMAGE_EXACT,
174 'name' => $user[
'NAME'],
175 'lastName' => $user[
'LAST_NAME'],
176 'photo' => $arFileTmp[
'src'] ??
null,
177 'gender' => $user[
'PERSONAL_GENDER'] ??
null,
190 $culture = Main\Application::getInstance()->getContext()->getCulture();
191 $dayMonthFormat = Main\Type\Date::convertFormatToPhp($culture->get(
'DAY_MONTH_FORMAT'));
192 $timeFormat = $culture->get(
'SHORT_TIME_FORMAT');
193 $weekDayFormat =
'l';
196 $dayMonth = FormatDate($dayMonthFormat, $timestampUTCWithServerOffset);
197 $time = FormatDate($timeFormat, $timestampUTCWithServerOffset);
198 $weekDay = mb_strtolower(FormatDate($weekDayFormat, $timestampUTCWithServerOffset));
200 return "$dayMonth $time, $weekDay";
211 $culture = Main\Application::getInstance()->getContext()->getCulture();
212 $dayMonthFormat = Main\Type\Date::convertFormatToPhp($culture->get(
'DAY_MONTH_FORMAT'));
213 $weekDayFormat =
'l';
216 $dayMonth = FormatDate($dayMonthFormat, $timestamp);
217 $weekDay = mb_strtolower(FormatDate($weekDayFormat, $timestamp));
219 return "$dayMonth, $weekDay";
230 $culture = Main\Application::getInstance()->getContext()->getCulture();
231 $formatShort = Main\Type\Date::convertFormatToPhp($culture->get(
'FORMAT_DATE'));
244 $isLongDateTimeFormat =
false;
247 $formattedDateFrom = FormatDate($culture->getFullDateFormat(), self::getUserDateTimestamp($from));
248 $formattedDateTo =
'';
249 $formattedTimeFrom =
'';
250 $formattedTimeTo =
'';
257 $isLongDateTimeFormat =
true;
258 $formattedDateTo = FormatDate($culture->getFullDateFormat(), self::getUserDateTimestamp($to));
263 if (!isset($formattedDateTo))
265 $formattedDateTo = FormatDate($culture->getFullDateFormat(), self::getUserDateTimestamp($to));
270 $formattedTimeFrom = FormatDate($culture->getShortTimeFormat(), self::getUserDateTimestamp($from));
271 $formattedTimeTo = FormatDate($culture->getShortTimeFormat(), self::getUserDateTimestamp($to));
276 if ($isLongDateTimeFormat)
278 return $formattedDateFrom .
" - " . $formattedDateTo;
284 if ($isLongDateTimeFormat)
286 return $formattedDateFrom .
' ' . $formattedTimeFrom .
' - ' . $formattedDateTo .
' ' . $formattedTimeTo;
289 return $formattedDateFrom .
' ' . $formattedTimeFrom .
' - ' . $formattedTimeTo;
302 $time = new \DateTime(
'now', $timezone->
getTimeZone());
303 $utcOffset .=
" " . $time->format(
'P');
306 return "($utcOffset) " . $timezone->
toString();
315 $dateTimezone = new \DateTimeZone($date->
getFields()[
'timezone']);
316 $serverTimezone = (new \DateTime())->getTimezone();
318 $dateOffset = $dateTimezone->getOffset(
new \
DateTime());
319 $serverOffset = $serverTimezone->getOffset(
new \
DateTime());
320 $offset = - $serverOffset + $dateOffset;
322 $userDate = clone $date;
325 return $userDate->getTimestamp();
335 return \Bitrix\Calendar\Util::getDateTimestampUtc($date, $eventTimezone);
353 if (array_key_exists($linkType,
Sharing\
Link\Helper::LIFETIME))
355 $result = $dateTime->
add(
Sharing\
Link\Helper::LIFETIME[$linkType]);
373 return self::getAbuseLink($ownerId, $calendarLink, self::ABUSE_SENDER_PAGE);
378 return self::getAbuseLink($ownerId, $calendarLink, self::ABUSE_SENDER_EMAIL);
381 private static function getAbuseLink(
int $ownerId,
string $calendarLink,
string $senderPage): ?string
383 if (!Main\Loader::includeModule(
'bitrix24'))
390 $feedbackForm =
new FeedbackForm(
'calendar_sharing_abuse');
391 $presets = $feedbackForm->getPresets();
393 'hostname' => $presets[
'hostname'],
394 'b24_plan' => $presets[
'b24_plan'],
395 'sender_page' => $senderPage,
396 'admin_data' => \COption::GetOptionString(
'main',
'email_from',
''),
397 'user_data' =>
"id: {$owner['id']}, name: {$owner['name']} {$owner['lastName']}",
398 'calendar_link' => $calendarLink,
401 $formParamsQuery = http_build_query($formParams);
403 $region = Main\Application::getInstance()->getLicense()->getRegion();
404 return AbuseZoneMap::getLink($region) .
"?$formParamsQuery";
409 if (!Main\Loader::includeModule(
'bitrix24'))
414 $region = Main\Application::getInstance()->getLicense()->getRegion();
415 $abuseLink = AbuseZoneMap::getLink($region);
417 $parsedUrl = parse_url($abuseLink);
418 $protocol = $parsedUrl[
'scheme'];
419 $host = $parsedUrl[
'host'];
420 $parsedUri =
new Uri($protocol .
'://' . $host);
422 return rtrim($parsedUri->getLocator(),
'/');
427 $siteDb = Main\SiteTable::getById(SITE_ID);
428 if ($site = $siteDb->fetchObject())
format(string $format=null)
setTime(int $hour, int $minutes, int $seconds)
static getPageAbuseLink(int $ownerId, string $calendarLink)
static formatDate(Date $date)
static getOwnerInfo(int $id)
static getEmailAbuseLink(int $ownerId, string $calendarLink)
static isPhoneFeatureEnabled()
static formatTimeInterval(Date $from, Date $to, bool $isFullDay)
static disableOptionPayAttentionToNewSharingFeature()
static formatDateShort(Date $date)
static getEventTimestampUTC(DateTime $date, ?string $eventTimezone=null)
static payAttentionToNewSharingFeature()
static getShortUrl(string $url)
static getPersonFullNameLoc(?string $name, ?string $lastName)
static isMailFeatureEnabled()
static createSharingLinkExpireDate(?DateTime $dateTime, string $linkType)
static createSharingJointLinkExpireDate(?DateTime $dateTime)
static formatTimezone(DateTimeZone $timezone)
static formatDateWithoutTime(Date $date)
static getUserDateTimestamp(Date $date)
static setCurrentLang($language)
static getMessage($code, $replace=null, $language=null)