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


PHP rcmail::check_referer方法代码示例

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


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

示例1: array

    $request_check_whitelist = array('login' => 1, 'spell' => 1, 'spell_html' => 1);
    if (!$request_check_whitelist[$RCMAIL->action]) {
        // check client X-header to verify request origin
        if ($OUTPUT->ajax_call) {
            if (rcube_utils::request_header('X-Roundcube-Request') != $RCMAIL->get_request_token()) {
                header('HTTP/1.1 403 Forbidden');
                die("Invalid Request");
            }
        } else {
            if (!empty($_POST) && !$RCMAIL->check_request()) {
                $OUTPUT->show_message('invalidrequest', 'error');
                $OUTPUT->send($RCMAIL->task);
            }
        }
        // check referer if configured
        if ($RCMAIL->config->get('referer_check') && !rcmail::check_referer()) {
            raise_error(array('code' => 403, 'type' => 'php', 'message' => "Referer check failed"), true, true);
        }
    }
}
// we're ready, user is authenticated and the request is safe
$plugin = $RCMAIL->plugins->exec_hook('ready', array('task' => $RCMAIL->task, 'action' => $RCMAIL->action));
$RCMAIL->set_task($plugin['task']);
$RCMAIL->action = $plugin['action'];
// handle special actions
if ($RCMAIL->action == 'keep-alive') {
    $OUTPUT->reset();
    $RCMAIL->plugins->exec_hook('keep_alive', array());
    $OUTPUT->send();
} else {
    if ($RCMAIL->action == 'save-pref') {
开发者ID:netcon-source,项目名称:roundcubemail,代码行数:31,代码来源:index.php

示例2: array

    // don't check for valid request tokens in these actions
    $request_check_whitelist = array('login' => 1, 'spell' => 1);
    // check client X-header to verify request origin
    if ($OUTPUT->ajax_call) {
        if (rcube_utils::request_header('X-Roundcube-Request') != $RCMAIL->get_request_token() && !$RCMAIL->config->get('devel_mode')) {
            header('HTTP/1.1 403 Forbidden');
            die("Invalid Request");
        }
    } else {
        if (!empty($_POST) && !$request_check_whitelist[$RCMAIL->action] && !$RCMAIL->check_request()) {
            $OUTPUT->show_message('invalidrequest', 'error');
            $OUTPUT->send($RCMAIL->task);
        }
    }
    // check referer if configured
    if (!$request_check_whitelist[$RCMAIL->action] && $RCMAIL->config->get('referer_check') && !rcmail::check_referer()) {
        raise_error(array('code' => 403, 'type' => 'php', 'message' => "Referer check failed"), true, true);
    }
}
// we're ready, user is authenticated and the request is safe
$plugin = $RCMAIL->plugins->exec_hook('ready', array('task' => $RCMAIL->task, 'action' => $RCMAIL->action));
$RCMAIL->set_task($plugin['task']);
$RCMAIL->action = $plugin['action'];
// handle special actions
if ($RCMAIL->action == 'keep-alive') {
    $OUTPUT->reset();
    $RCMAIL->plugins->exec_hook('keep_alive', array());
    $OUTPUT->send();
} else {
    if ($RCMAIL->action == 'save-pref') {
        include INSTALL_PATH . 'program/steps/utils/save_pref.inc';
开发者ID:npk,项目名称:roundcubemail,代码行数:31,代码来源:index.php


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