source: extensions/UserCollections/include/functions.inc.php @ 19274

Last change on this file since 19274 was 16688, checked in by mistic100, 12 years ago

-rework the main menu
-bug when a collection is create through AJAX
-add "Remove from collection" on colorbox
-minor interfaces changes

File size: 581 bytes
Line 
1<?php
2defined('USER_COLLEC_PATH') or die('Hacking attempt!');
3
4function get_current_collection_id($create=true)
5{
6  global $user;
7 
8  // active in db
9  $query = '
10SELECT id
11  FROM '.COLLECTIONS_TABLE.'
12  WHERE
13    active = 1
14    AND user_id = '.$user['id'].'
15;';
16  $result = pwg_query($query);
17 
18  if (pwg_db_num_rows($result))
19  {
20    list($col_id) = pwg_db_fetch_row($result);
21    return $col_id;
22  }
23 
24  // new one
25  if ($create)
26  {
27    $UserCollection = new UserCollection('new', array(), 'temp', 1);
28    return $UserCollection->getParam('id');
29  }
30 
31  return false;
32}
33
34?>
Note: See TracBrowser for help on using the repository browser.