Exemplo n.º 1
0
}
// check content amount for each cat
// get all categories
$sql = "SELECT id FROM " . $config_vars['table_prefix'] . "cats";
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, "Coudnt get cats", '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result)) {
    $cat = new categorie();
    $cat->generate_from_id($row['id']);
    $catarray[] = $cat;
}
foreach ($catarray as $cat) {
    // check how many content is in this cat
    $should_be = $cat->calc_content_amount();
    if ($should_be != $cat->get_content_amount()) {
        $missmatch['type'] = CONTENT_IN_CAT_AMOUNT;
        $missmatch['id'] = $cat->id;
        $missmatch['name'] = $cat->get_name();
        $missmatch['value'] = $cat->get_content_amount();
        $missmatch['should_be'] = $should_be;
        $missmatch_array[] = $missmatch;
    }
    // check child_content_amount
    $calc_child_content_amount = $cat->calc_child_content_amount();
    if ($calc_child_content_amount != $cat->get_child_content_amount()) {
        $missmatch['type'] = CHILD_CONTENT_IN_CAT_AMOUNT;
        $missmatch['id'] = $cat->id;
        $missmatch['name'] = $cat->get_name();
        $missmatch['value'] = $cat->get_child_content_amount();
        $missmatch['should_be'] = $calc_child_content_amount;
Exemplo n.º 2
0
if (intval($HTTP_SESSION_VARS['first_content']) == '') {
    $HTTP_SESSION_VARS['first_content'] = 0;
}
if (!isset($HTTP_GET_VARS['content_per_page'])) {
    if (!isset($HTTP_SESSION_VARS['content_per_page'])) {
        $content_per_page = $userdata['content_per_page'];
        $HTTP_SESSION_VARS['content_per_page'] = $content_per_page;
    } else {
        $content_per_page = $HTTP_SESSION_VARS['content_per_page'];
    }
} else {
    $content_per_page = $HTTP_GET_VARS['content_per_page'];
    $HTTP_SESSION_VARS['content_per_page'] = $content_per_page;
    if ($HTTP_SESSION_VARS['content_per_page'] == -1) {
        $HTTP_SESSION_VARS['first_content'] = 0;
    } elseif ($HTTP_SESSION_VARS['first_content'] + $HTTP_SESSION_VARS['content_per_page'] > $category->get_content_amount()) {
        $HTTP_SESSION_VARS['first_content'] = intval($category->get_content_amount() / $HTTP_SESSION_VARS['content_per_page']) * $HTTP_SESSION_VARS['content_per_page'];
    }
}
$smarty->assign('content_per_page', $content_per_page);
$contents = get_content_of_cat($HTTP_GET_VARS['cat_id'], $HTTP_SESSION_VARS['first_content'], $content_per_page, &$viewable_amount);
$smarty->assign('viewable_total_content', sprintf($lang['viewable_total_content'], $viewable_amount, $category->get_content_amount()));
include "includes/view_thumbs.php";
// build navigtion
if ($content_per_page > 0) {
    $i = 0;
    while ($i * $content_per_page < $viewable_amount) {
        $cat_nav_links[] = $i * $content_per_page;
        $i++;
    }
    // only assign if there is more than 1 page