[8771] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
| 4 | global $template; |
---|
| 5 | |
---|
| 6 | $me = new ecard(); |
---|
| 7 | |
---|
| 8 | $num = explode('ecard/' , $_SERVER['REQUEST_URI']); |
---|
| 9 | $numero = $num[1]; |
---|
| 10 | |
---|
| 11 | //echo "numero=".$numero; |
---|
| 12 | |
---|
| 13 | if (isset($num[1]) and $num[1] != '' and $me->is_valid($numero)) |
---|
| 14 | { |
---|
| 15 | |
---|
| 16 | $query = 'SELECT * FROM '.ECARD_TABLE.' WHERE numero = "'.$numero.'";'; |
---|
| 17 | $result = pwg_query($query); |
---|
| 18 | $tableau = mysql_fetch_assoc($result); |
---|
| 19 | |
---|
| 20 | if (isset($tableau['numero'])) |
---|
| 21 | { |
---|
| 22 | // Recover img infos. |
---|
| 23 | $query = 'SELECT DISTINCT * FROM ' . IMAGES_TABLE.' AS img' |
---|
| 24 | .' WHERE img.id = '.$tableau['image'].';'; |
---|
| 25 | $result = pwg_query($query); |
---|
| 26 | |
---|
| 27 | $row = mysql_fetch_assoc($result); |
---|
| 28 | set_make_full_url(); |
---|
| 29 | $url = duplicate_picture_url( |
---|
| 30 | array( |
---|
| 31 | 'image_id' => $row['id'], |
---|
| 32 | 'image_file' => $row['file'] |
---|
| 33 | ), |
---|
| 34 | array('start') |
---|
| 35 | ); |
---|
| 36 | unset_make_full_url(); |
---|
| 37 | /* |
---|
| 38 | foreach ($tableau as $i => $v) |
---|
| 39 | echo '['.$i.']='.$v."\n"; |
---|
| 40 | |
---|
| 41 | echo "id=".$row['id']; |
---|
| 42 | echo "file=".$row['file']; |
---|
| 43 | */ |
---|
| 44 | // Envoi de la page |
---|
| 45 | $template->assign( 'ecard', array( |
---|
| 46 | 'sujet' => $tableau['sujet'], |
---|
| 47 | 'img' => $tableau['image'], |
---|
| 48 | 'message' => $tableau['message'], |
---|
| 49 | 'url' => $url, |
---|
| 50 | 'name' => $row['name'], |
---|
| 51 | 'thumb' => get_thumbnail_url($row), |
---|
| 52 | 'img' => get_image_url($row), |
---|
| 53 | 'adrexp' => $tableau['adrexp'], |
---|
| 54 | 'nomexp' => $tableau['nomexp'], |
---|
| 55 | 'title' => $me->my_config['ecard_showinfos'] ? $row['name'] : null, |
---|
| 56 | 'author' => $me->my_config['ecard_showinfos'] ? $row['author'] : null |
---|
| 57 | )); |
---|
| 58 | |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | $template->assign(array( |
---|
| 63 | 'TITLE' => "ecard : ".$tableau['sujet'])); |
---|
| 64 | |
---|
| 65 | } |
---|
| 66 | $template->set_filenames(array('ecard_result' => ECARD_ROOT.'/template/publish.tpl')); |
---|
| 67 | $template->concat('PLUGIN_INDEX_CONTENT_BEGIN', $template->parse('ecard_result', true)); |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | $template->assign('PLUGIN_INDEX_ACTIONS' , ' |
---|
| 71 | <li><a href="' . make_index_url() . '" title="' . l10n('return to homepage') . '"> |
---|
| 72 | <img src="' . $template->get_themeconf('icon_dir') . '/home.png" class="button" alt="' . l10n('home') . '"/></a> |
---|
| 73 | </li>'); |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | $template->clear_assign(array('U_MODE_POSTED', 'U_MODE_CREATED')); |
---|
| 77 | $template->clear_assign('MENUBAR'); |
---|
| 78 | |
---|
| 79 | ?> |
---|