Пример #1
0
// Load the html output class and the model class
require_once JApplicationHelper::getPath('admin_html');
require_once JApplicationHelper::getPath('class');
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
/*
 * This is our main control structure for the component
 *
 * Each view is determined by the $task variable
 */
switch (JRequest::getVar('task')) {
    case 'delete':
        CacheController::deleteCache($cid);
        CacheController::showCache();
        break;
    default:
        CacheController::showCache();
        break;
}
/**
 * Static class to hold controller functions for the Cache component
 *
 * @static
 * @package		Joomla
 * @subpackage	Weblinks
 * @since		1.5
 */
class CacheController
{
    /**
     * Show the cache
     *
Пример #2
0
<?php

//included in index.php which has configs.php included already
$base = $GLOBALS['base_url'];
$sort_add = isset($_COOKIE["sort"]) && (int) $_COOKIE["sort"] === 1 ? "**" : "*";
//add 2 * if reverse sorted or 1 * if not, so the correct page can be cached
$url = $_SERVER["REQUEST_URI"] . $sort_add;
$cache = new CacheController($GLOBALS['cache_dir'], $url);
if ($cache->urlInCache() && !$cache->cacheMinutesOverLimit($GLOBALS['max_page_cache_mins'])) {
    echo $cache->pullUrlContentFromCache();
    //echo "cached";
    exit;
}
if ($part_count > 2) {
    goTo404();
    exit;
}
//part-count defined in index.php
$_GET['cat'] = $url_parts[0] !== "" ? $url_parts[0] : $GLOBALS['post_categories'][0];
//cat is first url part or the default cat
$_GET['page'] = $part_count > 1 ? (int) $url_parts[$part_count - 1] : 1;
//page is always last part of url or 1
$cat = $_GET['cat'];
$page = $_GET['page'];
try {
    $db = MongoConnection();
    $db_getter = new MongoGetter($db);
    $parsedown = new Parsedown();
    $post_views = new PostViews($parsedown);
    $post_views->lazy_load_imgs = true;
    //turn on image lazy loading, false to turn off