Last change
on this file since 20090 was
20090,
checked in by mistic100, 11 years ago
|
- add webservices
- add mail function
- add admin list
- add admin export function
- try to deal with Gthumb+
- activate multisize dropdown menu of collection page
TODO : use webservices instead of toggle_image.php
|
File size:
1.2 KB
|
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); |
---|
[16688] | 28 | return $UserCollection->getParam('id'); |
---|
[16591] | 29 | } |
---|
| 30 | |
---|
| 31 | return false; |
---|
| 32 | } |
---|
| 33 | |
---|
[20090] | 34 | function uc_check_email_validity($mail_address) |
---|
| 35 | { |
---|
| 36 | if (function_exists('email_check_format')) |
---|
| 37 | { |
---|
| 38 | return email_check_format($mail_address); // Piwigo 2.5 |
---|
| 39 | } |
---|
| 40 | else if (version_compare(PHP_VERSION, '5.2.0') >= 0) |
---|
| 41 | { |
---|
| 42 | return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; |
---|
| 43 | } |
---|
| 44 | else |
---|
| 45 | { |
---|
| 46 | $atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase |
---|
| 47 | $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name |
---|
| 48 | $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; |
---|
| 49 | |
---|
| 50 | return (bool)preg_match($regex, $mail_address); |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | |
---|
[16591] | 54 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.