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