コード例 #1
0
ファイル: day.php プロジェクト: rair/yacs
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // parse the provided parameter
} else {
    // which day?
    list($year, $month, $day) = explode('/', $target, 3);
    // no more than two years difference with now
    if (abs(mktime(0, 0, 0, $month, $day, $year) - time()) > 31536000 * 2) {
        Safe::header('Status: 401 Unauthorized', TRUE, 401);
        Logger::error(i18n::s('You are not allowed to perform this operation.'));
    } else {
        // cache between modifications
        $cache_id = 'dates/day.php#text#' . $target;
        if (!($text = Cache::get($cache_id))) {
            // draw one day
            if ($items = Dates::list_for_day($year, $month, $day, 'decorated')) {
                $text .= Skin::build_list($items, 'decorated');
            } else {
                $text .= '<p>' . i18n::s('Nothing has been recorded for this date.') . '</p>';
            }
            // robots cannot navigate
            if (!Surfer::is_crawler()) {
                // previous day
                $previous = gmstrftime('%Y/%m/%d', gmmktime(0, 0, 0, $month, $day - 1, $year));
                // next day
                $next = gmstrftime('%Y/%m/%d', gmmktime(0, 0, 0, $month, $day + 1, $year));
                // neighbours
                $neighbours = array(Dates::get_url($previous, 'day'), Skin::build_date($previous, 'standalone'), Dates::get_url($next, 'day'), Skin::build_date($next, 'standalone'), Dates::get_url($year . '/' . $month, 'month'), Dates::get_month_label($year . '/' . $month));
                // links to display previous and next days
                $text .= Skin::neighbours($neighbours, 'slideshow');
            }