Exemplo n.º 1
0
if (isset($HTTP_GET_VARS['first_content'])) {
    $HTTP_SESSION_VARS['first_content'] = $HTTP_GET_VARS['first_content'];
}
unset($HTTP_SESSION_VARS['contents']);
if (!isset($HTTP_GET_VARS['cat_id'])) {
    $HTTP_GET_VARS['cat_id'] = $config_vars['root_categorie'];
    $template_file = 'index';
}
// create new categorie
if (isset($HTTP_POST_VARS['newcat'])) {
    $new_cat = new categorie();
    $new_cat->set_parent_id($HTTP_GET_VARS['cat_id']);
    $new_cat->set_name($HTTP_POST_VARS['cat_name']);
    $new_cat->set_description($HTTP_POST_VARS['cat_describtion']);
    if ($HTTP_POST_VARS['cat_is_serie'] == 'on') {
        $new_cat->set_is_serie(1);
    }
    $new_cat->set_catgroup_id($HTTP_POST_VARS['add_to_catgroup']);
    $new_cat->commit();
}
//get the cats in the actual cat and information about them
$child_cats = get_cats_of_cat($HTTP_GET_VARS['cat_id']);
// get the amount of child_cats without perm checking
$sql = "SELECT * FROM " . $config_vars['table_prefix'] . "cats WHERE (parent_id = {$HTTP_GET_VARS['cat_id']})";
if (!($result = $db->sql_query($sql))) {
    error_report(SQL_ERROR, 'get_cats_of_cat', __LINE__, __FILE__, $sql);
}
$child_cats_total_amount = $db->sql_affectedrows($result);
$child_cats_viewable_amount = sizeof($child_cats);
$smarty->assign('viewable_total_cats', sprintf($lang['viewable_total_cats'], $child_cats_viewable_amount, $child_cats_total_amount));
if (isset($HTTP_POST_VARS['edit_cat'])) {