Ignore:
Timestamp:
Jan 27, 2011, 8:46:55 PM (13 years ago)
Author:
tiico
Message:

Prepare v2.0.0 for Concours photo plugin :

  • Add exaequo checking for the result (beta)
  • Add EN language
  • Correct "concours not displayed" when no group is selected in admin page. Now, concours is available for all registered user (not depending on the group appartenance)
  • Add option to allow author to vote for their photos (disable check based on username=authorname)
  • Add option to allow user to change the score after a validation
  • Add to guest the possibility to vote for a concours (BETA)
  • Some correction (code and database structure)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ConcoursPhoto/publish.php

    r4428 r8946  
    1010$ap_id = explode('concours/' , $_SERVER['REQUEST_URI']);
    1111$id_concours = $ap_id[1];
     12
     13$user['ipguest'] = null;
     14if (is_a_guest())
     15{
     16    if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
     17        $IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
     18    elseif(isset($_SERVER['HTTP_CLIENT_IP']))   
     19        $IP = $_SERVER['HTTP_CLIENT_IP'];   
     20    else
     21        $IP = $_SERVER['REMOTE_ADDR']; 
     22         
     23    // store ip
     24    $user['ipguest'] = $IP;
     25}
     26       
     27
    1228
    1329$concours = new Concours($id_concours);
     
    3450                .' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id'
    3551                .' INNER JOIN '.CONCOURS_RESULT_TABLE.' AS conc ON conc.img_id = img.id'
    36                 .' WHERE ic.category_id = '.$concours->concours_infos['category'];
     52                .' WHERE ic.category_id = '.$concours->concours_infos['category']
     53                .' AND conc.id_concours = '.$concours->concours_infos['id']
     54        ;
    3755
    3856if ($concours->concours_infos['method'] == 1)   // total
     
    4563$result = pwg_query($query);
    4664$rang = 1;
     65$previousNote = $previousMoy = 0;
    4766while ($row = mysql_fetch_assoc($result))
    4867{
     
    7695        unset_make_full_url();
    7796
     97    // Check the exaequos
     98    if ($concours->my_config['check_exaequo'])
     99    {
     100        if ( ($concours->concours_infos['method'] == 1  // total
     101               AND ($row['note'] == $previousNote))
     102             OR  ($concours->concours_infos['method'] == 2      // moyenne
     103                  AND ($row['moyenne'] == $previousMoy)))
     104        {
     105//            echo "Rang=".$rang."\n";
     106            $rang --;
     107           
     108        }
     109    }
     110
    78111        $template->append( 'concours_note', array(
    79112                        'img_id' => $row['id'],
     
    87120                        'moyenne'       => ($row['moyenne'] == 0 ? 'N/A' :$row['moyenne']),
    88121                        'nbvotant'      => $row['nbvotant'],
    89                         'usernote'      => $concours->get_img_globalnote_user($row['id'])
     122                        'usernote'      => $concours->get_img_globalnote_user($row['id'], null, null, $user['ipguest'])
    90123                       
    91124                ));
    92         $rang ++;
     125    $rang ++;
     126   
     127//    echo "Rang=".$rang."\n";
     128    $previousNote = $row['note'];
     129    $previousMoy = $row['moyenne'];
    93130
    94131}
Note: See TracChangeset for help on using the changeset viewer.