Ejemplo n.º 1
0
function get_sub_cats($id, $subcategory = false)
{
    global $cat_info;
    $subfound = array();
    if (!$subcategory) {
        $subcategory = array();
        $subcategory[] = $id;
    }
    foreach ($cat_info as $cats) {
        if ($cats['parentid'] == $id) {
            $subfound[] = $cats['id'];
        }
    }
    foreach ($subfound as $parentid) {
        $subcategory[] = $parentid;
        $subcategory = get_sub_cats($parentid, $subcategory);
    }
    return $subcategory;
}
Ejemplo n.º 2
0
 }
 if ($config['related_only_cats'] and $row['category']) {
     $allowed_cats = "";
     $allow_sub_cats = true;
     $all_cats = explode(",", $row['category']);
     $get_cats = array();
     foreach ($all_cats as $value) {
         if ($cat_info[$value]['show_sub']) {
             if ($cat_info[$value]['show_sub'] == 1) {
                 $get_cats[] = get_sub_cats($value);
             } else {
                 $get_cats[] = $value;
             }
         } else {
             if ($config['show_sub_cats']) {
                 $get_cats[] = get_sub_cats($value);
             } else {
                 $get_cats[] = $value;
             }
         }
     }
     $get_cats = implode("|", $get_cats);
     $get_cats = explode("|", $get_cats);
     if (count($get_cats) < 2) {
         $allow_sub_cats = false;
     }
     $get_cats = implode("|", $get_cats);
     if ($config['allow_multi_category']) {
         $where_category = "category regexp '[[:<:]](" . $get_cats . ")[[:>:]]' AND ";
     } else {
         if ($allow_sub_cats) {
Ejemplo n.º 3
0
         $re_url = reset($re_url);
         header("HTTP/1.0 301 Moved Permanently");
         header("Location: {$re_url}{$re_cat}/");
         die("Redirect");
     }
 }
 if (!$category_id) {
     $category_id = 'not detected';
 }
 if ($allow_list[0] != "all") {
     if (!$user_group[$member_id['user_group']]['allow_short'] and !in_array($category_id, $allow_list)) {
         $category_id = 'not detected';
     }
 }
 if ($config['show_sub_cats']) {
     $get_cats = get_sub_cats($category_id);
 } else {
     $get_cats = $category_id;
 }
 if ($cat_info[$category_id]['news_sort'] != "") {
     $news_sort_by = $cat_info[$category_id]['news_sort'];
 }
 if ($cat_info[$category_id]['news_msort'] != "") {
     $news_direction_by = $cat_info[$category_id]['news_msort'];
 }
 if ($cat_info[$category_id]['news_number']) {
     $config['news_number'] = $cat_info[$category_id]['news_number'];
 }
 if ($cstart) {
     $cstart = $cstart - 1;
     $cstart = $cstart * $config['news_number'];