assign('U_EDIT', CR_ADMIN . '-edit&contest_id=' . $page['contest'] . '&redirect=page'); $template->assign('U_RESULTS', CR_ADMIN . '-results&contest_id=' . $page['contest'] . '&redirect=page'); } // Infos du concours $contest = pwg_db_fetch_assoc(pwg_query("SELECT * FROM " . CR_TABLE_1 . " WHERE id=" . $page['contest'] . ";")); $contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end'])); // Concours non-publique if (!$contest['visible']) { check_status(ACCESS_ADMINISTRATOR); } // Paramètres généraux $template->assign(array( 'ID' => $contest['id'], 'NAME' => trigger_event('render_category_name', $contest['name']), 'VISIBLE' => $contest['visible'], 'STATUS' => $contest['status'], 'DATE_BEGIN' => format_date($contest['date_begin']), 'DATE_END' => format_date($contest['date_end']), 'LOGO' => $contest['logo'], 'BANNER' => $contest['banner'], 'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_category_name', $contest['name'])), 'DAYS' => $contest['days'], )); // Les quatre zones texte if (!empty($contest['description'])) { $contest['description'] = unserialize(base64_decode($contest['description'])); foreach ($contest['description'] as $desc) { $template->append('description', array( 'NAME' => trigger_event('render_category_name', stripslashes($desc['name'])), 'CONTENT' => trigger_event('render_category_name', stripslashes($desc['content'])), )); } } // Affichage des résultats if ($contest['status'] == 'finished') { // Infos des résultats $results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id=" . $contest['id'] . " ORDER BY rank ASC;"); $i=0; while ($result = pwg_db_fetch_assoc($results)) { $i++; // Infos de l'image $query = "SELECT i.id, i.name, i.file, i.path, i.tn_ext, ic.category_id FROM " . IMAGES_TABLE . " AS i INNER JOIN " . IMAGE_CATEGORY_TABLE . " AS ic ON ic.image_id = i.id WHERE i.id = " . $result['image_id'] . ";"; $image = pwg_db_fetch_assoc(pwg_query($query)); // retrieving category informations $query = "SELECT id, name, permalink, uppercats FROM " . CATEGORIES_TABLE." WHERE id = " . $image['category_id'] . ";"; $image['cat'] = pwg_db_fetch_assoc(pwg_query($query)); // link to the full size picture $image['url'] = make_picture_url(array( 'category' => $image['cat'], 'image_id' => $image['id'], 'image_file' => $image['file'], )); // Template if (in_array($result['rank'], array(1,2,3))) { $data = array( 'RANK' => $result ['rank'], 'AUTHOR' => $result['author'], 'IMAGE_SRC' => str_replace('thumbnail/'.$conf['prefix_thumbnail'], null, get_thumbnail_url($image)), 'IMAGE_URL' => $image['url'], 'IMAGE_NAME' => (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'], 'COMMENT' => CR_cut_string(trigger_event('render_category_name', $result['comment']), 450), ); }else{ $data = array( 'RANK' => $result ['rank'], 'AUTHOR' => $result['author'], 'TN_SRC' => get_thumbnail_url($image), 'IMAGE_URL' => $image['url'], 'IMAGE_NAME' => (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'], ); } $template->append('RESULTS', $data); } $template->assign('NB_RESULTS', $i); } $template->set_filenames(array('index'=> dirname(__FILE__).'/../template/cr_page.tpl')); // +-----------------------------------------------------------------------+ // Template // +-----------------------------------------------------------------------+ $template->assign('CR_PATH', CR_PATH); $template->assign('SEPARATOR', $conf['level_separator']); ?>