1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | global $template; |
---|
5 | |
---|
6 | $piwecard = new Piwecard(); |
---|
7 | |
---|
8 | $ecard_id = explode('ecard/', $_SERVER['REQUEST_URI']); |
---|
9 | $ecard_id = $ecard_id[1]; |
---|
10 | |
---|
11 | if (isset($ecard_id) and $ecard_id != '' and $piwecard->is_valid($ecard_id)) { |
---|
12 | $query = 'SELECT * FROM '.PIWECARD_TABLE.' WHERE ecard_id="'.$ecard_id.'";'; |
---|
13 | $result = pwg_query($query); |
---|
14 | $result_array = pwg_db_fetch_assoc($result); |
---|
15 | |
---|
16 | if (isset($result_array['ecard_id'])) { |
---|
17 | //Recover img infos. |
---|
18 | $query = 'SELECT DISTINCT * FROM '.IMAGES_TABLE.' AS img WHERE img.id = '.$result_array['image'].';'; |
---|
19 | $result = pwg_query($query); |
---|
20 | |
---|
21 | $row = pwg_db_fetch_assoc($result); |
---|
22 | set_make_full_url(); |
---|
23 | $url = duplicate_picture_url( |
---|
24 | array( |
---|
25 | 'image_id' => $row['id'], |
---|
26 | 'image_file' => $row['file'] |
---|
27 | ), |
---|
28 | array('start') |
---|
29 | ); |
---|
30 | unset_make_full_url(); |
---|
31 | |
---|
32 | //Assign variables to template |
---|
33 | $template->assign('ecard', array( |
---|
34 | 'title' => $result_array['title'], |
---|
35 | 'message' => $result_array['message'], |
---|
36 | 'url' => $url, |
---|
37 | 'name' => $row['name'], |
---|
38 | 'image' => DerivativeImage::url($piwecard->config['image_size'], $row), |
---|
39 | 'sender_email' => $result_array['sender_email'], |
---|
40 | 'sender_name' => $result_array['sender_name'], |
---|
41 | 'image_title' => (($piwecard->config['show_image_infos'] == '1') ? $row['name'] : null), |
---|
42 | 'image_author' => (($piwecard->config['show_image_infos'] == '1') ? $row['author'] : null), |
---|
43 | 'image_border' => array( |
---|
44 | 'display' => $piwecard->config['image_border']['display'], |
---|
45 | 'style' => $piwecard->config['image_border']['style'], |
---|
46 | 'width' => $piwecard->config['image_border']['width'], |
---|
47 | 'color' => $piwecard->config['image_border']['color'], |
---|
48 | ), |
---|
49 | ) |
---|
50 | ); |
---|
51 | |
---|
52 | } |
---|
53 | } |
---|
54 | $template->set_filenames(array('ecard_result' => PIWECARD_ROOT.'/template/publish.tpl')); |
---|
55 | $template->concat('PLUGIN_INDEX_CONTENT_BEGIN', $template->parse('ecard_result', true)); |
---|
56 | |
---|
57 | $template->clear_assign(array('U_MODE_POSTED', 'U_MODE_CREATED')); |
---|
58 | ?> |
---|