Changeset 194957
- Timestamp:
- 01/18/2010 12:55:22 PM (16 years ago)
- Location:
- wp-photocontest/trunk
- Files:
-
- 5 edited
-
images/polaroid.fla (modified) (previous)
-
lib/wp-photocontest.class.php (modified) (3 diffs)
-
photocontest-manager.php (modified) (1 diff)
-
skins/aqua/polaroid.swf (modified) (previous)
-
viewimg.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-photocontest/trunk/lib/wp-photocontest.class.php
r194948 r194957 161 161 $outnum_photo = (array) $this->db->get_row( $this->db->prepare( "SELECT count(distinct(img_id)) as total_nr,img_id FROM ".$this->db->prefix."photocontest_votes ORDER BY img_id GROUP BY img_id")); 162 162 163 $out = $this->db->get_results( $this->db->prepare( "SELECT pr.wp_uid AS userid, pr.sum_votes AS sumvotes, wpu.user_login AS userlogin, pr.img_id AS img_id, pr.img_path AS img_path, pr.img_name AS img_name, pr.insert_time AS insert_time, pr.visibile AS visibile FROM ".$this->db->prefix."photocontest AS pr join ".$this->db->prefix."users as wpu on (pr.wp_uid = wpu.ID) AND pr.contest_id= %d ORDER BY pr. wp_uid, pr.insert_timeLIMIT %d, %d", $contest_id, ($p * 10),(($p + 1) * 10) ) );163 $out = $this->db->get_results( $this->db->prepare( "SELECT pr.wp_uid AS userid, pr.sum_votes AS sumvotes, wpu.user_login AS userlogin, pr.img_id AS img_id, pr.img_path AS img_path, pr.img_name AS img_name, pr.insert_time AS insert_time, pr.visibile AS visibile FROM ".$this->db->prefix."photocontest AS pr join ".$this->db->prefix."users as wpu on (pr.wp_uid = wpu.ID) AND pr.contest_id= %d ORDER BY pr.sum_votes DESC, pr.wp_uid ASC, pr.insert_time ASC LIMIT %d, %d", $contest_id, ($p * 10),(($p + 1) * 10) ) ); 164 164 165 165 $i=0; … … 169 169 foreach ($out as $k=>$v) 170 170 { 171 /* 171 172 $v = (array) $v; 172 $votes = (array) $this->db->get_row( $this->db->prepare( "SELECT count(*) as number_of_votes FROM ".$this->db->prefix."photocontest_votes WHERE img_id= %d " ,$v['img_id'] ) );173 $votes = (array) $this->db->get_row( $this->db->prepare( "SELECT count(*) as number_of_votes FROM ".$this->db->prefix."photocontest_votes WHERE img_id= %d AND vote>0" ,$v['img_id'] ) ); 173 174 $total_votes +=$votes['number_of_votes']; 174 175 $votes_array['nr_of_votes'][$v['img_id']]=$votes['number_of_votes']; 176 $votes_array['total_votes']=$total_votes; 177 */ 178 $votes = (array) $v; 179 $total_votes +=$votes['sumvotes']; 180 $votes_array['nr_of_votes'][$votes['img_id']]=$votes['sumvotes']; 175 181 $votes_array['total_votes']=$total_votes; 176 182 } … … 186 192 $data_array[$i]['med_thumb'] = preg_replace("/$img_name/", "med_".$img_name, $img_path); 187 193 $data_array[$i]['nr_of_votes'] = $votes_array['nr_of_votes'][$v['img_id']]; 188 $data_array[$i]['rank'] = round(($votes_array['nr_of_votes'][$v['img_id']]/$votes_array['total_votes'])*100,0); 194 if ($votes_array['total_votes']>0) 195 { 196 $data_array[$i]['rank'] = round(($votes_array['nr_of_votes'][$v['img_id']]/$votes_array['total_votes'])*100,0); 197 } 198 else 199 { 200 $data_array[$i]['rank'] = 0; 201 } 189 202 $i++; 190 203 } -
wp-photocontest/trunk/photocontest-manager.php
r192621 r194957 399 399 else 400 400 { 401 $contest_items_sorted = wppc_multiArraySort($view_contest['data'],' rank','DESC');401 $contest_items_sorted = wppc_multiArraySort($view_contest['data'],'nr_of_votes','DESC'); 402 402 $filter_post_id = $contest_id; 403 403 $show_list=false; -
wp-photocontest/trunk/viewimg.php
r194948 r194957 121 121 { 122 122 nocache_headers(); 123 wp_redirect(get_option('siteurl') . '/wp-content/plugins/wp-photocontest/login.php?post_id='.$post_id.'& redirect_to=' .urlencode(get_option('siteurl').'/wp-content/plugins/wp-photocontest/viewimg.php?post_id='.$post_id));123 wp_redirect(get_option('siteurl') . '/wp-content/plugins/wp-photocontest/login.php?post_id='.$post_id.'&img_id='.$img_id.'&redirect_to=' .urlencode(get_option('siteurl').'/wp-content/plugins/wp-photocontest/viewimg.php?post_id='.$post_id.'&img_id='.$img_id)); 124 124 exit(); 125 125 } … … 423 423 <h2 class="wp-photocontest_detailstitle"><?php _e('Photo', 'wp-photocontest');?></h2> 424 424 <div class="wp-photocontest_detailstext"> 425 <a href="<?php echo get_option("siteurl");?><?php echo $image_details['img_path'];?>" rel="lightbox " title="<?php echo $image_details['img_title'];?>"><img border="0" title="<?php echo $image_details['img_title'];?>" src="<?php echo get_option("siteurl");?><?php echo $large_thumb;?>"></a>425 <a href="<?php echo get_option("siteurl");?><?php echo $image_details['img_path'];?>" rel="lightbox[<?php echo $image_details['img_id'];?>]" title="<?php echo $image_details['img_title'];?>"><img border="0" title="<?php echo $image_details['img_title'];?>" src="<?php echo get_option("siteurl");?><?php echo $large_thumb;?>"></a> 426 426 </div> 427 427 </span>
Note: See TracChangeset
for help on using the changeset viewer.