Plugin Directory

Changeset 194957


Ignore:
Timestamp:
01/18/2010 12:55:22 PM (16 years ago)
Author:
frekel
Message:

Kleine fixes voor ILFN

Location:
wp-photocontest/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • wp-photocontest/trunk/lib/wp-photocontest.class.php

    r194948 r194957  
    161161        $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"));
    162162
    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_time LIMIT %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) ) );     
    164164
    165165        $i=0;
     
    169169        foreach ($out as $k=>$v)
    170170        {
     171            /*
    171172            $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'] ) );
    173174            $total_votes +=$votes['number_of_votes'];
    174175            $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'];
    175181            $votes_array['total_votes']=$total_votes;
    176182        }
     
    186192            $data_array[$i]['med_thumb']    = preg_replace("/$img_name/", "med_".$img_name, $img_path);         
    187193            $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            }
    189202            $i++;
    190203        }
  • wp-photocontest/trunk/photocontest-manager.php

    r192621 r194957  
    399399                else
    400400                {
    401                     $contest_items_sorted = wppc_multiArraySort($view_contest['data'],'rank','DESC');
     401                    $contest_items_sorted = wppc_multiArraySort($view_contest['data'],'nr_of_votes','DESC');
    402402                    $filter_post_id = $contest_id;
    403403                    $show_list=false;
  • wp-photocontest/trunk/viewimg.php

    r194948 r194957  
    121121        {
    122122            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));
    124124            exit();
    125125        }
     
    423423                        <h2 class="wp-photocontest_detailstitle"><?php _e('Photo', 'wp-photocontest');?></h2>
    424424                        <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>
    426426                        </div>                                 
    427427                    </span>
Note: See TracChangeset for help on using the changeset viewer.