source: extensions/UserCollections/admin/sets.php @ 24421

Last change on this file since 24421 was 24421, checked in by mistic100, 11 years ago

new system for shares : password protection, link timeout, management popup + for mails
handle lightbox conflicts
menublock is visible by AMM

File size: 2.3 KB
Line 
1<?php
2if (!defined('USER_COLLEC_PATH')) die('Hacking attempt!');
3
4// actions
5if (isset($_GET['delete']))
6{
7  pwg_query('DELETE FROM '.COLLECTIONS_TABLE.' WHERE id = '.$_GET['delete'].';');
8  pwg_query('DELETE FROM '.COLLECTION_IMAGES_TABLE.' WHERE col_id = '.$_GET['delete'].';');
9}
10
11// filter
12$where_clauses = array('1=1');
13$order_by = 'date_creation DESC, name ASC';
14
15if (isset($_POST['filter']))
16{
17  if (!empty($_POST['username']))
18  {
19    array_push($where_clauses, 'username LIKE "%'.$_POST['username'].'%"');
20  }
21 
22  if (!empty($_POST['name']))
23  {
24    array_push($where_clauses, 'name LIKE "%'.$_POST['name'].'%"');
25  }
26 
27  $order_by = $_POST['order_by'].' '.$_POST['direction'];
28}
29
30
31// get sets
32$query = '
33SELECT
34    c.*,
35    u.'.$conf['user_fields']['username'].' AS username
36  FROM '.COLLECTIONS_TABLE.' AS c
37    INNER JOIN '.USERS_TABLE.' AS u
38    ON c.user_id = u.'.$conf['user_fields']['id'].'
39  WHERE
40    '.implode("\n    AND ", $where_clauses).'
41  ORDER BY '.$order_by.'
42;';
43$sets = hash_from_query($query, 'id');
44
45foreach ($sets as $row)
46{
47  $template->append('sets', array(
48    'NAME' => trigger_event('render_category_name', $row['name']),
49    'NB_IMAGES' => $row['nb_images'],
50    'DATE_CREATION' => format_date($row['date_creation'], true),
51    'USERNAME' => $row['username'],
52    'U_EDIT' => USER_COLLEC_PUBLIC . 'edit/'.$row['id'],
53    'U_EXPORT' => USER_COLLEC_ADMIN . '-export&amp;col_id='.$row['id'],
54    'U_DELETE' => USER_COLLEC_ADMIN . '-sets&amp;delete='.$row['id'],
55    ));
56}
57
58
59// filter options
60$page['order_by_items'] = array(
61  'date_creation' => l10n('Creation date'),
62  'nb_images' => l10n('Number of images'),
63  );
64
65$page['direction_items'] = array(
66  'DESC' => l10n('descending'),
67  'ASC' => l10n('ascending'),
68  );
69
70
71$template->assign(array(
72  'order_options' => $page['order_by_items'],
73  'order_selected' => isset($_POST['order_by']) ? $_POST['order_by'] : '',
74  'direction_options' => $page['direction_items'],
75  'direction_selected' => isset($_POST['direction']) ? $_POST['direction'] : '',
76 
77  'F_USERNAME' => @htmlentities($_POST['username'], ENT_COMPAT, 'UTF-8'),
78  'F_NAME' => @htmlentities($_POST['name'], ENT_COMPAT, 'UTF-8'),
79  'F_FILTER_ACTION' => USER_COLLEC_ADMIN . '-sets',
80  ));
81
82
83$template->set_filename('user_collections', realpath(USER_COLLEC_PATH . 'admin/template/sets.tpl'));
84
85?>
Note: See TracBrowser for help on using the repository browser.