本文整理汇总了PHP中CMain::FinalActions方法的典型用法代码示例。如果您正苦于以下问题:PHP CMain::FinalActions方法的具体用法?PHP CMain::FinalActions怎么用?PHP CMain::FinalActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMain
的用法示例。
在下文中一共展示了CMain::FinalActions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Request
public static function Request($action = '')
{
global $APPLICATION;
if ($_REQUEST['skip_unescape'] !== 'Y') {
CUtil::JSPostUnEscape();
}
// Export calendar
if ($action == 'export') {
// We don't need to check access couse we will check security SIGN from the URL
$sectId = intVal($_GET['sec_id']);
if ($_GET['check'] == 'Y') {
$APPLICATION->RestartBuffer();
if (CCalendarSect::CheckSign($_GET['sign'], intVal($_GET['user']), $sectId > 0 ? $sectId : 'superposed_calendars')) {
echo 'BEGIN:VCALENDAR';
}
CMain::FinalActions();
die;
}
if (CCalendarSect::CheckAuthHash() && $sectId > 0) {
// We don't need any warning in .ics file
error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_PARSE);
CCalendarSect::ReturnICal(array('sectId' => $sectId, 'userId' => intVal($_GET['user']), 'sign' => $_GET['sign'], 'type' => $_GET['type'], 'ownerId' => intVal($_GET['owner'])));
}
} else {
// // First of all - CHECK ACCESS
if (!CCalendarType::CanDo('calendar_type_view', self::$type) || !check_bitrix_sessid()) {
return $APPLICATION->ThrowException(GetMessage("EC_ACCESS_DENIED"));
}
$APPLICATION->ShowAjaxHead();
$APPLICATION->RestartBuffer();
$reqId = intVal($_REQUEST['reqId']);
switch ($action) {
// * * * * * Add and Edit event * * * * *
case 'edit_event':
if (self::$bReadOnly || !CCalendarType::CanDo('calendar_type_view', self::$type)) {
return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED'));
}
$id = intVal($_POST['id']);
if (isset($_POST['section'])) {
$sectId = intVal($_POST['section']);
$_POST['sections'] = array($sectId);
} else {
$sectId = intVal($_POST['sections'][0]);
}
if (self::$type != 'user' || self::$ownerId != self::$userId) {
if (!$id && !CCalendarSect::CanDo('calendar_add', $sectId, self::$userId)) {
return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED'));
}
if ($id && !CCalendarSect::CanDo('calendar_edit', $sectId, self::$userId)) {
return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED'));
}
}
// Default name for events
$_POST['name'] = trim($_POST['name']);
if ($_POST['name'] == '') {
$_POST['name'] = GetMessage('EC_DEFAULT_EVENT_NAME');
}
$remind = array();
if (isset($_POST['remind']['checked']) && $_POST['remind']['checked'] == 'Y') {
$remind[] = array('type' => $_POST['remind']['type'], 'count' => intval($_POST['remind']['count']));
}
$rrule = isset($_POST['rrule_enabled']) ? $_POST['rrule'] : false;
$from_ts = $_POST['from_ts'];
$to_ts = $_POST['to_ts'];
if (isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y' || $rrule) {
$from_ts = self::_fixTimestamp($from_ts);
$to_ts = self::_fixTimestamp($to_ts);
}
$arFields = array("ID" => $id, "DT_FROM_TS" => $from_ts, "DT_TO_TS" => $to_ts, 'NAME' => $_POST['name'], 'DESCRIPTION' => trim($_POST['desc']), 'SECTIONS' => $_POST['sections'], 'COLOR' => $_POST['color'], 'TEXT_COLOR' => $_POST['text_color'], 'ACCESSIBILITY' => $_POST['accessibility'], 'IMPORTANCE' => $_POST['importance'], 'PRIVATE_EVENT' => $_POST['private_event'] == 'Y', 'RRULE' => $rrule, 'LOCATION' => is_array($_POST['location']) ? $_POST['location'] : array(), "REMIND" => $remind, "IS_MEETING" => !!$_POST['is_meeting'], "SKIP_TIME" => isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y');
$arAccessCodes = array();
if (isset($_POST['EVENT_DESTINATION'])) {
foreach ($_POST["EVENT_DESTINATION"] as $v => $k) {
if (strlen($v) > 0 && is_array($k) && !empty($k)) {
foreach ($k as $vv) {
if (strlen($vv) > 0) {
$arAccessCodes[] = $vv;
}
}
}
}
if (!$arFields["ID"]) {
$arAccessCodes[] = 'U' . self::$userId;
}
$arAccessCodes = array_unique($arAccessCodes);
}
$arFields['IS_MEETING'] = !empty($arAccessCodes) && $arAccessCodes != array('U' . self::$userId);
if ($arFields['IS_MEETING']) {
$arFields['ATTENDEES_CODES'] = $arAccessCodes;
$arFields['ATTENDEES'] = CCalendar::GetDestinationUsers($arAccessCodes);
$arFields['MEETING_HOST'] = self::$userId;
$arFields['MEETING'] = array('HOST_NAME' => self::GetUserName($arFields['MEETING_HOST']), 'TEXT' => isset($_POST['meeting_text']) ? $_POST['meeting_text'] : '', 'OPEN' => $_POST['open_meeting'] === 'Y', 'NOTIFY' => $_POST['meeting_notify'] === 'Y', 'REINVITE' => $_POST['meeting_reinvite'] === 'Y');
}
// Userfields for event
$arUFFields = array();
foreach ($_POST as $field => $value) {
if (substr($field, 0, 3) == "UF_") {
$arUFFields[$field] = $value;
}
}
$newId = self::SaveEvent(array('arFields' => $arFields, 'UF' => $arUFFields));
//.........这里部分代码省略.........
示例2: filter
class ImagePreviewSizeFilter implements Bitrix\Main\Type\IRequestFilter
{
/**
* @param array $values
* @return array
*/
public function filter(array $values)
{
if ($values['get']['action'] == 'showFile') {
if ($values['get']['preview'] == 'Y') {
$values['get']['width'] = 204;
$values['get']['height'] = 119;
$values['get']['signature'] = \Bitrix\Disk\Security\ParameterSigner::getImageSignature($values['get']['fileId'], $values['get']['width'], $values['get']['height']);
} else {
unset($values['get']['width'], $values['get']['height']);
}
unset($values['get']['exact']);
} else {
$values['get']['action'] = 'downloadFile';
}
return array('get' => $values['get']);
}
}
\Bitrix\Main\Application::getInstance()->getContext()->getRequest()->addFilter(new ImagePreviewSizeFilter());
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
LocalRedirect(\Bitrix\Main\Application::getInstance()->getContext()->getRequest()->getRequestUri());
}
$controller = new \Bitrix\Disk\DownloadController();
$controller->setActionName($_GET['action'])->exec();
CMain::FinalActions();
die;
示例3: ViewByUser
//.........这里部分代码省略.........
//Handle ETag
$ETag = md5($filename . $filesize . $filetime);
if (array_key_exists("HTTP_IF_NONE_MATCH", $_SERVER) && $_SERVER['HTTP_IF_NONE_MATCH'] === $ETag) {
CHTTP::SetStatus("304 Not Modified");
header("Cache-Control: private, max-age=" . $cache_time . ", pre-check=" . $cache_time);
die;
}
header("ETag: " . $ETag);
//Handle Last Modified
if ($filetime > 0) {
$lastModified = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';
if (array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] === $lastModified) {
CHTTP::SetStatus("304 Not Modified");
header("Cache-Control: private, max-age=" . $cache_time . ", pre-check=" . $cache_time);
die;
}
}
}
$utfName = CHTTP::urnEncode($attachment_name, "UTF-8");
$translitName = CUtil::translit($attachment_name, LANGUAGE_ID, array("max_len" => 1024, "safe_chars" => ".", "replace_space" => '-'));
if ($force_download) {
//Disable zlib for old versions of php <= 5.3.0
//it has broken Content-Length handling
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}
if ($cur_pos > 0) {
CHTTP::SetStatus("206 Partial Content");
} else {
CHTTP::SetStatus("200 OK");
}
header("Content-Type: " . $content_type);
header("Content-Disposition: attachment; filename=\"" . $translitName . "\"; filename*=utf-8''" . $utfName);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . ($size - $cur_pos + 1));
if (is_resource($src)) {
header("Accept-Ranges: bytes");
header("Content-Range: bytes " . $cur_pos . "-" . $size . "/" . $filesize);
}
} else {
header("Content-Type: " . $content_type);
header("Content-Disposition: inline; filename=\"" . $translitName . "\"; filename*=utf-8''" . $utfName);
}
if ($cache_time > 0) {
header("Cache-Control: private, max-age=" . $cache_time . ", pre-check=" . $cache_time);
if ($filetime > 0) {
header('Last-Modified: ' . $lastModified);
}
} else {
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
}
header("Expires: 0");
header("Pragma: public");
// Download from front-end
if ($fastDownload) {
if ($fromClouds) {
$filename = preg_replace('~^(http[s]?)(\\://)~i', '\\1.', $filename);
$cloudUploadPath = COption::GetOptionString('main', 'bx_cloud_upload', '/upload/bx_cloud_upload/');
header('X-Accel-Redirect: ' . $cloudUploadPath . $filename);
} else {
$filename = $APPLICATION->ConvertCharset($filename, SITE_CHARSET, "UTF-8");
header('X-Accel-Redirect: ' . $filename);
}
} else {
session_write_close();
if ($specialchars) {
echo "<", "pre", ">";
if (is_resource($src)) {
while (!feof($src)) {
echo htmlspecialcharsbx(fread($src, 32768));
}
$file->close();
} else {
echo htmlspecialcharsbx($src->get($filename));
}
echo "<", "/pre", ">";
} else {
if (is_resource($src)) {
$file->seek($cur_pos);
while (!feof($src) && $cur_pos <= $size) {
$bufsize = 131072;
//128K
if ($cur_pos + $bufsize > $size) {
$bufsize = $size - $cur_pos + 1;
}
$cur_pos += $bufsize;
echo fread($src, $bufsize);
}
$file->close();
} else {
$fp = fopen("php://output", "wb");
$src->setOutputStream($fp);
$src->get($filename);
}
}
}
}
CMain::FinalActions();
die;
}