registerFunction( 'onAfterDisplayTitle', 'botVoting' ); function botVoting( $row ) { global $conn,$user_rating,$vote,$vote_id,$lm_type,$pop,$viewtype; if(isset($pop)) return; if(!isset($vote_id))$vote_id=$row['id']; $crow=$conn->GetRow("SELECT * FROM #__content_rating WHERE id=".$row['id']); if(!$crow || !is_array($crow)){ $conn->Execute("INSERT into #__content_rating (id) VALUES(".$row['id'].")"); $crow['rating_count']=0; $crow['rating_sum']=0; $crow['lastip']=''; } if(isset($vote)) { if($_SERVER['REMOTE_ADDR']==$crow['lastip'] && $vote_id==$row['id']) echo _ALREADY_VOTE; else if ( $vote_id==$row['id'] ) { $crow['rating_sum'] = ( $crow['rating_sum'] * $crow['rating_count'] + $user_rating ) / ( $crow['rating_count'] + 1 ) ; $crow['rating_count']++; $conn->Execute("UPDATE #__content_rating SET rating_sum = ".$crow['rating_sum'].", rating_count = ".$crow['rating_count']." , lastip = '".$_SERVER['REMOTE_ADDR']."' WHERE id=".$row['id']); $crow['lastip']=$_SERVER['REMOTE_ADDR']; echo _THANKS; } } $html = ''; if ($viewtype!="archive") { $html .= '
\n"; } if($lm_type=="html")return "