Changeset 19775 for extensions/File_Uploader/admin/admin_upload.php
- Timestamp:
- Jan 4, 2013, 12:31:23 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/File_Uploader/admin/admin_upload.php
r19735 r19775 37 37 38 38 function file_uploader_upload_file($file_uploader_file) { 39 include ('static.inc.php');39 include_once(dirname(__FILE__).'/install/config_default.inc.php'); 40 40 41 41 global $conf; … … 69 69 if(!mkdir($file_uploader_file_directory_full)) 70 70 $file_uploader_errors['upload_error'] = l10n('Unable to create folder ').$file_uploader_file_directory_full; 71 //If the physical category si not in database, we add it 72 if (pwg_db_num_rows(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_file_category.'";')) == 0){ 73 $next_id = pwg_db_nextval('id', CATEGORIES_TABLE); 74 $category_rank = pwg_db_fetch_assoc(pwg_query('SELECT MAX(rank) FROM '.CATEGORIES_TABLE.';')); 75 $category_rank = $category_rank['MAX(rank)'] + 1; 76 pwg_query('INSERT INTO '.CATEGORIES_TABLE.' (id, name, dir, rank, status, visible, uppercats, global_rank) VALUES ('.$next_id.', "'.$file_uploader_file_category.'", "'.$file_uploader_file_category.'", '.$category_rank.', "'.$conf['newcat_default_status'].'", "'.boolean_to_string($conf['newcat_default_visible']).'", "'.$next_id.'", '.$category_rank.');'); 77 } 71 //If the physical category si not in database, we add it 72 else if (pwg_db_num_rows(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_file_category.'";')) == 0){ 73 $next_id = pwg_db_nextval('id', CATEGORIES_TABLE); 74 $category_rank = pwg_db_fetch_assoc(pwg_query('SELECT MAX(rank) FROM '.CATEGORIES_TABLE.';')); 75 $category_rank = $category_rank['MAX(rank)'] + 1; 76 $file_uploader_physical_category_id = pwg_db_fetch_assoc(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_galleries_folder.'";')); 77 pwg_query('INSERT INTO '.CATEGORIES_TABLE.' (id, name, dir, rank, status, visible, uppercats, global_rank, site_id) VALUES ('.$next_id.', "'.$file_uploader_file_category.'", "'.$file_uploader_file_category.'", '.$category_rank.', "private", "'.boolean_to_string($conf['newcat_default_visible']).'", "'.$file_uploader_physical_category_id.'", '.$category_rank.', 1);'); 78 } 78 79 79 80 if ($file_uploader_file['error'] !== UPLOAD_ERR_OK) { … … 116 117 117 118 function file_uploader_upload_thumbnail($file_uploader_thumbnail, $file_uploader_file_name_wo_extension, $file_uploader_file_extension, $file_uploader_file_folder) { 118 include ('static.inc.php');119 include_once(dirname(__FILE__).'/install/config_default.inc.php'); 119 120 120 121 $file_uploader_thumbnail_tmp = $file_uploader_thumbnail['tmp_name']; … … 175 176 //Database registration 176 177 $file_path = pwg_db_real_escape_string($file_uploader_file['destination']); 178 $physical_category_id = pwg_db_fetch_assoc(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_file['folder'].'";')); 177 179 $insert = array( 178 180 'file' => substr(strrchr($file_path, '/'), 1), … … 183 185 'representative_ext' => $file_uploader_thumbnail['extension'], 184 186 'filesize' => $file_uploader_file['size'], 187 'storage_category_id' => $physical_category_id, 185 188 'md5sum' => md5_file($file_path), 186 189 'added_by' => $user['id'], … … 195 198 $image_id = pwg_db_insert_id(IMAGES_TABLE); 196 199 } 197 198 $physical_category_id = pwg_db_fetch_assoc(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name = "'.$file_uploader_file['folder'].'";'));199 200 200 201 if(isset($file_uploader_file_properties['category']) and count($file_uploader_file_properties['category']) > 0) {
Note: See TracChangeset
for help on using the changeset viewer.