load("MEMBERS,ACP_STATISTIK"); $info = $db->query_first("SELECT * FROM bb".$n."_stats_options"); $projekt = $info['projekt']; $bau = $info['bau']; $start = $info['start']; $stats_webspace = $info['webspace']; $statperpage = $info['statperpage']; $attach_such = $info['attach_such']; $usergroup_poster_themen = $info['poster_themen_usergroup']; $usergroup_poster_beitrag = $info['poster_beitrag_usergroup']; $usergroup_poster_bytes = $info['poster_bytes_usergroup']; $usergroup_pn_in = $info['pn_in_usergroup']; $usergroup_pn_out = $info['pn_out_usergroup']; $usergroup_seitenaufrufe = $info['seitenaufrufe_usergroup']; $usergroup_bewertung = $info['bewertung_usergroup']; $usergroup_werbende = $info['werbende_usergroup']; $usergroup_onlinetimer = $info['onlinetimer_usergroup']; $permissioncache=array(); $permissioncache=getPermissions(); $tables=array("bb".$n."_users"); $abwesendda=fieldcheck("abwesend",$tables); $werbendda=fieldcheck("gw_g",$tables); $onlineda=fieldcheck("onlinetime",$tables); $result2 = $db->query("SELECT * FROM bb".$n."_stats_table WHERE boxseite=0 ORDER by boxseite ASC, ordner ASC"); while($stats = $db->fetch_array($result2)){ if($onlineda==1 && $stats['statsid']==6) continue; if($werbendda==1 && $stats['statsid']==7) continue; $title=""; # Anzeige aller TOP bezeichnet Stats if(($stats['allowshow']==1 && $stats['art']==1) || ($stats['allowshow']==1 && $stats['art']==2) || ($stats['allowshow']==1 && $stats['art']==3)){ $totalnum=0; $w=0; $i=1; $title=str_replace("{title}",$titel[$stats['statsid']],$stats['otherstats1']); $otherstats .=str_replace("{countlimit}",$stats[countlimit], str_replace("{menu1}",$menu1[$stats['statsid']], str_replace("{menu2}",$menu2[$stats['statsid']], str_replace("{menu3}",$menu3[$stats['statsid']], str_replace("{menu4}",$menu4, $title))))); $tablequery = str_replace("{n}",$n, str_replace("{countlimit}",$stats['countlimit'], str_replace("{attach_such}",$attach_such, str_replace("{usergroup_poster_themen}",$usergroup_poster_themen, str_replace("{usergroup_poster_beitrag}",$usergroup_poster_beitrag, str_replace("{usergroup_poster_bytes}",$usergroup_poster_bytes, str_replace("{usergroup_pn_out}",$usergroup_pn_out, str_replace("{usergroup_pn_in}",$usergroup_pn_in, str_replace("{usergroup_bewertung}",$usergroup_bewertung, str_replace("{usergroup_werbende}",$usergroup_werbende, str_replace("{usergroup_seitenaufrufe}",$usergroup_seitenaufrufe, str_replace("{usergroup_onlinetimer}",$usergroup_onlinetimer, $stats['tablequery'])))))))))))); $ii=1; $result = $db->query("$tablequery"); while($num = $db->fetch_array($result)){ if($stats['statsid']==68 || $stats['statsid']==69) { if($permissioncache[$num[$stats['tablename2']]]['can_view_board'] || $permissioncache[$num[$stats['tablename2']]]['can_view_board']==-1) { $num1[$i] = $num[$stats['tablename1']]; $num2[$i] = $num[$stats['tablename2']]; $num3[$i] = $num[$stats['tablename3']]; $num4[$i] = $num[$stats['tablename4']]; $totalnum+=$num1[$i]; $i++; $ii++; if($ii>$stats['countlimit']) break; } }else if($stats['statsid']==1 || $stats['statsid']==2 || $stats['statsid']==63) { if($permissioncache[$num[$stats['tablename3']]]['can_view_board'] || $permissioncache[$num[$stats['tablename3']]]['can_view_board']==-1) { $num1[$i] = $num[$stats['tablename1']]; $num2[$i] = $num[$stats['tablename2']]; $num3[$i] = $num[$stats['tablename3']]; $num4[$i] = $num[$stats['tablename4']]; $totalnum+=$num1[$i]; $i++; $ii++; if($ii>$stats['countlimit']) break; } }else{ $num1[$i] = $num[$stats['tablename1']]; $num2[$i] = $num[$stats['tablename2']]; $num3[$i] = $num[$stats['tablename3']]; $num4[$i] = $num[$stats['tablename4']]; $totalnum+=$num1[$i]; $i++; } } for ($i = 1;;$i++){ if ($i > $stats['countlimit']) break; $w = $w+$num1[$i]; } if ($w<1) $w=1; $e=1; for ($i = 1;;$i++){ if ($i > $stats['countlimit']) break; if ($num1[$i]==0) continue; if ($e > 10) $e=1; if($num1[$i]){ $percent_float=$num1[$i]*100/$totalnum; $percent=number_format($percent_float,2); }else $percent=0; if($stats['art']==1) $num=number_format($num1[$i], 0, ",", "."); if($stats['art']==2) $num=round($num1[$i]/3600,1); if($stats['art']==3){ list($bytes_size, $bytes_unit) = ByteDown($num1[$i], 3, ($num1[$i] > 0) ? 2 : 0); $num="$bytes_size $bytes_unit"; } $num5=$num1[$i]*98/$w; $grafikzeigen = str_replace("{nr}",$e, str_replace("{num5}",$num5, $stats['grafik'])); if(strlen($num4[$i])>52) $num5=substr($num4[$i],0,52)."..."; else $num5=$num4[$i]; $otherzeigen =str_replace("{imagefolder}",$style['imagefolder'], str_replace("{nr}",$i, str_replace("{num2}",$num2[$i], str_replace("{num3}",$num3[$i], str_replace("{num1}",$num, str_replace("{percent}",$percent, str_replace("{num4}",$num4[$i], str_replace("{num5}",$num5, str_replace("{num6}","Dabei seit: ".formatdate($wbbuserdata['dateformat'],$num4[$i]), str_replace("{grafik}",$grafikzeigen, str_replace("{session}",$session['hash'],$stats['otherstats2']))))))))))); $otherstats .= $otherzeigen; $e++; } $otherstats .= ""; } # Anzeige der 6 meistbenutzen Avatars if($stats['allowshow']==1 && $stats['art']==5){ $tablequery=str_replace("{n}","$n", str_replace("{countlimit}","$stats[countlimit]",$stats['tablequery'])); $result = $db->query("$tablequery"); $colspan=mysql_num_rows($result); $i=1; $title=str_replace("{title}",$titel[$stats['statsid']], str_replace("{colspan}","$colspan",$stats['otherstats1'])); while($num = $db->fetch_array($result)){ $num1[$i] = $num[$stats['tablename1']]; $num2[$i] = $num[$stats['tablename2']]; $num3[$i] = $num[$stats['tablename3']]; $i++; } if ($num3[1]==0) break; $otherstats .= $title; for ($i = 1;;$i++){ if ($i > $stats['countlimit']) break; if ($num3[$i]==0) continue; if($num3[$i]>1 || $num3[$i]==0){ $mitglieder="Mitglieder"; $benutzt="en"; }else{ $mitglieder="Mitglied"; $benutzt="t"; } $otherzeigen=str_replace("{num2}",$num2[$i], str_replace("{num3}",$num3[$i], str_replace("{mitglieder}",$mitglieder, str_replace("{benutzt}",$benutzt, str_replace("{max_avatar_height}","90", str_replace("{num1}",$num1[$i],$stats['otherstats2'])))))); $otherstats .= $otherzeigen; } $otherstats .= ""; } # Anzeige der Board-Statistik if($stats['allowshow']==1 && $stats['art']==6){ $rekorddate = formatdate($wbbuserdata['dateformat'],$rekordtime); $rekordtime = formatdate($wbbuserdata['timeformat'],$rekordtime); list($registers) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_users WHERE activation = 1"); $guestcount=0; $membercount=0; $invisiblecount=0; $result = $db->unbuffered_query("SELECT s.userid, username, useronlinegroupid, useronlinemarking, invisible FROM bb".$n."_sessions s LEFT JOIN bb".$n."_users u USING (userid) LEFT JOIN bb".$n."_groups g ON g.groupid=u.useronlinegroupid WHERE s.lastactivity >= '".(time()-60*$useronlinetimeout)."'".(($wbbuserdata['ignorelist']) ? (" AND s.userid NOT IN (".str_replace(" ",",",$wbbuserdata['ignorelist']).")") : (""))." ORDER BY u.username ASC"); while($row = $db->fetch_array($result)) { if($row['userid']==0) { $guestcount++; continue; } $membercount++; if($row['invisible']==1) $invisiblecount++; } $allusercount=$membercount+$guestcount; $otherstats .=str_replace("{title}",$titel[$stats['statsid']],$stats['otherstats1']); # Boxseite Links $otherstats .= ""; # Boxseite Rechts $otherstats .= "
"; $result3=$db->query("SELECT * FROM bb".$n."_stats_table WHERE boxseite=1 ORDER by boxseite ASC, ordner ASC"); while($stats2=$db -> fetch_array($result3)){ if($stats2['allowshow']==1 && $stats2['statsid']==50) list($allposts) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_posts"); if($stats2['allowshow']==1 && $stats2['statsid']==51) list($allthreads) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_threads"); if($stats2['allowshow']==1 && $stats2['statsid']==61) list($allpms) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_privatemessage"); if($stats2['allowshow']==1 && $stats2['statsid']==62) list($allattachment) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_attachments"); if($abwesendda==1 && $stats2['statsid']==13) continue; if($stats2['allowshow']==1){ $tablequery = str_replace("{n}","$n", str_replace("{suchdate}",strtotime (date ("Y-m-d")), $stats2['tablequery'])); if(strlen($tablequery) > 1) $result = $db->query_first("$tablequery"); $num1 = $result[0]; $num3 = $result['userid']; $otherzeigen = str_replace("{imagefolder}",$style['imagefolder'], str_replace("{gifimage}","$stats2[grafik]", str_replace("{title}",$titel[$stats2['statsid']], str_replace("{projekt}","$projekt", str_replace("{bau}","$bau", str_replace("{start}","$start", str_replace("{inhalt}","$num1", str_replace("{guestcount}","$guestcount", str_replace("{membercount}","$membercount", str_replace("{invisiblecount}","$invisiblecount", str_replace("{allusercount}","$allusercount", str_replace("{session}","$session[hash]", str_replace("{num3}","$num3", str_replace("{board}","$master_board_name", str_replace("{record}","$rekord", str_replace("{recorddatum}","$rekorddate", str_replace("{recordzeit}","$rekordtime", str_replace("{beitraege}",sprintf("%.2f",$allposts/$registers), str_replace("{themen}",sprintf("%.2f",$allthreads/$registers), str_replace("{pms}",sprintf("%.2f",$allpms/$registers), str_replace("{attachment}",sprintf("%.2f",$allattachment/$registers), str_replace("{seiteheute}","$wbbip_detail[1]", str_replace("{seitegesamt}","$wbbip_detail[2]", str_replace("{besucherheute}","$wbbip_detail[3]", str_replace("{besuchergesamt}","$wbbip_detail[4]", $stats2['otherstats1']))))))))))))))))))))))))); $otherstats2 .= $otherzeigen; } } $otherstats .= $otherstats2; $otherstats .= "
"; $result3 = $db -> query("SELECT * FROM bb".$n."_stats_table WHERE boxseite=2 ORDER by boxseite ASC, ordner ASC"); while($stats2=$db -> fetch_array($result3)){ if($stats3['allowshow']==1 && $stats3['statsid']==50) list($allposts) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_posts"); if($stats3['allowshow']==1 && $stats3['statsid']==51) list($allthreads) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_threads"); if($stats3['allowshow']==1 && $stats3['statsid']==61) list($allpms) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_privatemessage"); if($stats3['allowshow']==1 && $stats3['statsid']==62) list($allattachment) = $db->query_first("SELECT COUNT(*) FROM bb".$n."_attachments"); if($abwesendda==1 && $stats2['statsid']==13) continue; if($stats2['allowshow']==1){ $tablequery = str_replace("{n}","$n", str_replace("{suchdate}",strtotime (date ("Y-m-d")), $stats2['tablequery'])); if(strlen($tablequery) > 0) $result = $db->query_first("$tablequery"); $num1 = $result[0]; $num3 = $result['userid']; $otherzeigen = str_replace("{imagefolder}",$style['imagefolder'], str_replace("{gifimage}","$stats2[grafik]", str_replace("{title}",$titel[$stats2['statsid']], str_replace("{projekt}","$projekt", str_replace("{bau}","$bau", str_replace("{start}","$start", str_replace("{inhalt}","$num1", str_replace("{session}","$session[hash]", str_replace("{num3}","$num3", str_replace("{board}","$master_board_name", str_replace("{record}","$rekord", str_replace("{recorddatum}","$rekorddate", str_replace("{recordzeit}","$rekordtime", str_replace("{beitraege}",sprintf("%.2f",$allposts/$registers), str_replace("{themen}",sprintf("%.2f",$allthreads/$registers), str_replace("{pms}",sprintf("%.2f",$allpms/$registers), str_replace("{attachment}",sprintf("%.2f",$allattachment/$registers), str_replace("{seiteheute}","$wbbip_detail[1]", str_replace("{seitegesamt}","$wbbip_detail[2]", str_replace("{besucherheute}","$wbbip_detail[3]", str_replace("{besuchergesamt}","$wbbip_detail[4]", $stats2['otherstats1']))))))))))))))))))))); $otherstats3 .= $otherzeigen; } } $otherstats .= $otherstats3; $otherstats .="
"; } # Anzeige der Server-Datenbank-Webspace,PHP Daten if($stats['allowshow']==1 && $stats['art']==7){ $table_data = 0; $table_idx = 0; $db_all_record=0; $db_all = 0; $result = $db->query("SHOW TABLE STATUS"); while ($row = $db->fetch_array($result)) { $table_data += $row['Data_length']; $table_idx += $row['Index_length']; $db_all_record +=$row['Rows']; } $db_all = $table_data + $table_idx; $user_home = "$document_root\n"; exec("du -s $user_home", $du); $phpversion="".phpversion().""; $brugtplads = split(" ", $du[0]); $brugtplads = $brugtplads[0] / 1024; $pladstilbage = $stats_webspace - $brugtplads; $p = $stats_webspace / 100; $p_brugtplads = round($brugtplads / $p); $p_pladstilbage = round($pladstilbage / $p); $gesamt = "$stats_webspace MB (100%)"; $verbraucht ="".afrunding($brugtplads)." MB ($p_brugtplads%)\n"; $frei ="".afrunding($pladstilbage)." MB ($p_pladstilbage%)\n"; $result = $db->query_first("show variables like 'version'"); list($bytes_size, $bytes_unit) = ByteDown($db_all, 3, ($db_all > 0) ? 2 : 0); $otherzeigen = str_replace("{title}",$titel[$stats['statsid']], str_replace("{dwsp1}",$dwsp[1], str_replace("{dwsp2}",$dwsp[2], str_replace("{dwsp3}",$dwsp[3], str_replace("{dwsp4}",$dwsp[4], str_replace("{dwsp5}",$dwsp[5], str_replace("{dwsp6}",$dwsp[6], str_replace("{dwsp7}",$dwsp[7], str_replace("{mysqlver}","$result[1]", str_replace("{mysqlmem}","$bytes_size $bytes_unit", str_replace("{mysqlrecord}","".number_format($db_all_record, 0, ",", ".")."", str_replace("{gesamt}",$gesamt, str_replace("{verbraucht}",$verbraucht, str_replace("{frei}",$frei, str_replace("{serverinfo}","".getenv("SERVER_SOFTWARE")."", str_replace("{phpversion}",$phpversion, $stats['otherstats1'])))))))))))))))); $otherstats .= $otherzeigen; } # Anzeige der Tages-Stats if($stats['allowshow']==1 && $stats['art']==8){ $otherstats .= str_replace("{title}",$titel[$stats['statsid']], str_replace("{tages_stats1}",$tages_stats[1], str_replace("{tages_stats2}",$tages_stats[2], str_replace("{tages_stats3}",$tages_stats[3], str_replace("{tages_stats4}",$tages_stats[4], str_replace("{tages_stats5}",$tages_stats[5], str_replace("{tages_stats6}",$tages_stats[6], str_replace("{tages_stats7}",$tages_stats[7], $stats['otherstats1'])))))))); $max = $db->query_first("SELECT max(memberson)AS memberson, max(newthreads)AS newthreads, max(newposts)AS newposts, max(maxuseron)AS maxuseron, max(newpms)AS newpms, max(newregs)AS newregs FROM bb".$n."_stat"); if(!isset($page) || $page=="" || $page==0) $page=1; $result=$db->query_first("SELECT COUNT(time) FROM bb".$n."_stat"); $totalposts=$result[0]; if($totalposts==0){ $otherstats .="$melde1"; } if(isset($_GET['page'])){ $page=intval($_GET['page']); if($page==0) $page=1; } else $page=1; $pages = ceil($totalposts/$statperpage); if($pages>1) $pagelink=makepagelink("statistik.php?sid=$session[hash]",$page,$pages,$showpagelinks-1); $result = $db->query("SELECT * FROM bb".$n."_stat ORDER BY time DESC LIMIT ".($page-1)*$statperpage.",".$statperpage); while ($row = $db->fetch_array($result)){ $time = date("d.m.Y",$row[time]); $num_tag = date("w",$row[time]); $tag = $name_tag[$num_tag]; $time = "$tag, $time"; if($row[newthreads]) $num1=$row[newthreads]*98/$max[newthreads]; else $num1=0; if($row[newposts]) $num2=$row[newposts]*98/$max[newposts]; else $num2=0; if($row[newpms]) $num3=$row[newpms]*98/$max[newpms]; else $num3=0; if($row[maxuseron]) $num4=$row[maxuseron]*98/$max[maxuseron]; else $num4=0; if($row[memberson]) $num5=$row[memberson]*98/$max[memberson]; else $num5=0; if($row[newregs]) $num6=$row[newregs]*98/$max[newregs];else $num6=0; $otherzeigen = str_replace("{time}","$time", str_replace("{newthreads_percent_int}","$num1", str_replace("{newposts_percent_int}","$num2", str_replace("{newpms_percent_int}","$num3", str_replace("{maxuseron_percent_int}","$num4", str_replace("{memberson_percent_int}","$num5", str_replace("{newregs_percent_int}","$num6", str_replace("{maxuserontime}",date("H:i",$row[maxuserontime]), str_replace("{newthreads}","$row[newthreads]", str_replace("{newposts}","$row[newposts]", str_replace("{newpms}","$row[newpms]", str_replace("{maxuseron}","$row[maxuseron]", str_replace("{memberson}","$row[memberson]", str_replace("{newregs}","$row[newregs]", str_replace("{imagefolder}",$style['imagefolder'], $stats['otherstats2']))))))))))))))); $otherstats .= $otherzeigen; } # Errechnen des Durchschnitts $wid = 100; $result = $db->query_first("SELECT sum(memberson), count(memberson), sum(newthreads), count(newthreads), sum(newposts), count(newposts), sum(maxuseron), count(maxuseron), sum(newpms), count(newpms), sum(newregs), count(newregs), sum(maxuserontime), count(maxuserontime) FROM bb".$n."_stat"); $time = $tages_stats[8]; if($max[newthreads]) $num1 = floor($result[2]/$result[3]); if($max[newthreads]) $newthreads_percent_float = $num1*$wid/$max[newthreads];else $newthreads_percent_float=0; $newthreads_percent_int = floor($newthreads_percent_float); $num2 = floor($result[4]/$result[5]); if($max[newposts]) $newposts_percent_float = $num2*$wid/$max[newposts];else $newposts_percent_float=0; $newposts_percent_int = floor($newposts_percent_float); $num3 = floor($result[8]/$result[9]); if($max[newpms]) $newpms_percent_float = $num3*$wid/$max[newpms];else $newpms_percent_float=0; $newpms_percent_int = floor($newpms_percent_float); $num4 = floor($result[6]/$result[7]); if($max[maxuseron]) $maxuseron_percent_float = $num4*$wid/$max[maxuseron];else $maxuseron_percent_float=0; $maxuseron_percent_int = floor($maxuseron_percent_float); $num5 = floor($result[0]/$result[1]); if($max[memberson]) $memberson_percent_float = $num5*$wid/$max[memberson];else $memberson_percent_float=0; $memberson_percent_int = floor($memberson_percent_float); $num6 = floor($result[10]/$result[11]); if($max[newregs]) $newregs_percent_float = $num6*$wid/$max[newregs];else $newregs_percent_float=0; $newregs_percent_int = floor($newregs_percent_float); $maxuserontime = floor($result[12]/$result[13]); $maxuserontime = date( "H:i", $maxuserontime); $stat_daybit_final = str_replace("{time}","$time", str_replace("{newthreads_percent_int}",$newthreads_percent_int, str_replace("{newposts_percent_int}",$newposts_percent_int, str_replace("{newpms_percent_int}",$newpms_percent_int, str_replace("{maxuseron_percent_int}",$maxuseron_percent_int, str_replace("{memberson_percent_int}",$memberson_percent_int, str_replace("{newregs_percent_int}",$newregs_percent_int, str_replace("{maxuserontime}",$maxuserontime, str_replace("{newthreads}",$num1, str_replace("{newposts}",$num2, str_replace("{newpms}",$num3, str_replace("{maxuseron}",$num4, str_replace("{memberson}",$num5, str_replace("{newregs}",$num6, str_replace("{imagefolder}",$style['imagefolder'], $stats['grafik']))))))))))))))); if($pages>1) $otherstats .=" $stat_daybit_final$pagelink"; else $otherstats .=" "; } $num1="";$num2="";$num3="";$num4="";$num5="";$num6=""; if($stats['allowshow']==1) $otherstats .="
"; else $otherstats .=""; } eval("\$tpl->output(\"".$tpl->get("statistik")."\");"); function afrunding($tal){ if (ereg("\.", $tal)){ $tal = split("\.", $tal); $tal[1] = substr($tal[1], 0, 2); $ciffer1 = substr($tal[1], 0, 1); $ciffer2 = substr($tal[1], 1, 2); if ($ciffer2 >= 5) $ciffer1 = $ciffer1 + 1; $tal = "$tal[0].$ciffer1"; } return $tal; } function ByteDown($value, $limes = 6, $comma = 0) { $byteUnits = array('Bytes', 'KB', 'MB', 'GB'); $dh = pow(10, $comma); $li = pow(10, $limes); $return_value = $value; $unit = $byteUnits[0]; if ($value >= $li*1000000) { $value = round($value/(1073741824/$dh))/$dh; $unit = $byteUnits[3]; } else if ($value >= $li*1000) { $value = round($value/(1048576/$dh))/$dh; $unit = $byteUnits[2]; } else if ($value >= $li) { $value = round($value/(1024/$dh))/$dh; $unit = $byteUnits[1]; } if ($unit != $byteUnits[0]) { $return_value = number_format($value, $comma, ",", "."); } else { $return_value = number_format($value, 0, ",", "."); } return array($return_value, $unit); } function fieldcheck($fieldname,$tablename){ global $n,$db,$sqldb; $fieldda=1; $tableda=1; $result = mysql_list_tables($sqldb); for($i=0; $i<$db->num_rows($result); $i++) { if(in_array(mysql_tablename($result,$i),$tablename)){ $tableda=0; break; } } if(($tableda==0) && (strlen($fieldname)>0)){ $result=$db->query("SHOW FIELDS FROM $tablename[0]"); while($row = $db->fetch_array($result)){ if($row['Field']==$fieldname){ $fieldda=0; break; } } } if($tableda==0 && $fieldda==0) $fieldda=0; if(($tableda==0) && (strlen($fieldname)==0)) $fieldda=0; return $fieldda; } ?>