"; $depth = 4; $localid = $catid; $path = array(); while(--$depth>=0) { $topcat_id = dbquery("SELECT cat_id, cat_name, top_cat," ." cat_sorting, cat_access" ." FROM ".DB_PREFIX."pdp_cats" ." WHERE cat_id='$localid'"); if(!$topcat_id || dbrows($topcat_id)==0) { break; } $topcat = dbarray($topcat_id); if($localid == $catid) { $access_ok = (pdp_check_access($topcat['cat_access']) ? NULL : $topcat['cat_access']); } if($localid==$catid) { $sorting = $topcat['cat_sorting']; } $localid = $topcat['top_cat']; $path[] = "$bullet " .$topcat['cat_name'].""; //FIXME if($localid['top_cat']==0) { if($localid==0) { break; } } if($depth < 0) { $path[] = ".."; } $path[] = "$bullet ".$locale['PDP820'] .""; if(!$is_did && count($path)) { $path[0] = "$bullet ".strip_tags($path[0]).""; } /*wibix DISPLAY PATH*/ $path = array_reverse($path); $path_str = ""; foreach($path as $entry) { $path_str .= "$entry\n
\n"; } foreach($path as $entry) { $path_str .= "
\n"; } $depth = count($path); /*wibix do not show sub cats on a specific download*/ echo "\n" .""; if($is_did) { echo "\n"; echo "
$path_str
\n"; return $access_ok; } // FIXME need cat_desc? $cats = dbquery("SELECT * FROM ".DB_PREFIX."pdp_cats" ." WHERE top_cat='$catid' ORDER by cat_name"); $depth = ($depth*10); if(iPDP_ADMIN) { $count_where = ""; } elseif(iMEMBER) { $count_where = " AND (dl_status!='".PDP_PRO_OFF."'" ." OR user_id='".$userdata['user_id']."')"; } else { $count_where = " AND dl_status!='".PDP_PRO_OFF."'"; } while($cdata = dbarray($cats)) { if(!pdp_check_access($cdata['cat_access'])) { continue; } $cnt_dl = pdp_count_dl($cdata['cat_id'], $count_where); $cnt_cats = pdp_count_cats($cdata['cat_id']); $more = array(); if($cnt_dl) { $more[] = $cnt_dl." ".$locale['PDP004']; } if($cnt_cats) { $more[] = $cnt_cats." ".$locale['PDP222']; } echo "\n" ."$bullet" ." " .$cdata['cat_name'].""; if(count($more)) { echo " (".implode(" - ", $more).")"; } echo "\n"; } echo "\n"; return $access_ok; } } function show_downloads($catid) { global $pdp_settings, $locale, $sorting, $userdata; $rowstart = 0; if(isset($_GET['rowstart']) && isNum($_GET['rowstart'])) { $rowstart = $_GET['rowstart']; } /* SHOW CAT DOWNLOADS */ if(iPDP_ADMIN) { $where = ""; } elseif(iMEMBER) { $where = "(dl_status!='".PDP_PRO_OFF."'" ." OR dl.user_id='".$userdata['user_id']."') AND "; } else { $where = "(dl_status!='".PDP_PRO_OFF."') AND "; } $query = "SELECT dl.dl_id, dl.dl_name, dl.dl_mtime, dl.dl_count," ." dl.cat_id, dl.version, dl.dl_status, fu.user_name," ." fu.user_id, dl.dl_desc" ." FROM ".DB_PREFIX."pdp_downloads AS dl" ." LEFT JOIN ".DB_PREFIX."users AS fu ON fu.user_id=dl.user_id" ." LEFT JOIN ".DB_PREFIX."pdp_cats AS c ON dl.cat_id=c.cat_id"; $where .= "dl.cat_id='$catid'"; $query .= " WHERE $where"; $query .= " ORDER BY dl.dl_$sorting"; $query .= " LIMIT $rowstart, ".$pdp_settings['per_page']; $query_id = dbquery($query); // show if(dbrows($query_id)) { echo "
"; } $dl_count = dbrows($query_id); while($ddata = dbarray($query_id)) { /*FIXME $dl_ratings = dbquery("SELECT vote_opt, COUNT(*) AS count" ." FROM ".DB_PREFIX."pdp_votes" ." WHERE dl_id='".$ddata['dl_id']."'" ." GROUP BY vote_opt"); $val = 0; $count = 0; while($data = dbarray($dl_ratings)) { $count += $data['count']; $val += intval($data['vote_opt'])*$data['count']; } if($count) { $val = 6 - intval($val/$count); } */ $dl_comments = dbcount("(*)", "pdp_comments", "(dl_id='".$ddata['dl_id']."')"); $render_data = array( "name" => $ddata['dl_name'], "ver" => $ddata['version'], "href" => FUSION_SELF."?did=".$ddata['dl_id'], "desc" => nl2br(parseubb($ddata['dl_desc'])), "user" => "" .$ddata['user_name']."", "date" => showdate("shortdate", $ddata['dl_mtime']), "downloads"=> $ddata['dl_count'], ); pdp_render_dl($render_data, $dl_comments, 0);//$val); if(--$dl_count) { echo "
"; } } $link = FUSION_SELF."?catid=$catid&"; $count = array_shift(dbarray(dbquery("SELECT COUNT(dl.dl_id)" ." FROM ".DB_PREFIX."pdp_downloads AS dl" ." LEFT JOIN ".DB_PREFIX."pdp_cats USING(cat_id)" ." WHERE $where"))); if($count > $pdp_settings['per_page']) { tablebreak(); echo "

" .makePageNav($rowstart, $pdp_settings['per_page'], $count, $count, $link)."
"; } } /* * content of $data array * href: download description * FIXME */ if(!function_exists("pdp_render_dl")) { function pdp_render_dl($data, $comments, $ratings) { global $locale; echo "
" .$data['name']." ".$data['ver']."
" ."".$locale['PDP214']." ".$data['user'] ." ".$data['date']."" ."
" .$locale['PDP004'].": ".$data['downloads']."
" .$locale['PDP021'].": $comments
".$data['desc']."
"; } } /* * GUI */ if(isset($pdp_dl) && $pdp_dl['dl_status']=="N") { pdp_msg(false, $locale['PDP023']); } opentable($pdp_settings['title']); echo $pdp_menu; //$access_group = show_cats2($catid, isset($did), $pdp_settings['hide_cats']); $access_group = show_cats($catid, isset($did), $pdp_settings['hide_cats']); if(!is_null($access_group)) { tablebreak(); if($pdp_settings['hide_cats']) { fallback("error.php?errno=".PDP_EACCESS); } echo "" ."
" .$locale['PDP215']." " .getgroupname($access_group)."
\n"; } //closetable(); // FIXME: position if(is_null($access_group) && !isset($did)) { show_downloads($catid); } if(is_null($access_group) && isset($did)) { tablebreak(); include("did.php"); } else { // show download stats if(!$catid) { $downloads = dbcount("(*)", "pdp_downloads", ""); $files = dbcount("(*)", "pdp_files", ""); $query_id = dbquery("SELECT file_timestamp" ." FROM ".DB_PREFIX."pdp_files" ." ORDER BY file_timestamp DESC LIMIT 1"); if(dbrows($query_id)) { $mtime = array_shift(dbarray($query_id)); } else { $mtime = 0; } echo "

\n" ."".$locale['PDP004'].": $downloads\n" ." - ".$locale['PDP019'].": $files\n"; if($mtime) { echo " - ".$locale['PDP052'].": " .showdate("shortdate", $mtime); } echo "
\n"; } closetable(); } require_once(BASEDIR."side_right.php"); require_once(BASEDIR."footer.php"); ?>