Example #1
0
function lxClearTemplateCache()
{
    global $DB, $C, $json;
    VerifyAdministrator(TRUE);
    $t = new Template();
    $t->clear_cache();
    $t->cache_dir = "{$GLOBALS['BASE_DIR']}/templates/cache_details";
    $t->clear_cache();
    $t->cache_dir = "{$GLOBALS['BASE_DIR']}/templates/cache_search";
    $t->clear_cache();
    $message = 'All cached templates have been cleared';
    include_once 'includes/message.php';
}
Example #2
0
function ClearCategoryCache($category_id, $path = null)
{
    global $DB;
    if ($path == null) {
        $category = $DB->Row('SELECT * FROM lx_categories WHERE category_id=?', array($category_id));
        $path = $category['path'];
    }
    $t = new Template();
    $t->clear_cache('directory-category.tpl', md5($category_id . '-1'));
    $t->clear_cache('directory-category.tpl', md5($path . '-1'));
    $t->clear_cache('directory-index.tpl');
}
Example #3
0
}
if (!$v->Validate()) {
    $errors = join('<br />', $v->GetErrors());
    $t->assign('error', $errors);
    $t->display('error-nice.tpl');
    exit;
}
// See if this person has rated this link already
$has_rated = FALSE;
if ($account) {
    $has_rated = $DB->Count('SELECT COUNT(*) FROM lx_link_ratings WHERE link_id=? AND (username=? OR submit_ip=?)', array($_REQUEST['link_id'], $account['username'], $_SERVER['REMOTE_ADDR']));
} else {
    $has_rated = $DB->Count('SELECT COUNT(*) FROM lx_link_ratings WHERE link_id=? AND submit_ip=?', array($_REQUEST['link_id'], $_SERVER['REMOTE_ADDR']));
}
// Get link data
$link = $DB->Row('SELECT * FROM lx_links WHERE link_id=?', array($_REQUEST['link_id']));
if (!$has_rated && $link) {
    $link['ratings']++;
    $link['rating_total'] += $_REQUEST['rating'];
    $DB->Update('UPDATE lx_links SET ratings=?,rating_total=?,rating_avg=? WHERE link_id=?', array($link['ratings'], $link['rating_total'], $link['rating_total'] / $link['ratings'], $link['link_id']));
    $DB->Update('INSERT INTO lx_link_ratings VALUES (?,?,?,?)', array($link['link_id'], $account ? $account['username'] : null, $_SERVER['REMOTE_ADDR'], time()));
    $t->cache_dir = 'templates/cache_details';
    $t->clear_cache('directory-link-details.tpl', md5($link['link_id']));
}
$DB->Disconnect();
if ($C['mod_rewrite']) {
    $link['title'] = trewrite($link['title']);
    header("Location: {$C['base_url']}/" . sprintf("{$link['title']}-{$C['page_details']}", $_REQUEST['link_id']) . "?m=rated");
} else {
    header("Location: {$C['base_url']}/details.php?id={$_REQUEST['link_id']}&m=rated");
}