206. File Comparison Report

Produced on Mon May 12 13:05:11 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

206.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\inc\classes BxDolVoting.php Mon Sep 24 10:55:18 2007 UTC
2 Dolphin-v.6.1.0\inc\classes BxDolVoting.php Mon Mar 31 07:47:48 2008 UTC

206.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 7 460
Changed 5 10
Inserted 1 2
Removed 0 0

206.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

206.4 Active regular expressions

No regular expressions were active.

206.5 Comparison detail

1   <?   1   <?
2     2  
3   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . 'BxDolVo tingQuery. php' );   3   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . 'BxDolVo tingQuery. php' );
4   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . 'BxDolMi stake.php'  );   4   require_on ce( BX_DIR ECTORY_PAT H_CLASSES  . 'BxDolMi stake.php'  );
5     5  
    6   define( 'B X_PERIOD_P ER_VOTE',  7 * 86400  );
    7  
6   class BxDo lVoting ex tends BxDo lMistake   8   class BxDo lVoting ex tends BxDo lMistake
7   {   9   {
8       var $_ iId = 0;   // item id  to be rat ed   10       var $_ iId = 0;   // item id  to be rat ed
9       var $_ iCount = 0 ; // numbe r of votes   11       var $_ iCount = 0 ; // numbe r of votes
10       var $_ fRate = 0;  // averag e rate   12       var $_ fRate = 0;  // averag e rate
11       var $_ sSystem =  'profile';  // curren t rating s ystem name        13       var $_ sSystem =  'profile';  // curren t rating s ystem name     
12     14  
13       var $_ aSystem =  array ();  // current  rating sy stem array   15       var $_ aSystem =  array ();  // current  rating sy stem array
14     16  
15       var $_ aSystems =  array (         // a rray of su pported ra te systems   17       var $_ aSystems =  array (         // a rray of su pported ra te systems
16     18  
17           'p rofile' =>  array (   19           'p rofile' =>  array (
18                'table_r ating' =>  'profile_r ating',          // t able for r atings   20                'table_r ating' =>  'profile_r ating',          // t able for r atings
19                'table_t rack' => ' profile_vo ting_track ',    // t able to tr ack duplic ate rating s   21                'table_t rack' => ' profile_vo ting_track ',    // t able to tr ack duplic ate rating s
20                'row_pre fix' => 'p r_',                        // t able rows  prefix   22                'row_pre fix' => 'p r_',                        // t able rows  prefix
21                'max_vot es' => 5,                              // m ax vote   23                'max_vot es' => 5,                              // m ax vote
22                'post_na me' => 'vo te_send_re sult',                        //  post name  where vot e is store d   24                'post_na me' => 'vo te_send_re sult',                        //  post name  where vot e is store d
23                 'is_duplic ate'   =>   86400 ,                       //   time   in   seconds   to   prevent   duplicate   votes,   default   -   1   day   25                 'is_duplic ate'   =>   BX_PERIOD_ PER_VOTE ,                      //   time   in   seconds   to   prevent   duplicate   votes,   default   -   1   day
24                'is_on'  => 1,                                  // i s voting e nabled or  not   26                'is_on'  => 1,                                  // i s voting e nabled or  not
25           ),   27           ),
26     28  
27           'm edia' => a rray (   29           'm edia' => a rray (
28                'table_r ating' =>  'media_rat ing',   30                'table_r ating' =>  'media_rat ing',
29                'table_t rack' => ' media_voti ng_track',   31                'table_t rack' => ' media_voti ng_track',
30                'row_pre fix' => 'm ed_',   32                'row_pre fix' => 'm ed_',
31                'max_vot es' => 5,   33                'max_vot es' => 5,
32                'post_na me' => 'vo te_send_re sult',   34                'post_na me' => 'vo te_send_re sult',
33                 'is_duplic ate'   =>   86400 ,   //   1   day   35                 'is_duplic ate'   =>   BX_PERIOD_ PER_VOTE ,   //   1   day
34                'is_on'  => 1,   36                'is_on'  => 1,
35           ),   37           ),
36     38  
37           'g photo' =>  array (   39           'g photo' =>  array (
38                'table_r ating' =>  'gphoto_ra ting',   40                'table_r ating' =>  'gphoto_ra ting',
39                'table_t rack' => ' gphoto_vot ing_track' ,   41                'table_t rack' => ' gphoto_vot ing_track' ,
40                'row_pre fix' => 'g al_',   42                'row_pre fix' => 'g al_',
41                'max_vot es' => 5,   43                'max_vot es' => 5,
42                'post_na me' => 'vo te_send_re sult',   44                'post_na me' => 'vo te_send_re sult',
43                 'is_duplic ate'   =>   86400 ,   //   1   day   45                 'is_duplic ate'   =>   BX_PERIOD_ PER_VOTE ,   //   1   day
44                'is_on'  => 1,   46                'is_on'  => 1,
45           ),            47           ),         
46     48  
47           'g music' =>  array (   49           'g music' =>  array (
48                'table_r ating' =>  'gmusic_ra ting',   50                'table_r ating' =>  'gmusic_ra ting',
49                'table_t rack' => ' gmusic_vot ing_track' ,   51                'table_t rack' => ' gmusic_vot ing_track' ,
50                'row_pre fix' => 'g al_',   52                'row_pre fix' => 'g al_',
51                'max_vot es' => 5,   53                'max_vot es' => 5,
52                'post_na me' => 'vo te_send_re sult',   54                'post_na me' => 'vo te_send_re sult',
53                 'is_duplic ate'   =>   86400 ,   //   1   day   55                 'is_duplic ate'   =>   BX_PERIOD_ PER_VOTE ,   //   1   day
54                'is_on'  => 1,   56                'is_on'  => 1,
55           ),   57           ),
56     58  
57           'g video' =>  array (   59           'g video' =>  array (
58                'table_r ating' =>  'gvideo_ra ting',   60                'table_r ating' =>  'gvideo_ra ting',
59                'table_t rack' => ' gvideo_vot ing_track' ,   61                'table_t rack' => ' gvideo_vot ing_track' ,
60                'row_pre fix' => 'g al_',   62                'row_pre fix' => 'g al_',
61                'max_vot es' => 5,   63                'max_vot es' => 5,
62                'post_na me' => 'vo te_send_re sult',   64                'post_na me' => 'vo te_send_re sult',
63                 'is_duplic ate'   =>   86400 ,   //   1   day   65                 'is_duplic ate'   =>   BX_PERIOD_ PER_VOTE ,   //   1   day
64                'is_on'  => 1,   66                'is_on'  => 1,
65           ),            67           ),         
66       );   68       );
67     69  
68       var $_ oQuery = n ull;   70       var $_ oQuery = n ull;
69     71  
70       /**   72       /**
71        * Con structor   73        * Con structor
72        */   74        */
73       functi on BxDolVo ting( $sSy stem, $iId , $iInit =  1)   75       functi on BxDolVo ting( $sSy stem, $iId , $iInit =  1)
74       {   76       {
75           $t his->_sSys tem = $sSy stem;   77           $t his->_sSys tem = $sSy stem;
76           if  (isset($t his->_aSys tems[$sSys tem]))   78           if  (isset($t his->_aSys tems[$sSys tem]))
77                $this->_ aSystem =  $this->_aS ystems[$sS ystem];   79                $this->_ aSystem =  $this->_aS ystems[$sS ystem];
78           el se   80           el se
79                return;   81                return;
80     82  
81     83  
82           $t his->_oQue ry = new B xDolVoting Query($thi s->_aSyste m);   84           $t his->_oQue ry = new B xDolVoting Query($thi s->_aSyste m);
83     85  
84           if  ($iInit)    86           if  ($iInit) 
85                $this->i nit($iId);   87                $this->i nit($iId);
86     88  
87           if  (!$this-> isEnabled( )) return;   89           if  (!$this-> isEnabled( )) return;
88     90  
89           $i VoteResult  = $this-> _getVoteRe sult ();   91           $i VoteResult  = $this-> _getVoteRe sult ();
90           if  ($iVoteRe sult)   92           if  ($iVoteRe sult)
91           {   93           {
92                if (!$th is->makeVo te ($iVote Result))   94                if (!$th is->makeVo te ($iVote Result))
93                {   95                {
94                    exit ;   96                    exit ;
95                }   97                }
96                $this->i nitVotes ( );                98                $this->i nitVotes ( );             
97                echo $th is->getVot eRate() .  ',' . $thi s->getVote Count();    99                echo $th is->getVot eRate() .  ',' . $thi s->getVote Count(); 
98                exit;   100                exit;
99           }   101           }
100       }   102       }
101     103  
102       functi on init ($ iId)   104       functi on init ($ iId)
103       {   105       {
104           if  (!$iId)    106           if  (!$iId) 
105                $iId = $ this->_iId ;   107                $iId = $ this->_iId ;
106     108  
107           if  (!$this-> isEnabled( )) return;   109           if  (!$this-> isEnabled( )) return;
108     110  
109           if  (!$this-> iId && $iI d)   111           if  (!$this-> iId && $iI d)
110           {       112           {    
111                $this->s etId($iId) ;            113                $this->s etId($iId) ;         
112           }   114           }
113     115  
114       }   116       }
115     117  
116       functi on initVot es ()   118       functi on initVot es ()
117       {   119       {
118           if  (!$this-> isEnabled( )) return;   120           if  (!$this-> isEnabled( )) return;
119           if  (!$this-> _oQuery) r eturn;   121           if  (!$this-> _oQuery) r eturn;
120     122  
121           $a  = $this-> _oQuery->g etVote ($t his->getId ());   123           $a  = $this-> _oQuery->g etVote ($t his->getId ());
122           if  (!$a) ret urn;   124           if  (!$a) ret urn;
123           $t his->_iCou nt = $a['c ount'];   125           $t his->_iCou nt = $a['c ount'];
124           $t his->_fRat e = $a['ra te'];   126           $t his->_fRat e = $a['ra te'];
125       }   127       }
126          128       
127       functi on makeVot e ($iVote)   129       functi on makeVot e ($iVote)
128       {      130       {   
129           if  (!$this-> isEnabled( )) return  false;   131           if  (!$this-> isEnabled( )) return  false;
130           if  ($this->i sDublicate Vote()) re turn false ;   132           if  ($this->i sDublicate Vote()) re turn false ;
131           if  (!$this-> checkActio n()) retur n false;   133           if  (!$this-> checkActio n()) retur n false;
132              134           
133           re turn $this ->_oQuery- >putVote ( $this->get Id(), $_SE RVER['REMO TE_ADDR'],  $iVote);   135           re turn $this ->_oQuery- >putVote ( $this->get Id(), $_SE RVER['REMO TE_ADDR'],  $iVote);
134       }   136       }
135     137  
136       functi on checkAc tion ()   138       functi on checkAc tion ()
137       {                   139       {                
138           $i Id = $_COO KIE['membe rID'];   140           $i Id = $_COO KIE['membe rID'];
139           $c heck_res =  checkActi on( $iId,  ACTION_ID_ VOTE );   141           $c heck_res =  checkActi on( $iId,  ACTION_ID_ VOTE );
140           re turn $chec k_res[CHEC K_ACTION_R ESULT] ==  CHECK_ACTI ON_RESULT_ ALLOWED;   142           re turn $chec k_res[CHEC K_ACTION_R ESULT] ==  CHECK_ACTI ON_RESULT_ ALLOWED;
141       }   143       }
142          144       
143       functi on isDubli cateVote ( )   145       functi on isDubli cateVote ( )
144       {   146       {
145           if  (!$this-> isEnabled( )) return  false;   147           if  (!$this-> isEnabled( )) return  false;
146           re turn $this ->_oQuery- >isDublica teVote ($t his->getId (), $_SERV ER['REMOTE _ADDR']);   148           re turn $this ->_oQuery- >isDublica teVote ($t his->getId (), $_SERV ER['REMOTE _ADDR']);
147       }   149       }
148     150  
149       functi on getId ( )   151       functi on getId ( )
150       {   152       {
151           re turn $this ->_iId;   153           re turn $this ->_iId;
152       }   154       }
153     155  
154       functi on isEnabl ed ()   156       functi on isEnabl ed ()
155       {   157       {
156           re turn $this ->_aSystem ['is_on'];   158           re turn $this ->_aSystem ['is_on'];
157       }   159       }
158     160  
159       functi on getMaxV ote()   161       functi on getMaxV ote()
160       {   162       {
161           re turn $this ->_aSystem ['max_vote s'];   163           re turn $this ->_aSystem ['max_vote s'];
162       }   164       }
163     165  
164       functi on getVote Count()   166       functi on getVote Count()
165       {   167       {
166           re turn $this ->_iCount;   168           re turn $this ->_iCount;
167       }   169       }
168     170  
169       functi on getVote Rate()   171       functi on getVote Rate()
170       {   172       {
171           re turn $this ->_fRate;   173           re turn $this ->_fRate;
172       }   174       }
173     175  
174       functi on getSyst emName()   176       functi on getSyst emName()
175       {   177       {
176           re turn $this ->_sSystem ;   178           re turn $this ->_sSystem ;
177       }   179       }
178     180  
179       /**   181       /**
180        * set  id to ope rate with  votes   182        * set  id to ope rate with  votes
181        */   183        */
182       functi on setId ( $iId)   184       functi on setId ( $iId)
183       {   185       {
184           if  ($iId ==  $this->get Id()) retu rn;   186           if  ($iId ==  $this->get Id()) retu rn;
185           $t his->_iId  = $iId;   187           $t his->_iId  = $iId;
186           $t his->initV otes();   188           $t his->initV otes();
187       }   189       }
188     190  
189       functi on getSqlP arts ($sMa ilTable, $ sMailField )   191       functi on getSqlP arts ($sMa ilTable, $ sMailField )
190       {   192       {
191           if  ($this->i sEnabled() )   193           if  ($this->i sEnabled() )
192                return $ this->_oQu ery->getSq lParts ($s MailTable,  $sMailFie ld);   194                return $ this->_oQu ery->getSq lParts ($s MailTable,  $sMailFie ld);
193           el se   195           el se
194                return a rray();   196                return a rray();
195       }   197       }
196     198  
197     199  
198       functi on isValid System ($s System)   200       functi on isValid System ($s System)
199       {   201       {
200           re turn isset ($this->_a Systems[$s System]);   202           re turn isset ($this->_a Systems[$s System]);
201       }   203       }
202     204  
203       functi on deleteV otings ($i Id)   205       functi on deleteV otings ($i Id)
204       {            206       {         
205           if  (!(int)$i Id) return  false;   207           if  (!(int)$i Id) return  false;
206           $t his->_oQue ry->delete Votings ($ iId);   208           $t his->_oQue ry->delete Votings ($ iId);
207           re turn true;   209           re turn true;
208       }   210       }
209     211  
210       functi on getTopV otedItem ( $iDays, $s JoinTable  = '', $sJo inField =  '', $sWher e = '')   212       functi on getTopV otedItem ( $iDays, $s JoinTable  = '', $sJo inField =  '', $sWher e = '')
211       {   213       {
212           re turn $this ->_oQuery- >getTopVot edItem ($i Days, $sJo inTable, $ sJoinField , $sWhere) ;   214           re turn $this ->_oQuery- >getTopVot edItem ($i Days, $sJo inTable, $ sJoinField , $sWhere) ;
213       }   215       }
214     216  
215       functi on getVote dItems ($s Ip)   217       functi on getVote dItems ($s Ip)
216       {   218       {
217           re turn $this ->_oQuery- >getVotedI tems ($sIp );   219           re turn $this ->_oQuery- >getVotedI tems ($sIp );
218       }   220       }
219     221  
220       /** pr ivate func tions   222       /** pr ivate func tions
221       ****** ********** ********** ********** *********/   223       ****** ********** ********** ********** *********/
222     224  
223     225  
224       functi on _getVot eResult ()   226       functi on _getVot eResult ()
225       {   227       {
226           $i Vote = (in t)$_GET[$t his->_aSys tem['post_ name']];   228           $i Vote = (in t)$_GET[$t his->_aSys tem['post_ name']];
227           if  (!$iVote)  return 0;   229           if  (!$iVote)  return 0;
228     230  
229           if  ($iVote >  $this->ge tMaxVote() ) $iVote =  $this->ge tMaxVote() ;   231           if  ($iVote >  $this->ge tMaxVote() ) $iVote =  $this->ge tMaxVote() ;
230           if  ($iVote <  1) $iVote  = 1;   232           if  ($iVote <  1) $iVote  = 1;
231           re turn $iVot e;   233           re turn $iVot e;
232       }   234       }
233          235       
234   }   236   }
235   ?>   237   ?>