1 | <?php |
---|
2 | |
---|
3 | $where = |
---|
4 | get_sql_condition_FandF |
---|
5 | ( |
---|
6 | array |
---|
7 | ( |
---|
8 | 'forbidden_categories' => 'ic.category_id', |
---|
9 | 'visible_categories' => 'ic.category_id', |
---|
10 | 'visible_images' => 'i.id' |
---|
11 | ), |
---|
12 | '' |
---|
13 | ); |
---|
14 | $list = implode(',', $final); |
---|
15 | if ( $where !== '' and $list !== '' ) |
---|
16 | { |
---|
17 | $where .= ' AND '; |
---|
18 | } |
---|
19 | $where .= ( $list == '') ? '' : |
---|
20 | 'i.`id` IN ('. $list .')'; |
---|
21 | $query=' |
---|
22 | SELECT DISTINCT (i.`id`), |
---|
23 | i.`path` , i.`file` , i.`date_available` , |
---|
24 | i.`date_creation`, i.`tn_ext` , i.`name` , |
---|
25 | i.`filesize` , i.`storage_category_id` , i.`average_rate`, |
---|
26 | i.`comment` , i.`author` , i.`hit` ,i.`width` , |
---|
27 | i.`height` |
---|
28 | FROM `'.IMAGES_TABLE.'` AS i |
---|
29 | INNER JOIN `'.IMAGE_CATEGORY_TABLE.'` |
---|
30 | AS ic ON i.`id` = ic.`image_id` |
---|
31 | WHERE '. $where .' |
---|
32 | '; |
---|
33 | /* recent = Date_available desc order */ |
---|
34 | $query .= ' ORDER BY i.`date_available` DESC, RAND() DESC '; |
---|
35 | $query .= ' LIMIT 0 , '. $limit .';'; |
---|
36 | // echo $query . '<br />'; |
---|
37 | $result = pwg_query( $query ); |
---|
38 | |
---|
39 | $template->assign_vars( |
---|
40 | array( |
---|
41 | 'TITLE' => 'recent', |
---|
42 | ) |
---|
43 | ); |
---|
44 | $template->assign_block_vars( |
---|
45 | 'row', array() |
---|
46 | ); |
---|
47 | $template->assign_block_vars( |
---|
48 | 'row.Normal', |
---|
49 | array( |
---|
50 | 'WIDTH'=> 682, |
---|
51 | 'HEIGH'=> 682, |
---|
52 | 'URL'=> 'http://www.monsite.com/pwg/galleries/shared/cat/image.jpg', |
---|
53 | ) |
---|
54 | ); |
---|
55 | $template->assign_block_vars( |
---|
56 | 'row', |
---|
57 | array( |
---|
58 | 'ID'=> 22, |
---|
59 | 'CAPTION'=> 'L\'image que je veux', |
---|
60 | 'DATE'=> '18/12/2006', |
---|
61 | 'COMMENT'=> 'Voila voili voilou ! Voila voili voilou !', |
---|
62 | ) |
---|
63 | ); |
---|
64 | ?> |
---|