aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorvdigital <vdigital@piwigo.org>2006-12-19 07:32:50 +0000
committervdigital <vdigital@piwigo.org>2006-12-19 07:32:50 +0000
commita65dbaa784ebcda9a807226e5739ba02e1a2123c (patch)
tree70ca874b3ebcfcaeadd751f29e20b9f220e5df76 /services
parent37032d453c850225119c293c59150ab8c97387dc (diff)
WEB Service: Some corrections again but still an incomplete version.
git-svn-id: http://piwigo.org/svn/trunk@1675 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--services/recent.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/services/recent.php b/services/recent.php
new file mode 100644
index 000000000..59b1ffd4a
--- /dev/null
+++ b/services/recent.php
@@ -0,0 +1,55 @@
+<?php
+
+$where = ( $user['forbidden_categories'] == '') ? '' :
+ 'ic.`category_id` NOT IN ('.$user['forbidden_categories'].')';
+$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 !',
+ )
+ );
+?>