sql_query("select rating, ratinguser, ratingcomments FROM ".$prefix."_links_votedata WHERE ratinglid = $lid"); $totalvotesDB = $db->sql_numrows($voteresult); $anonvotes = 0; $anonvoteval = 0; $outsidevotes = 0; $outsidevoteeval = 0; $regvoteval = 0; $topanon = 0; $bottomanon = 11; $topreg = 0; $bottomreg = 11; $topoutside = 0; $bottomoutside = 11; $avv = array(0,0,0,0,0,0,0,0,0,0,0); $rvv = array(0,0,0,0,0,0,0,0,0,0,0); $ovv = array(0,0,0,0,0,0,0,0,0,0,0); $truecomments = $totalvotesDB; while(list($ratingDB, $ratinguserDB, $ratingcommentsDB)=$db->sql_fetchrow($voteresult)) { if ($ratingcommentsDB=="") $truecomments--; if ($ratinguserDB==$anonymous) { $anonvotes++; $anonvoteval += $ratingDB; } if ($useoutsidevoting == 1) { if ($ratinguserDB=='outside') { $outsidevotes++; $outsidevoteval += $ratingDB; } } else { $outsidevotes = 0; } if ($ratinguserDB!=$anonymous && $ratinguserDB!="outside") { $regvoteval += $ratingDB; } if ($ratinguserDB!=$anonymous && $ratinguserDB!="outside") { if ($ratingDB > $topreg) $topreg = $ratingDB; if ($ratingDB < $bottomreg) $bottomreg = $ratingDB; for ($rcounter=1; $rcounter<11; $rcounter++) if ($ratingDB==$rcounter) $rvv[$rcounter]++; } if ($ratinguserDB==$anonymous) { if ($ratingDB > $topanon) $topanon = $ratingDB; if ($ratingDB < $bottomanon) $bottomanon = $ratingDB; for ($rcounter=1; $rcounter<11; $rcounter++) if ($ratingDB==$rcounter) $avv[$rcounter]++; } if ($ratinguserDB=="outside") { if ($ratingDB > $topoutside) $topoutside = $ratingDB; if ($ratingDB < $bottomoutside) $bottomoutside = $ratingDB; for ($rcounter=1; $rcounter<11; $rcounter++) if ($ratingDB==$rcounter) $ovv[$rcounter]++; } } $regvotes = $totalvotesDB - $anonvotes - $outsidevotes; if ($totalvotesDB == 0) { $finalrating = 0; } else if ($anonvotes == 0 && $regvotes == 0) { /* Figure Outside Only Vote */ $finalrating = $outsidevoteval / $outsidevotes; $finalrating = number_format($finalrating, $detailvotedecimal); $avgOU = $outsidevoteval / $totalvotesDB; $avgOU = number_format($avgOU, $detailvotedecimal); } else if ($outsidevotes == 0 && $regvotes == 0) { /* Figure Anon Only Vote */ $finalrating = $anonvoteval / $anonvotes; $finalrating = number_format($finalrating, $detailvotedecimal); $avgAU = $anonvoteval / $totalvotesDB; $avgAU = number_format($avgAU, $detailvotedecimal); } else if ($outsidevotes == 0 && $anonvotes == 0) { /* Figure Reg Only Vote */ $finalrating = $regvoteval / $regvotes; $finalrating = number_format($finalrating, $detailvotedecimal); $avgRU = $regvoteval / $totalvotesDB; $avgRU = number_format($avgRU, $detailvotedecimal); } else if ($regvotes == 0 && $useoutsidevoting == 1 && $outsidevotes != 0 && $anonvotes != 0 ) { /* Figure Reg and Anon Mix */ $avgAU = $anonvoteval / $anonvotes; $avgOU = $outsidevoteval / $outsidevotes; if ($anonweight > $outsideweight ) { /* Anon is 'standard weight' */ $newimpact = $anonweight / $outsideweight; $impactAU = $anonvotes; $impactOU = $outsidevotes / $newimpact; $finalrating = ((($avgOU * $impactOU) + ($avgAU * $impactAU)) / ($impactAU + $impactOU)); $finalrating = number_format($finalrating, $detailvotedecimal); } else { /* Outside is 'standard weight' */ $newimpact = $outsideweight / $anonweight; $impactOU = $outsidevotes; $impactAU = $anonvotes / $newimpact; $finalrating = ((($avgOU * $impactOU) + ($avgAU * $impactAU)) / ($impactAU + $impactOU)); $finalrating = number_format($finalrating, $detailvotedecimal); } } else { /* REG User vs. Anonymous vs. Outside User Weight Calutions */ $impact = $anonweight; $outsideimpact = $outsideweight; if ($regvotes == 0) { $avgRU = 0; } else { $avgRU = $regvoteval / $regvotes; } if ($anonvotes == 0) { $avgAU = 0; } else { $avgAU = $anonvoteval / $anonvotes; } if ($outsidevotes == 0 ) { $avgOU = 0; } else { $avgOU = $outsidevoteval / $outsidevotes; } $impactRU = $regvotes; $impactAU = $anonvotes / $impact; $impactOU = $outsidevotes / $outsideimpact; $finalrating = (($avgRU * $impactRU) + ($avgAU * $impactAU) + ($avgOU * $impactOU)) / ($impactRU + $impactAU + $impactOU); $finalrating = number_format($finalrating, $detailvotedecimal); } if ($avgOU == 0 || $avgOU == "") { $avgOU = ""; } else { $avgOU = number_format($avgOU, $detailvotedecimal); } if ($avgRU == 0 || $avgRU == "") { $avgRU = ""; } else { $avgRU = number_format($avgRU, $detailvotedecimal); } if ($avgAU == 0 || $avgAU == "") { $avgAU = ""; } else { $avgAU = number_format($avgAU, $detailvotedecimal); } if ($topanon == 0) $topanon = ""; if ($bottomanon == 11) $bottomanon = ""; if ($topreg == 0) $topreg = ""; if ($bottomreg == 11) $bottomreg = ""; if ($topoutside == 0) $topoutside = ""; if ($bottomoutside == 11) $bottomoutside = ""; $totalchartheight = 70; $chartunits = $totalchartheight / 10; $avvper = array(0,0,0,0,0,0,0,0,0,0,0); $rvvper = array(0,0,0,0,0,0,0,0,0,0,0); $ovvper = array(0,0,0,0,0,0,0,0,0,0,0); $avvpercent = array(0,0,0,0,0,0,0,0,0,0,0); $rvvpercent = array(0,0,0,0,0,0,0,0,0,0,0); $ovvpercent = array(0,0,0,0,0,0,0,0,0,0,0); $avvchartheight = array(0,0,0,0,0,0,0,0,0,0,0); $rvvchartheight = array(0,0,0,0,0,0,0,0,0,0,0); $ovvchartheight = array(0,0,0,0,0,0,0,0,0,0,0); $avvmultiplier = 0; $rvvmultiplier = 0; $ovvmultiplier = 0; for ($rcounter=1; $rcounter<11; $rcounter++) { if ($anonvotes != 0) $avvper[$rcounter] = $avv[$rcounter] / $anonvotes; if ($regvotes != 0) $rvvper[$rcounter] = $rvv[$rcounter] / $regvotes; if ($outsidevotes != 0) $ovvper[$rcounter] = $ovv[$rcounter] / $outsidevotes; $avvpercent[$rcounter] = number_format($avvper[$rcounter] * 100, 1); $rvvpercent[$rcounter] = number_format($rvvper[$rcounter] * 100, 1); $ovvpercent[$rcounter] = number_format($ovvper[$rcounter] * 100, 1); if ($avv[$rcounter] > $avvmultiplier) $avvmultiplier = $avv[$rcounter]; if ($rvv[$rcounter] > $rvvmultiplier) $rvvmultiplier = $rvv[$rcounter]; if ($ovv[$rcounter] > $ovvmultiplier) $ovvmultiplier = $ovv[$rcounter]; } if ($avvmultiplier != 0) $avvmultiplier = 10 / $avvmultiplier; if ($rvvmultiplier != 0) $rvvmultiplier = 10 / $rvvmultiplier; if ($ovvmultiplier != 0) $ovvmultiplier = 10 / $ovvmultiplier; for ($rcounter=1; $rcounter<11; $rcounter++) { $avvchartheight[$rcounter] = ($avv[$rcounter] * $avvmultiplier) * $chartunits; $rvvchartheight[$rcounter] = ($rvv[$rcounter] * $rvvmultiplier) * $chartunits; $ovvchartheight[$rcounter] = ($ovv[$rcounter] * $ovvmultiplier) * $chartunits; if ($avvchartheight[$rcounter]==0) $avvchartheight[$rcounter]=1; if ($rvvchartheight[$rcounter]==0) $rvvchartheight[$rcounter]=1; if ($ovvchartheight[$rcounter]==0) $ovvchartheight[$rcounter]=1; } $transfertitle = ereg_replace ("_", " ", $ttitle); $transfertitle = stripslashes($transfertitle); $displaytitle = $transfertitle; $thisLink = $db->sql_fetchrow($db->sql_query("select * from ".$prefix."_links_links where lid='$lid'")); $result = $db->sql_query("select title,cdescription,ldescription,parentid from ".$prefix."_links_categories where cid=$thisLink[cid]"); list($catTitle,$cdescription,$ldescription,$parentid)=$db->sql_fetchrow($result); $catTitle = getparent($parentid,$catTitle); $catTitle = _MAIN."/$catTitle"; $thisLink[linkratingsummary] = number_format($thisLink[linkratingsummary], $mainvotedecimal); $thisLink[title] = stripslashes($thisLink[title]); $thisLink[description] = stripslashes($thisLink[description]); $time = $thisLink[date]; setlocale (LC_TIME, $locale); ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime); $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); $datetime = ucfirst($datetime); echo "
"; OpenTable(); echo "
"._LINKPROFILE.": $displaytitle"; newlinkgraphic($datetime, $time); popgraphic($hits); echo ""; echo "

"._CATEGORY.": $catTitle
"; linkinfomenu($lid, $ttitle); echo "

"._LINKRATINGDET."
" .""._TOTALVOTES." $totalvotesDB
" .""._OVERALLRATING.": $finalrating

"; echo "
$thisLink[description]
"; echo "
"._ADDEDON.": $datetime "._HITS.": $thisLink[hits]"; $transfertitle = str_replace (" ", "_", $thisLink[title]); /* voting & comments stats */ if ($thisLink[totalvotes] == 1) { $votestring = _VOTE; } else { $votestring = _VOTES; } if ($thisLink[linkratingsummary] != "0" || $thisLink[linkratingsummary] != "0.0") { echo " "._RATING.": $thisLink[linkratingsummary] ($thisLink[totalvotes] $votestring)"; } echo "

"; if (is_admin($admin)) { echo "|[ "._EDIT." ]"; } echo "|[ Visit This Site ]|
"; echo "

"; echo "" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" .""; if ($useoutsidevoting == 1) { echo "" ."" ."" ."" ."" ."" ."" ."" .""; } echo "
" .""._REGISTEREDUSERS."" ."
" .""._NUMBEROFRATINGS.": $regvotes" .""; if ($regvotes==0) { echo "
"._NOREGUSERSVOTES."
"; } else { echo "
" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."
"._BREAKDOWNBYVAL."
\"$rvv[1]\"$rvv[2]\"$rvv[3]\"$rvv[4]\"$rvv[5]\"$rvv[6]\"$rvv[7]\"$rvv[8]\"$rvv[9]\"$rvv[10]
" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."
12345678910
" ."
"; } echo "
"._LINKRATING.": $avgRU
"._HIGHRATING.": $topreg
"._LOWRATING.": $bottomreg
"._NUMOFCOMMENTS.": $truecomments


"._WEIGHNOTE." $anonweight "._TO." 1.
"._UNREGISTEREDUSERS."
"._NUMBEROFRATINGS.": $anonvotes"; if ($anonvotes==0) { echo "
"._NOUNREGUSERSVOTES."
"; } else { echo "
" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."
"._BREAKDOWNBYVAL."
\"$avv[1]\"$avv[2]\"$avv[3]\"$avv[4]\"$avv[5]\"$avv[6]\"$avv[7]\"$avv[8]\"$avv[9]\"$avv[10]
" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."
12345678910
" ."
"; } echo "
"._LINKRATING.": $avgAU
"._HIGHRATING.": $topanon
"._LOWRATING.": $bottomanon
 


"._WEIGHOUTNOTE." $outsideweight "._TO." 1.
"._OUTSIDEVOTERS."
"._NUMBEROFRATINGS.": $outsidevotes"; if ($outsidevotes==0) { echo "
"._NOOUTSIDEVOTES."
"; } else { echo "
" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."
"._BREAKDOWNBYVAL."
\"$ovv[1]\"$ovv[2]\"$ovv[3]\"$ovv[4]\"$ovv[5]\"$ovv[6]\"$ovv[7]\"$ovv[8]\"$ovv[9]\"$ovv[10]
" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."
12345678910
" ."
"; } echo "
"._LINKRATING.": $avgOU
"._HIGHRATING.": $topoutside
"._LOWRATING.": $bottomoutside
 


"; linkfooter($lid,$ttitle); echo "
"; CloseTable(); @include("footer.php"); } ?>