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();