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

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

first commit

File size: 585 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('col_id');
29  }
30 
31  return false;
32}
33
34?>
Note: See TracBrowser for help on using the repository browser.