当前位置: 首页>>代码示例>>PHP>>正文


PHP Safe::ignore_user_abort方法代码示例

本文整理汇总了PHP中Safe::ignore_user_abort方法的典型用法代码示例。如果您正苦于以下问题:PHP Safe::ignore_user_abort方法的具体用法?PHP Safe::ignore_user_abort怎么用?PHP Safe::ignore_user_abort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Safe的用法示例。


在下文中一共展示了Safe::ignore_user_abort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateDocumentPost

    // build the form
    $context['text'] .= Skin::build_form($fields);
    // the submit button
    $context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Send'), i18n::s('Press [s] to submit data'), 's') . '</p>' . "\n";
    // end of the form
    $context['text'] .= '</div></form>';
    // the script used for form handling at the browser
    Page::insert_script('func' . 'tion validateDocumentPost(container) {' . "\n" . '	// letter_title is mandatory' . "\n" . '	if(!container.letter_title.value) {' . "\n" . '		alert("' . i18n::s('No title has been provided.') . '");' . "\n" . '		Yacs.stopWorking();' . "\n" . '		return false;' . "\n" . '	}' . "\n" . '	return true;' . "\n" . '}' . "\n" . "\n" . 'document.main_form.letter_title.focus();' . "\n");
    // no mail in demo mode
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST' && file_exists($context['path_to_root'] . 'parameters/demo.flag')) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation in demonstration mode.'));
    // handle posted data
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    // ensure all letters will be sent even if the browser connection dies
    Safe::ignore_user_abort(TRUE);
    // always archive the letter
    $anchor = Sections::lookup('letters');
    // no section yet, create one
    if (!$anchor) {
        $context['text'] .= i18n::s('Creating a section for archived letters') . BR . "\n";
        $fields['nick_name'] = 'letters';
        $fields['title'] = i18n::c('Archived letters');
        $fields['introduction'] = i18n::c('To remember our previous messages');
        $fields['description'] = i18n::c('YACS puts automatically sent letters into this section.');
        $fields['locked'] = 'Y';
        // no direct contributions
        $fields['index_map'] = 'N';
        // listed only to associates
        $fields['rank'] = 30000;
        // at the end of the list
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:new.php


注:本文中的Safe::ignore_user_abort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。