source: extensions/Piwecard/publish.php @ 19968

Last change on this file since 19968 was 19968, checked in by julien1311, 11 years ago

[piwecard] various improvements

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4global $template;
5
6$ecard = new Piwecard();
7
8$ecard_id = explode('ecard/', $_SERVER['REQUEST_URI']);
9$ecard_id = $ecard_id[1];
10
11if (isset($ecard_id) and $ecard_id != '' and $ecard->is_valid($ecard_id)) {
12        $query = 'SELECT * FROM '.ECARD_TABLE.' WHERE numero = "'.$ecard_id.'";';
13        $result = pwg_query($query);
14        $result_array = pwg_db_fetch_assoc($result);
15
16        if (isset($result_array['numero'])) {
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                                'subject'               => $result_array['sujet'],
35                                'image'                 => $result_array['image'],
36                                'message'               => $result_array['message'],
37                                'url'                   => $url,
38                                'name'                  => $row['name'],
39                                'image'                 => DerivativeImage::url(IMG_LARGE, $row),
40                                'sender_email'  => $result_array['adrexp'],
41                                'sender_name'   => $result_array['nomexp'],
42                                'image_title'   => $ecard->my_config['ecard_showinfos'] ? $row['name'] : null,
43                                'image_author'  => $ecard->my_config['ecard_showinfos'] ? $row['author'] : null
44                                ));
45               
46        }
47}
48$template->set_filenames(array('ecard_result' =>  ECARD_ROOT.'/template/publish.tpl'));
49$template->concat('PLUGIN_INDEX_CONTENT_BEGIN', $template->parse('ecard_result', true));
50 
51$template->clear_assign(array('U_MODE_POSTED', 'U_MODE_CREATED'));
52?>
Note: See TracBrowser for help on using the repository browser.