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


PHP Safe::header方法代码示例

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


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

示例1: array

        $fields = array();
        $fields['anchor'] = $anchor->get_reference();
        $fields['description'] = $_REQUEST['message'];
        // this is a continuated contribution from this authenticated surfer
    } elseif ($item['type'] != 'notification' && Surfer::get_id() && (isset($item['create_id']) && Surfer::get_id() == $item['create_id']) && $continuity_limit < $item['edit_date']) {
        $item['description'] .= BR . $_REQUEST['message'];
        $fields = $item;
        // else process the contribution as a new comment
    } else {
        $fields = array();
        $fields['anchor'] = $anchor->get_reference();
        $fields['description'] = $_REQUEST['message'];
    }
    // actual database update
    if (!($fields['id'] = Comments::post($fields))) {
        Safe::header('Status: 500 Internal Error', TRUE, 500);
        die(i18n::s('Your contribution has not been posted.'));
    }
    // touch the related anchor, but don't notify watchers
    $anchor->touch('comment:thread', $fields['id']);
    // clear cache
    Comments::clear($fields);
    // thread update will trigger screen repaint through separate pending call of this script
    die('OK');
    // get some updates
} else {
    // we are running
    global $pending;
    $pending = TRUE;
    // invoked on shutdown
    function on_shutdown()
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:thread.php

示例2: fpassthru

                    return;
                }
                // actual transmission except on a HEAD request
                if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
                    fpassthru($handle);
                }
                fclose($handle);
            }
            // the post-processing hook, then exit even on HEAD
            finalize_page();
            return;
        }
        // redirect to the actual file
        $target_href = $context['url_to_home'] . $context['url_to_root'] . Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']);
    }
    // let the web server provide the actual file
    if (!headers_sent()) {
        Safe::header('Status: 302 Found', TRUE, 302);
        Safe::header('Location: ' . $target_href);
        // this one may be blocked by anti-popup software
    } else {
        $context['site_head'] .= '<meta http-equiv="Refresh" content="1;url=' . $target_href . '" />' . "\n";
    }
    // help the surfer
    $context['text'] .= '<p>' . i18n::s('You are requesting the following file:') . '</p>' . "\n";
    $context['text'] .= '<p><a href="' . encode_field($target_href) . '">' . basename($target_href) . '</a></p>' . "\n";
    // automatic or not
    $context['text'] .= '<p>' . i18n::s('The download should start automatically within seconds. Else hit the provided link to trigger it manually.') . '</p>' . "\n";
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:fetch.php

示例3: strip_tags

        $label = $label[1];
    }
    // strip codes
    include_once '../../codes/codes.php';
    $label = Codes::strip($label);
    // remove every html tag
    $label = strip_tags(Safe::html_entity_decode($label));
    // remember this
    $titles[$count] = $label;
    $links[$count] = $url;
    $count++;
}
// cache handling --except on scripts/validate.php
if (!headers_sent() && (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET')) {
    // this is a schockwave object
    Safe::header('Content-Type: application/x-shockwave-flash');
    // enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
    http::expire(1800);
    // the original content
    $page = '';
    for ($index = 0; $index < $count; $index++) {
        $page .= $titles[$index] . ':' . $links[$index] . ':';
    }
    // strong validator
    $etag = '"' . md5($page) . '"';
    // manage web cache
    if (http::validate(NULL, $etag)) {
        return;
    }
}
include_once 'infuncs.php';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:slashdot.php

示例4: count

            if (($owner_id = $parent->get_value('owner_id')) && ($user = Users::get($owner_id)) && $user['email']) {
                $owners[] = $user['id'];
            }
            $reference = $parent->get_value('anchor');
        }
        // suggest to query one of available owners
        if ($owners) {
            $context['text'] .= '<div>' . i18n::ns('Following person is entitled to invite you to participate:', 'Following persons are entitled to invite you to participate:', count($owners)) . '</div>';
            // the form
            $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>' . Users::list_for_ids($owners, 'request') . Skin::finalize_list(array(Skin::build_submit_button(i18n::s('Submit a request to get access'))), 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '">' . '</div></form>';
        }
    }
    // re-enforce the canonical link
} elseif (!$zoom_type && $page == 1 && $context['self_url'] && $whole_rendering && strncmp($context['self_url'], $context['page_link'], strlen($context['page_link']))) {
    Safe::header('Status: 301 Moved Permanently', TRUE, 301);
    Safe::header('Location: ' . $context['page_link']);
    Logger::error(Skin::build_link($context['page_link']));
    // display the article
} else {
    // behaviors can change page menu
    if (is_object($behaviors)) {
        $context['page_menu'] = $behaviors->add_commands('articles/view.php', 'article:' . $item['id'], $context['page_menu']);
    }
    // remember surfer visit
    Surfer::is_visiting(Articles::get_permalink($item), Codes::beautify_title($item['title']), 'article:' . $item['id'], $item['active']);
    // increment silently the hits counter if not robot, nor associate, nor owner, nor at follow-up page
    if (Surfer::is_crawler() || Surfer::is_associate()) {
    } elseif (isset($item['owner_id']) && Surfer::is($item['owner_id'])) {
    } elseif (!$zoom_type) {
        $item['hits'] = isset($item['hits']) ? $item['hits'] + 1 : 1;
        Articles::increment_hits($item['id']);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例5: build


//.........这里部分代码省略.........
         }
     }
     // if user has supplied additional min and max values [to expand to, not collapse]
     if (!empty($options['min']) && $this->lower > $options['min']) {
         $this->lower = $options['min'];
     }
     if (!empty($options['max']) && $this->upper < $options['max']) {
         $this->upper = $options['max'];
     }
     if ($this->lower == $this->upper) {
         $this->upper += 0.5;
         $this->lower -= 0.5;
     }
     $this->fudge = 0;
     $zero = $this->ScaleForBitmap($zero);
     if (!($zero & 1) && $this->aa) {
         $this->fudge = 1;
         $zero++;
     }
     // we can provide color bands to give some visual indications of scale
     if (!empty($zone)) {
         $zone = explode(",", $zone);
         for ($i = 0; $i < count($zone) >> 1; $i++) {
             imagefilledrectangle($im, 0, $this->ScaleForBitmap($zone[$i * 2 + 1]), $w, $this->ScaleForBitmap($zone[$i * 2]), $this->tint);
         }
     }
     if (!$this->gap) {
         $this->gap = 0;
     }
     $this->gap *= 0.5;
     // shave half off either end (see below)
     for ($i = 0; $i < $w; $i++) {
         if ($this->order == 2) {
             $x = $i * (count($series) - 2) / $w;
             $f = $x - (int) $x;
             $y = ($series[$x] * (1 - ($f * 0.5 + 0.5)) + $series[$x + 1] * ($f * 0.5 + 0.5)) * (1 - $f) + ($series[$x + 1] * (1 - $f * 0.5) + $series[$x + 2] * $f * 0.5) * $f;
         } else {
             if ($this->order == 1) {
                 $x = $i * (count($series) - 1) / $w;
                 $f = $x - (int) $x;
                 $y = $series[$x] * (1 - $f) + $series[$x + 1] * $f;
             } else {
                 $x = $i * count($series) / $w;
                 $f = $x - (int) $x;
                 $y = $series[$x];
             }
         }
         if ($this->gap && ($f < $this->gap || $f > 1 - $this->gap)) {
             // per sample gap
             continue;
         }
         $v = $this->ScaleForBitmap($y);
         if ($this->style & 4) {
             $color = $this->ScaleForRange($y);
             // mix the colors
             $color = ((int) (($this->line & 0xff) * $color + ($this->bg & 0xff) * (1 - $color)) & 0xff) + ((int) (($this->line & 0xff00) * $color + ($this->bg & 0xff00) * (1 - $color)) & 0xff00) + ((int) (($this->line & 0xff0000) * $color + ($this->bg & 0xff0000) * (1 - $color)) & 0xff0000);
             imagefilledrectangle($im, $i, 0, $i, $this->h, $color);
         }
         if ($this->style & 2) {
             if ($v <= $zero) {
                 $y1 = $v;
                 $y2 = $zero;
             } else {
                 $y2 = $v + 1;
                 $y1 = $zero + 1;
             }
             imagefilledrectangle($im, $i, $y1, $i, $y2, $this->fill);
         }
         if ($this->style & 1 || !$this->style) {
             if (!empty($last)) {
                 if ($this->order) {
                     imageline($im, $i - 1, $last, $i, $v, $this->line);
                     //imageline($im, $i-1, $last+1, $i, $y+1, $this->line);
                     imageline($im, $i, $last, $i + 1, $v, $this->line);
                 } else {
                     imageline($im, $i - 1, $last, $i - 1, $v, $this->line);
                     imageline($im, $i - 1, $v, $i, $v, $this->line);
                 }
             }
             $last = $v;
         }
     }
     if ($this->aa) {
         $im2 = @imagecreatetruecolor(intval($w * 0.5), intval($this->h * 0.5)) or die("Couldn't initialize new GD image stream");
         imagecopyresampled($im2, $im, 0, 0, 0, 0, imagesx($im2), imagesy($im2), imagesx($im), imagesy($im));
         imagedestroy($im);
         $im = $im2;
     }
     //
     // transfer to the user agent
     //
     // actual transmission except on a HEAD request
     if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
         // doesn't really need to change at all, but added this just in case the algorithm changes
         //		@header("Last-Modified: " . gmdate("D, d M Y H:i:s", intval(time() / 86400) * 86400) . " GMT");
         Safe::header("Content-type: image/png");
         imagepng($im);
         imagedestroy($im);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:sparkline.php

示例6: elseif

// not found
if (!$item['id']) {
    include '../error.php';
    // permission denied
} elseif (!$permitted) {
    // anonymous users are invited to log in or to register
    if (!Surfer::is_logged()) {
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Servers::get_url($item['id'])));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // re-enforce the canonical link
} elseif ($context['self_url'] && ($canonical = $context['url_to_home'] . $context['url_to_root'] . Servers::get_url($item['id'])) && strncmp($context['self_url'], $canonical, strlen($canonical))) {
    Safe::header('Status: 301 Moved Permanently', TRUE, 301);
    Safe::header('Location: ' . $canonical);
    Logger::error(Skin::build_link($canonical));
    // display the server profile
} else {
    $text = '';
    // initialize the rendering engine
    Codes::initialize(Servers::get_url($item['id']));
    // the nick name
    if ($item['host_name'] && Surfer::is_associate()) {
        $details[] = '"' . $item['host_name'] . '"';
    }
    // information on last update
    if ($item['edit_name']) {
        $details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
    }
    // restricted to logged members
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例7: redirect

 /**
  * jump to another web page
  *
  * This function never returns.
  *
  * @param string the target full web address
  */
 public static function redirect($reference)
 {
     global $render_overlaid;
     // stay overlaid if it was asked
     if ($render_overlaid) {
         // stop redirect if param follow_up set to 'close'
         if (isset($_REQUEST['follow_up']) && $_REQUEST['follow_up'] === 'close') {
             exit('job done');
         }
         // add overlaid param
         $reference = http::add_url_param($reference, "overlaid", "Y");
     }
     // the actual redirection directive
     Safe::header('Location: ' . $reference);
     // a message for human beings
     if (!is_callable(array('i18n', 's'))) {
         exit;
     }
     exit(sprintf(i18n::s('Redirecting to %s'), '<a href="' . $reference . '">' . $reference . '</a>'));
 }
开发者ID:rair,项目名称:yacs,代码行数:27,代码来源:safe.php

示例8: switch

    // vaidate notification attributes
    switch ($fields['type']) {
        case 'browse':
            if (!isset($_REQUEST['address'])) {
                Safe::header('Status: 400 Bad Request', TRUE, 400);
                die(i18n::s('Request is invalid.'));
            }
            break;
        case 'hello':
            if (!isset($_REQUEST['message'])) {
                Safe::header('Status: 400 Bad Request', TRUE, 400);
                die(i18n::s('Request is invalid.'));
            }
            break;
        default:
            Safe::header('Status: 400 Bad Request', TRUE, 400);
            die(i18n::s('Request is invalid.'));
    }
    // save in the database
    Notifications::post($fields);
    // thread update will trigger screen repaint through separate pending call of this script
    die('OK');
    // look for some notification
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
    // change session data to extend life of related file
    if (!isset($_SESSION['heartbit'])) {
        $_SESSION['heartbit'] = 0;
    }
    $_SESSION['heartbit']++;
    // refresh the watchdog
    $_SESSION['watchdog'] = time();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:heartbit.php

示例9: strlen

                if ($user['id']) {
                    Users::increment_posts($user['id']);
                }
            }
        }
    }
    // an error has been encountered
    if (is_array($response)) {
        $response = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<response>' . "\n" . '<error>' . $response['faultCode'] . '</error>' . "\n" . '<message>' . $response['faultString'] . '</message>' . "\n" . '</response>';
        // also sets an error at the HTTP level
        Safe::header('Status: 400 Bad Request', TRUE, 400);
        // everything's going fine
    } else {
        $response = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<response>' . "\n" . '<error>0</error>' . "\n" . '</response>';
    }
    // save the response if debug mode
    if ($context['debug_comment'] == 'Y') {
        Logger::remember('comments/post.php: comments post response', $response, 'debug');
    }
    // send the response
    Safe::header('Content-Type: text/xml');
    Safe::header('Content-Length: ' . strlen($response));
    echo $response;
    return;
    // this is not a POST -- assume we have a human being
} else {
    // detail usage rule
    Logger::error(i18n::s('This script supports Comment API and Post-It updates through HTTP POST requests.'));
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:post.php

示例10: str_replace

     }
 }
 //
 // transfer to the user agent
 //
 // send the archive content
 if ($archive = $zipfile->get()) {
     // suggest a download
     Safe::header('Content-Type: application/octet-stream');
     // suggest a name for the saved file
     $file_name = utf8::to_ascii($item['title']) . '.zip';
     Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"');
     // file size
     Safe::header('Content-Length: ' . strlen($archive));
     // already encoded
     Safe::header('Content-Transfer-Encoding: binary');
     // enable 30-minute caching (30*60 = 1800), even through https, to help IE on download
     http::expire(1800);
     // strong validator
     $etag = '"' . md5($archive) . '"';
     // manage web cache
     if (http::validate(NULL, $etag)) {
         return;
     }
     // actual transmission except on a HEAD request
     if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
         echo $archive;
     }
     // the post-processing hook, then exit
     finalize_page(TRUE);
 }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:fetch_all.php

示例11: array

// the path to this page
$context['path_bar'] = array('tools/' => i18n::s('Tools'));
// default page title
$context['page_title'] = i18n::s('Updating thumbnails url');
// stop crawlers
if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Forbidden', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // permission denied
} elseif (!$permitted) {
    // anonymous users are invited to log in or to register
    if (!Surfer::is_logged()) {
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode('tools/populate.php?action=' . $action));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Forbidden', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // forward to the control panel
    $menu = array('tools/' => i18n::s('Tools'));
    $context['text'] .= Skin::build_list($menu, 'menu_bar');
    // create test data
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $text = '';
    if ($action == 'confirmed' && isset($_REQUEST['former_url'])) {
        //add "images/" to url, to be sure to replace only begining
        $former_url = $_REQUEST['former_url'] . 'images/';
        //  I ANALYSE THUMBNAILS IN ARTICLES TABLE
        $text .= Skin::build_block(i18n::s('Analysing thumbnails for articles'), 'title');
        // query to update
        $query = "UPDATE " . SQL::table_name('articles') . " SET ";
        $query .= "thumbnail_url= REPLACE(thumbnail_url,'" . $former_url . "','" . $context['url_to_root'] . "images/')";
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:update_thumbs_url.php

示例12: die_on_invalid

function die_on_invalid()
{
    Safe::header('Status: 400 Bad Request', TRUE, 400);
    die(i18n::s('Request is invalid.'));
}
开发者ID:rair,项目名称:yacs,代码行数:5,代码来源:tree_manager_ajax.php

示例13: send_body

/**
 * dynamically generate the page
 *
 * @see skins/index.php
 */
function send_body()
{
    global $context, $action;
    // check that the user is an admin, but only if there is at least one user record
    $query = "SELECT count(*) FROM " . SQL::table_name('users');
    if (!Surfer::is_associate() && SQL::query($query) !== FALSE) {
        Safe::header('Status: 401 Unauthorized', TRUE, 401);
        echo '<p>' . i18n::s('You are not allowed to perform this operation.') . "</p>\n";
        return;
    }
    // log the current surfer as an associate if not yet the case
    if (!Surfer::is_associate()) {
        $fields = array();
        $fields['id'] = 1;
        $fields['nick_name'] = 'admin';
        $fields['email'] = '';
        $fields['capability'] = 'A';
        Surfer::set($fields);
        echo '<p>' . i18n::s('You have associate privilege') . '</p>';
    }
    // check every table of the database
    if ($action == 'build') {
        // maybe we will have to switch the server off
        $temporary_off = FALSE;
        // ensure nobody else will access the database during the operation
        if (file_exists('../parameters/switch.on')) {
            if (Safe::rename($context['path_to_root'] . 'parameters/switch.on', $context['path_to_root'] . 'parameters/switch.off')) {
                echo BR . i18n::s('The server has been switched off.');
                $temporary_off = TRUE;
            }
            // let concurrent on-going transactions finish properly
            Safe::sleep(3);
            // first installation
        } elseif (!file_exists('../parameters/switch.off')) {
            echo '<p>' . i18n::s('Review provided information and go to the bottom of the page to move forward.') . "</a></p>\n";
        }
        // ensure utf8 character set for this database
        $query = "ALTER DATABASE `" . $context['database'] . "`  DEFAULT CHARACTER SET utf8";
        SQL::query($query);
        // create tables for users
        echo Users::setup();
        // create tables for activities
        echo Activities::setup();
        // create tables for notifications
        include_once '../users/notifications.php';
        echo Notifications::setup();
        // create tables for messages
        echo Mailer::setup();
        // create tables for visits
        include_once '../users/visits.php';
        echo Visits::setup();
        // create tables for sections
        echo Sections::setup();
        // create tables for articles
        echo Articles::setup();
        // create tables for images
        include_once '../images/images.php';
        echo Images::setup();
        // create tables for tables
        include_once '../tables/tables.php';
        echo Tables::setup();
        // create tables for files
        echo Files::setup();
        // create tables for links
        include_once '../links/links.php';
        echo Links::setup();
        // create tables for locations
        include_once '../locations/locations.php';
        echo Locations::setup();
        // create tables for comments
        include_once '../comments/comments.php';
        echo Comments::setup();
        // create tables for categories
        echo Categories::setup();
        // create tables for members
        include_once '../shared/members.php';
        echo Members::setup();
        // create tables for dates
        include_once '../dates/dates.php';
        echo Dates::setup();
        // create tables for servers
        include_once '../servers/servers.php';
        echo Servers::setup();
        // create tables for versions
        include_once '../versions/versions.php';
        echo Versions::setup();
        // create tables for enrolments
        include_once '../shared/enrolments.php';
        echo Enrolments::setup();
        // create tables for values
        include_once '../shared/values.php';
        echo Values::setup();
        // create tables for the cache
        echo Cache::setup();
        // create tables for the php documentation
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:setup.php

示例14: render_raw

     Safe::file_put_contents($cache_id, $text);
 }
 //
 // transfer to the user agent
 //
 // handle the output correctly
 render_raw('text/xml; charset=' . $context['charset']);
 // suggest a name on download
 if (!headers_sent()) {
     if (is_object($anchor)) {
         $file_name = $context['site_name'] . '.comments.' . str_replace(':', '.', $anchor->get_reference()) . '.xml';
     } else {
         $file_name = $context['site_name'] . '.comments.xml';
     }
     $file_name =& utf8::to_ascii($file_name);
     Safe::header('Content-Disposition: inline; filename="' . $file_name . '"');
 }
 // enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
 http::expire(1800);
 // strong validator
 $etag = '"' . md5($text) . '"';
 // manage web cache
 if (http::validate(NULL, $etag)) {
     return;
 }
 // actual transmission except on a HEAD request
 if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
     echo $text;
 }
 // the post-processing hook, then exit
 finalize_page(TRUE);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:feed.php

示例15: render_raw

    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // display the article
} else {
    // file header
    $text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<!DOCTYPE article SYSTEM "' . $context['url_to_home'] . $context['url_to_root'] . 'articles/article.dtd">' . "\n" . '<?xml-stylesheet type="text/css" href="' . $context['url_to_home'] . $context['url_to_root'] . 'articles/article.css" ?>' . "\n";
    // item actual content
    $text .= Articles::to_xml($item, $overlay);
    //
    // transfer to the user agent
    //
    // handle the output correctly
    render_raw('text/xml; charset=' . $context['charset']);
    // suggest a name on download
    if (!headers_sent()) {
        $file_name = utf8::to_ascii(Skin::strip($context['page_title']) . '.xml');
        Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"');
    }
    // enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
    http::expire(1800);
    // strong validator
    $etag = '"' . md5($text) . '"';
    // manage web cache
    if (http::validate(NULL, $etag)) {
        return;
    }
    // actual transmission except on a HEAD request
    if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
        echo $text;
    }
    // the post-processing hook, then exit
    finalize_page(TRUE);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:export.php


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