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


PHP cache_end函数代码示例

本文整理汇总了PHP中cache_end函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_end函数的具体用法?PHP cache_end怎么用?PHP cache_end使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: dynamic_menu_content

function dynamic_menu_content()
{
    $cache_name = user_is_logged_in() ? 'logged_in_' . $_SESSION['class'] : 'guest';
    if (cache_start($cache_name, CONFIG_CACHE_TIME_DYNAMIC, CONST_CACHE_DYNAMIC_MENU_GROUP)) {
        $entries = db_query_fetch_all('SELECT
                title,
                internal_page,
                permalink,
                url,
                visibility
            FROM
                dynamic_menu
            WHERE
                ' . (user_is_logged_in() ? 'min_user_class <= ' . $_SESSION['class'] . ' AND (visibility = "private" OR visibility = "both")' : 'visibility = "public" OR visibility = "both"') . '
            ORDER BY priority DESC');
        foreach ($entries as $entry) {
            echo '
            <li>
                <a href="', $entry['internal_page'] ? CONFIG_SITE_URL . 'content?show=' . $entry['permalink'] : htmlspecialchars($entry['url']), '">', htmlspecialchars($entry['title']), '</a>
            </li>
            ';
        }
        cache_end($cache_name, CONST_CACHE_DYNAMIC_MENU_GROUP);
    }
}
开发者ID:janglapuk,项目名称:mellivora,代码行数:25,代码来源:dynamic.inc.php

示例2: login_session_refresh

<?php

require '../include/mellivora.inc.php';
login_session_refresh();
header('Content-type: application/json');
if (!isset($_GET['view'])) {
    echo json_error(lang_get('please_request_view'));
    exit;
}
if ($_GET['view'] == 'scoreboard') {
    if (cache_start(CONST_CACHE_NAME_SCORES_JSON, CONFIG_CACHE_TIME_SCORES)) {
        json_scoreboard(array_get($_GET, 'user_type'));
        cache_end(CONST_CACHE_NAME_SCORES_JSON);
    }
} else {
    echo json_error(lang_get('please_request_view'));
    exit;
}
开发者ID:dirvuk,项目名称:mellivora,代码行数:18,代码来源:json.php

示例3: number_format

        echo 'This challenge has been solved by ', number_format($num_correct_solves / $user_count['num'] * 100, 1), '% of users.';
        echo '
       <table class="challenge-table table table-striped table-hover">
       <thead>
       <tr>
         <th>Position</th>
         <th>Team</th>
         <th>Solved</th>
       </tr>
       </thead>
       <tbody>
       ';
        $i = 1;
        foreach ($submissions as $submission) {
            echo '
              <tr>
                <td>', number_format($i), ' ', get_position_medal($i), '</td>
                <td class="team-name"><a href="user.php?id=', htmlspecialchars($submission['user_id']), '">', htmlspecialchars($submission['team_name']), '</a></td>
                <td>', time_elapsed($submission['added'], $submission['available_from']), ' after release (', date_time($submission['added']), ')</td>
              </tr>
              ';
            $i++;
        }
        echo '
       </tbody>
       </table>
         ';
    }
    cache_end('challenge_' . $_GET['id']);
}
foot();
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:31,代码来源:challenge.php

示例4: login_session_refresh

<?php

require '../include/mellivora.inc.php';
login_session_refresh();
head('Home');
if (cache_start('home', CONFIG_CACHE_TIME_HOME)) {
    require CONFIG_PATH_THIRDPARTY . 'nbbc/nbbc.php';
    $bbc = new BBCode();
    $bbc->SetEnableSmileys(false);
    $news = db_query_fetch_all('SELECT * FROM news ORDER BY added DESC');
    foreach ($news as $item) {
        echo '
        <div class="news-container">';
        section_head($item['title']);
        echo '
            <div class="news-body">
                ', $bbc->parse($item['body']), '
            </div>
        </div>
        ';
    }
    cache_end('home');
}
foot();
开发者ID:jpnelson,项目名称:mellivora,代码行数:24,代码来源:home.php

示例5: section_head

    }
    section_head('Hints');
    echo '
        <table id="files" class="table table-striped table-hover">
          <thead>
            <tr>
              <th>Category</th>
              <th>Challenge</th>
              <th>Added</th>
              <th>Hint</th>
            </tr>
          </thead>
          <tbody>
        ';
    foreach ($hints as $hint) {
        echo '
        <tr>
            <td>', htmlspecialchars($hint['category_title']), '</td>
            <td>', htmlspecialchars($hint['title']), '</td>
            <td>', time_elapsed($hint['added']), ' ago</td>
            <td>', htmlspecialchars($hint['body']), '</td>
        </tr>
        ';
    }
    echo '
          </tbody>
        </table>
         ';
    cache_end('hints');
}
foot();
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:31,代码来源:hints.php

示例6: db_select_all

     ';
 } else {
     // write out challenge description
     if ($challenge['description']) {
         echo '
         <div class="challenge-description">
             ', $bbc->parse($challenge['description']), '
         </div> <!-- / challenge-description -->';
     }
     // write out hints
     if (cache_start(CONST_CACHE_NAME_CHALLENGE_HINTS . $challenge['id'], CONFIG_CACHE_TIME_HINTS)) {
         $hints = db_select_all('hints', array('body'), array('visible' => 1, 'challenge' => $challenge['id']));
         foreach ($hints as $hint) {
             message_inline_yellow('<strong>Hint!</strong> ' . $bbc->parse($hint['body']), false);
         }
         cache_end(CONST_CACHE_NAME_CHALLENGE_HINTS . $challenge['id']);
     }
     // write out files
     $files = cache_array_get(CONST_CACHE_NAME_FILES . $challenge['id'], CONFIG_CACHE_TIME_FILES);
     if (!is_array($files)) {
         $files = db_select_all('files', array('id', 'title', 'size', 'md5', 'download_key'), array('challenge' => $challenge['id']));
         cache_array_save($files, CONST_CACHE_NAME_FILES . $challenge['id']);
     }
     if (count($files)) {
         print_attachments($files);
     }
     // only show the hints and flag submission form if we're not already correct and if the challenge hasn't expired
     if (!$challenge['correct_submission_added'] && $time < $challenge['available_until']) {
         if ($remaining_submissions) {
             if ($challenge['num_submissions'] && !$challenge['automark'] && $challenge['marked']) {
                 message_inline_blue('Your submission is awaiting manual marking.');
开发者ID:dirvuk,项目名称:mellivora,代码行数:31,代码来源:challenges.php

示例7: message_error

if (strlen(array_get($_GET, 'code')) != 2) {
    message_error('Please supply a valid country code');
}
$country = db_select_one('countries', array('id', 'country_name', 'country_code'), array('country_code' => $_GET['code']));
if (!$country) {
    message_error('No country found with that code');
}
head($country['country_name']);
if (cache_start('country_' . $_GET['code'], CONFIG_CACHE_TIME_COUNTRIES)) {
    section_head(htmlspecialchars($country['country_name']) . country_flag_link($country['country_name'], $country['country_code'], true), '', false);
    $scores = db_query_fetch_all('
            SELECT
               u.id AS user_id,
               u.team_name,
               u.competing,
               co.id AS country_id,
               co.country_name,
               co.country_code,
               SUM(c.points) AS score,
               MAX(s.added) AS tiebreaker
            FROM users AS u
            LEFT JOIN countries AS co ON co.id = u.country_id
            LEFT JOIN submissions AS s ON u.id = s.user_id AND s.correct = 1
            LEFT JOIN challenges AS c ON c.id = s.challenge
            WHERE u.competing = 1 AND co.id = :country_id
            GROUP BY u.id
            ORDER BY score DESC, tiebreaker ASC', array('country_id' => $country['id']));
    scoreboard($scores);
    cache_end('country_' . $_GET['code']);
}
foot();
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:31,代码来源:country.php

示例8: db_select_all

 }
 // write out hints
 if (cache_start(CONST_CACHE_NAME_CHALLENGE_HINTS . $challenge['id'], CONFIG_CACHE_TIME_HINTS)) {
     $hints = db_select_all('hints', array('body'), array('visible' => 1, 'challenge' => $challenge['id']));
     foreach ($hints as $hint) {
         message_inline_yellow('<strong>Hint!</strong> ' . $bbc->parse($hint['body']), false);
     }
     cache_end(CONST_CACHE_NAME_CHALLENGE_HINTS . $challenge['id']);
 }
 // write out files
 if (cache_start(CONST_CACHE_NAME_FILES . $challenge['id'], CONFIG_CACHE_TIME_FILES)) {
     $files = db_select_all('files', array('id', 'title', 'size', 'md5'), array('challenge' => $challenge['id']));
     if (count($files)) {
         print_attachments($files);
     }
     cache_end(CONST_CACHE_NAME_FILES . $challenge['id']);
 }
 // only show the hints and flag submission form if we're not already correct and if the challenge hasn't expired
 if (!$challenge['correct_submission_added'] && $time < $challenge['available_until']) {
     if ($remaining_submissions) {
         if ($challenge['num_submissions'] && !$challenge['automark'] && $challenge['marked']) {
             message_inline_blue('Your submission is awaiting manual marking.');
         }
         echo '
         <div class="challenge-submit">
             <form method="post" class="form-flag" action="actions/challenges">
                 <textarea name="flag" type="text" class="flag-input form-control" placeholder="Please enter flag for challenge: ', htmlspecialchars($challenge['title']), '"></textarea>
                 <input type="hidden" name="challenge" value="', htmlspecialchars($challenge['id']), '" />
                 <input type="hidden" name="action" value="submit_flag" />';
         form_xsrf_token();
         if (CONFIG_RECAPTCHA_ENABLE_PRIVATE) {
开发者ID:Gustibimo,项目名称:mellivora,代码行数:31,代码来源:challenges.php

示例9: section_head

    }
    section_head('Hints');
    echo '
        <table id="files" class="table table-striped table-hover">
          <thead>
            <tr>
              <th>', lang_get('category'), '</th>
              <th>', lang_get('challenge'), '</th>
              <th>', lang_get('added'), '</th>
              <th>', lang_get('hint'), '</th>
            </tr>
          </thead>
          <tbody>
        ';
    foreach ($hints as $hint) {
        echo '
        <tr>
            <td>', htmlspecialchars($hint['category_title']), '</td>
            <td>', htmlspecialchars($hint['title']), '</td>
            <td>', time_elapsed($hint['added']), ' ago</td>
            <td>', htmlspecialchars($hint['body']), '</td>
        </tr>
        ';
    }
    echo '
          </tbody>
        </table>
         ';
    cache_end(CONST_CACHE_NAME_HINTS);
}
foot();
开发者ID:janglapuk,项目名称:mellivora,代码行数:31,代码来源:hints.php

示例10: login_session_refresh

<?php

require '../include/mellivora.inc.php';
login_session_refresh();
if (!isset($_GET['show'])) {
    message_error(lang_get('please_request_page'));
}
$menu_data = db_select_one('dynamic_menu', array('internal_page'), array('permalink' => $_GET['show']));
if (!is_valid_id($menu_data['internal_page'])) {
    message_error(lang_get('not_a_valid_link'));
}
$content = db_select_one('dynamic_pages', array('id', 'title', 'body', 'visibility', 'min_user_class'), array('id' => $menu_data['internal_page']));
if ($content['visibility'] == 'private') {
    enforce_authentication($content['min_user_class']);
}
head($content['title']);
if (cache_start($content['id'], CONFIG_CACHE_TIME_DYNAMIC, CONST_CACHE_DYNAMIC_PAGES_GROUP)) {
    section_head($content['title']);
    require CONST_PATH_THIRDPARTY . 'nbbc/nbbc.php';
    $bbc = new BBCode();
    $bbc->SetEnableSmileys(false);
    echo $bbc->parse($content['body']);
    cache_end($content['id'], CONST_CACHE_DYNAMIC_PAGES_GROUP);
}
foot();
开发者ID:dirvuk,项目名称:mellivora,代码行数:25,代码来源:content.php

示例11: array

            GROUP BY u.id
            ORDER BY score DESC, tiebreaker ASC', array('user_type' => $user_type['id']));
            scoreboard($scores);
        }
    }
    echo '
        </div>  <!-- / span6 -->

        <div class="col-lg-6">
        ';
    section_head(lang_get('challenges'));
    $categories = db_query_fetch_all('
        SELECT
           id,
           title,
           available_from,
           available_until
        FROM
           categories
        WHERE
           available_from < ' . $now . ' AND
           exposed = 1
        ORDER BY title');
    challenges($categories);
    echo '
        </div> <!-- / span6 -->
    </div> <!-- / row -->
    ';
    cache_end(CONST_CACHE_NAME_SCORES);
}
foot();
开发者ID:azizjonm,项目名称:ctf-engine,代码行数:31,代码来源:scores.php

示例12: cache_end

         echo '
             </ul>
         </div> <!-- / challenge-files -->';
     }
     cache_end('files_' . $challenge['id']);
 }
 // only show the hints and flag submission form if we're
 // not already correct and if the challenge hasn't expired
 if (!$challenge['correct'] && $time < $challenge['available_until']) {
     // write out hints
     if (cache_start('hints_challenge_' . $challenge['id'], CONFIG_CACHE_TIME_HINTS)) {
         $hints = db_select_all('hints', array('body'), array('visible' => 1, 'challenge' => $challenge['id']));
         foreach ($hints as $hint) {
             message_inline_yellow('<strong>Hint!</strong> ' . $bbc->parse($hint['body']), false);
         }
         cache_end('hints_challenge_' . $challenge['id']);
     }
     if ($remaining_submissions) {
         if ($challenge['num_submissions'] && !$challenge['automark'] && !$challenge['marked']) {
             message_inline_blue('Your submission is awaiting manual marking.');
         }
         echo '
         <div class="challenge-submit">
             <form method="post" class="form-flag" action="actions/challenges">
                 <textarea name="flag" type="text" class="form-control" placeholder="Please enter flag for challenge: ', htmlspecialchars($challenge['title']), '"></textarea>
                 <input type="hidden" name="challenge" value="', htmlspecialchars($challenge['id']), '" />
                 <input type="hidden" name="action" value="submit_flag" />';
         form_xsrf_token();
         if (CONFIG_RECAPTCHA_ENABLE_PRIVATE) {
             display_captcha();
         }
开发者ID:jpnelson,项目名称:mellivora,代码行数:31,代码来源:challenges.php

示例13: lang_get

        echo lang_get('challenge_solved_by_percentage', array('solve_percentage' => number_format($num_correct_solves / $user_count['num'] * 100, 1)));
        echo '
       <table class="challenge-table table table-striped table-hover">
       <thead>
       <tr>
         <th>', lang_get('position'), '</th>
         <th>', lang_get('team'), '</th>
         <th>', lang_get('solved'), '</th>
       </tr>
       </thead>
       <tbody>
       ';
        $i = 1;
        foreach ($submissions as $submission) {
            echo '
              <tr>
                <td>', number_format($i), ' ', get_position_medal($i), '</td>
                <td class="team-name"><a href="user.php?id=', htmlspecialchars($submission['user_id']), '">', htmlspecialchars($submission['team_name']), '</a></td>
                <td>', time_elapsed($submission['added'], $submission['available_from']), ' ', lang_get('after_release'), ' (', date_time($submission['added']), ')</td>
              </tr>
              ';
            $i++;
        }
        echo '
       </tbody>
       </table>
         ';
    }
    cache_end(CONST_CACHE_NAME_CHALLENGE . $_GET['id']);
}
foot();
开发者ID:azizjonm,项目名称:ctf-engine,代码行数:31,代码来源:challenge.php

示例14: login_session_refresh

<?php

require '../include/mellivora.inc.php';
login_session_refresh();
send_cache_headers('home', CONFIG_CACHE_TIME_HOME);
head('Home');
if (cache_start(CONST_CACHE_NAME_HOME, CONFIG_CACHE_TIME_HOME)) {
    require CONST_PATH_THIRDPARTY . 'nbbc/nbbc.php';
    $bbc = new BBCode();
    $bbc->SetEnableSmileys(false);
    $news = db_query_fetch_all('SELECT * FROM news ORDER BY added DESC');
    foreach ($news as $item) {
        echo '
        <div class="news-container">';
        section_head($item['title']);
        echo '
            <div class="news-body">
                ', $bbc->parse($item['body']), '
            </div>
        </div>
        ';
    }
    cache_end(CONST_CACHE_NAME_HOME);
}
foot();
开发者ID:RowdyChildren,项目名称:49sd-ctf,代码行数:25,代码来源:home.php

示例15: cache_end

     }
     cache_end('hints_challenge_' . $challenge['id']);
 }
 if ($remaining_submissions) {
     if ($challenge['num_submissions'] && !$challenge['automark'] && $challenge['marked']) {
         message_inline_blue('Your submission is awaiting manual marking.');
     }
     // write out files
     if (cache_start('files_' . $challenge['id'], CONFIG_CACHE_TIME_FILES)) {
         $files = db_select_all('files', array('id', 'title', 'size'), array('challenge' => $challenge['id']));
         $filesDuplicate = db_select_all('files', array('id', 'title', 'size'), array('challenge' => $challenge['cloneOf']));
         if (count($files) || count($filesDuplicate)) {
             print_attachments($files);
             print_attachments($filesDuplicate);
         }
         cache_end('files_' . $challenge['id']);
     }
     echo '
     <div class="challenge-submit">
         <form method="post" class="form-flag" action="actions/challenges">
             <textarea name="flag" type="text" class="flag-input form-control" placeholder="Please enter flag for challenge: ', htmlspecialchars($challenge['title']), '"></textarea>
             <input type="hidden" name="challenge" value="', htmlspecialchars($challenge['id']), '" />
             <input type="hidden" name="action" value="submit_flag" />';
     form_xsrf_token();
     if (CONFIG_RECAPTCHA_ENABLE_PRIVATE) {
         display_captcha();
     }
     echo '<button class="btn btn-sm btn-primary" type="submit" data-countdown="', max($challenge['latest_submission_added'] + $challenge['min_seconds_between_submissions'], 0), '" data-countdown-done="Submit flag">Submit flag</button>';
     if (should_print_metadata($challenge)) {
         echo '<div class="challenge-submit-metadata">';
         print_submit_metadata($challenge);
开发者ID:ZlhlmChZ,项目名称:source-code-mell,代码行数:31,代码来源:challenges.php


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