[ PHPXref.com ] [ Generated: Sun Jul 20 18:53:27 2008 ] [ myPHPNuke 1.8.8_8 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> voteinclude.php (source)

   1  <?php
   2  
   3  if ( ! @include_once ( './mainfile.php' ) ) { exit( '!! INCLUDE ERROR. ACCESS DENIED !!' ); }
   4  error_reporting( _E_VALUE );
   5  
   6  
   7  /* vim: set expandtab tabstop=4 shiftwidth=4: */
   8  // +----------------------------------------------------------------------+
   9  // | myPHPNuke Version 188_8 RC2                                          |
  10  // +----------------------------------------------------------------------+
  11  // | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
  12  // +----------------------------------------------------------------------+
  13  // | Support: http://myphpnuke.com/                                       |
  14  // +----------------------------------------------------------------------+
  15  // | Author: myPHPNuke Dev Team                                           |
  16  // +----------------------------------------------------------------------+
  17  // | Copyright:  2001-2004 myPHPNuke Dev Team                            |
  18  // +----------------------------------------------------------------------+
  19  // $Id: voteinclude.php,v 1.4.2.2 2004/04/18 12:45:45 ajvwaay Exp $
  20  
  21  
  22  
  23  
  24  /************************************************************************/
  25  /* PHP-NUKE: Web Portal System                                          */
  26  /* ===========================                                          */
  27  /*                                                                      */
  28  /* Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)            */
  29  /* http://phpnuke.org                                                   */
  30  /*                                                                      */
  31  /* ====================================                                 */
  32  /* Web Links Modified from the original                                 */
  33  /* Copyright (c) 2000 by James Knickelbein                              */
  34  /* Journey Milwaukee (http://www.journeymilwaukee.com)                  */
  35  /*                                                                      */
  36  /* This program is free software. You can redistribute it and/or modify */
  37  /* it under the terms of the GNU General Public License as published by */
  38  /* the Free Software Foundation; either version 2 of the License.       */
  39  /************************************************************************/
  40  
  41  
  42  $outsidevotes = 0;
  43  $anonvotes = 0;
  44  $outsidevoteval = 0;
  45  $anonvoteval = 0;
  46  $regvoteval = 0;
  47  $truecomments = $totalvotesDB;
  48  
  49  extract( $_POST );
  50  
  51  if ( ! isset( $useoutsidevoting ) ) { $useoutsidevoting = 0; }
  52  if ( ! isset( $anonweight ) ) { $anonweight = 1; }
  53  if ( ! isset( $outsideweight ) ) { $outsideweight = 1; }
  54  if ( ! isset( $impactAU ) ) { $impactAU = 0; }
  55  if ( ! isset( $impactOU ) ) { $impactOU = 0; }
  56  
  57  while(list($ratingDB, $ratinguserDB, $ratingcommentsDB)=mysql_fetch_row($voteresult)) {
  58  if ($ratingcommentsDB=="") $truecomments--;
  59      if ($ratinguserDB==$anonymous) {
  60          $anonvotes++;
  61          $anonvoteval += $ratingDB;
  62      }
  63      if ($useoutsidevoting == 1) {
  64          if ($ratinguserDB=='outside') {
  65              $outsidevotes++;
  66              $outsidevoteval += $ratingDB;
  67          }
  68      }
  69      else { $outsidevotes = 0; }
  70  
  71      if ($ratinguserDB!=$anonymous && $ratinguserDB!="outside") { $regvoteval += $ratingDB; }
  72   }
  73   $regvotes = $totalvotesDB - $anonvotes - $outsidevotes;
  74  
  75   # echo "Link ID: $lid   Reg: $regvotes  Unreg:  $anonvotes  Outside:  $outsidevotes<br>";
  76   if ($totalvotesDB == 0) { $finalrating = 0; }
  77       else if ($anonvotes == 0 && $regvotes == 0) {
  78          // Figure Outside Only Vote
  79          # echo "outside ";
  80          $finalrating = $outsidevoteval / $outsidevotes;
  81          $finalrating = number_format($finalrating, 4);
  82       }
  83       else if ($outsidevotes == 0 && $regvotes == 0) {
  84          // Figure Anon Only Vote
  85          # echo "unREG ";
  86          $finalrating = $anonvoteval / $anonvotes;
  87          $finalrating = number_format($finalrating, 4);
  88       }
  89       else if ($outsidevotes == 0 && $anonvotes == 0) {
  90          # echo "REG ";
  91          // Figure Reg Only Vote
  92          $finalrating = $regvoteval / $regvotes;
  93          $finalrating = number_format($finalrating, 4);
  94       }
  95  
  96   else if ($regvotes == 0 && $useoutsidevoting == 1 && $outsidevotes != 0 && $anonvotes != 0 ) {
  97   // Figure Reg and Anon Mix
  98      # echo "REGANONMIX ";
  99      $avgAU = $anonvoteval / $anonvotes;
 100      $avgOU = $outsidevoteval / $outsidevotes;
 101  
 102          if ($anonweight > $outsideweight )
 103          {
 104              // Anon is 'standard weight'
 105          $newimpact = $anonweight / $outsideweight;
 106          $impactAU = $anonvotes;
 107          $impactOU = $outsidevotes / $newimpact;
 108  
 109              $finalrating = ((($avgOU * $impactOU) + ($avgAU * $impactAU)) / ($impactAU + $impactOU));
 110              $finalrating = number_format($finalrating, 4);
 111          }
 112          else {
 113              // Outside is 'standard weight'
 114                  $newimpact = $outsideweight / $anonweight;
 115              $impactOU = $outsidevotes;
 116              $impactAU = $anonvotes / $newimpact;
 117  
 118              $finalrating = ((($avgOU * $impactOU) + ($avgAU * $impactAU)) / ($impactAU + $impactOU));
 119              $finalrating = number_format($finalrating, 4);
 120  
 121          }
 122   }
 123   else {
 124          //REG User vs. Anonymous vs. Outside User Weight Calutions
 125          # echo "ALL ";
 126          $impact = $anonweight;                  // REG users are weighted by the impact.
 127          $outsideimpact = $outsideweight;
 128          if ($regvotes == 0) { $regvotes = 0; }
 129              else { $avgRU = $regvoteval / $regvotes; }
 130          if ($anonvotes == 0) { $avgAU = 0; }
 131              else { $avgAU = $anonvoteval / $anonvotes; }
 132          if ($outsidevotes == 0 ) { $avgOU = 0; }
 133              else { $avgOU = $outsidevoteval / $outsidevotes; }
 134          $impactRU = $regvotes;
 135      if ($anonvotes>=1 && $impact>=1) {
 136              $impactAU = $anonvotes / $impact;
 137      }
 138      if ($outsidevotes>=1 && outsideimpact>=1) {
 139              $impactOU = $outsidevotes / $outsideimpact;
 140      }
 141          $finalrating = (($avgRU * $impactRU) + ($avgAU * $impactAU) + ($avgOU * $impactOU)) / ($impactRU + $impactAU + $impactOU);
 142          $finalrating = number_format($finalrating, 4);
 143        }
 144  
 145  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]