source: extensions/File_Uploader/install/functions.inc.php @ 19775

Last change on this file since 19775 was 19775, checked in by julien1311, 11 years ago

some bug fixes/improvements
still buggy

  • Property svn:eol-style set to LF
File size: 1.0 KB
Line 
1<?php
2function file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir) {
3        //If the directory does not exist, we create it
4        if (!file_exists($file_uploader_galleries_dir))
5                if(!mkdir($file_uploader_galleries_dir))
6                        array_push($page['errors'], l10n('Unable to create folder ').$file_uploader_galleries_dir);
7                //If the physical category si not in database, we add it
8                else if (pwg_db_num_rows(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_galleries_folder.'";')) == 0){
9                        $next_id = pwg_db_nextval('id', CATEGORIES_TABLE);
10                        $category_rank = pwg_db_fetch_assoc(pwg_query('SELECT MAX(rank) FROM '.CATEGORIES_TABLE.';'));
11                        $category_rank = $category_rank['MAX(rank)'] + 1;
12                        pwg_query('INSERT INTO '.CATEGORIES_TABLE.' (id, name, dir, rank, status, visible, uppercats, global_rank, site_id) VALUES ('.$next_id.', "'.$file_uploader_galleries_folder.'", "'.$file_uploader_file_category.'", '.$category_rank.', "private", "true", "'.$next_id.'", '.$category_rank.', 1);');
13                }
14}
15?>
Note: See TracBrowser for help on using the repository browser.