Rev | Line | |
---|
[16591] | 1 | <?php |
---|
| 2 | defined('USER_COLLEC_PATH') or die('Hacking attempt!'); |
---|
| 3 | |
---|
| 4 | function get_current_collection_id($create=true) |
---|
| 5 | { |
---|
| 6 | global $user; |
---|
| 7 | |
---|
| 8 | // active in db |
---|
| 9 | $query = ' |
---|
| 10 | SELECT 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.