Changeset 19775
- Timestamp:
- Jan 4, 2013, 12:31:23 AM (12 years ago)
- Location:
- extensions/File_Uploader
- Files:
-
- 1 added
- 1 deleted
- 4 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) { -
extensions/File_Uploader/admin/admin_upload.tpl
r19472 r19775 50 50 <span class="property">{'Album:'|@translate}</span> 51 51 </label> 52 <select style="width:400px" name="file_uploader[category]" id=" file_uploader_album_select" size="1">52 <select style="width:400px" name="file_uploader[category]" id="albumSelect" size="1"> 53 53 {html_options options=$category_parent_options selected=$file_uploader.category} 54 54 </select> -
extensions/File_Uploader/install/config_default.inc.php
r19677 r19775 1 1 <?php 2 $file_uploader_galleries_folder = 'file_uploader'; 3 $file_uploader_galleries_dir = PHPWG_ROOT_PATH.'galleries/'.$file_uploader_galleries_folder.'/'; 4 5 $file_uploader_allowed_thumbnail_extension = array('jpg', 'jpeg', 'gif', 'png'); 6 7 $file_uploader_destination_folder = array( 8 'pdf' => 'pdf', 9 'doc' => 'documents', 10 'docx' => 'documents', 11 'odt' => 'documents', 12 'xls' => 'spreadsheets', 13 'xlsx' => 'spreadsheets', 14 'ods' => 'spreadsheets', 15 'ppt' => 'presentations', 16 'pptx' => 'presentations', 17 'odp' => 'presentations', 18 'webm' => 'videos', 19 'webmv' => 'videos', 20 'ogv' => 'videos', 21 'm4v' => 'videos', 22 'mp4' => 'videos', 23 'flv' => 'videos', 24 'mp3' => 'musics', 25 'ogg' => 'musics', 26 'oga' => 'musics', 27 'm4a' => 'musics', 28 'webma' => 'musics', 29 'fla' => 'musics', 30 'wav' => 'musics', 31 'others' => 'others', 32 ); 2 33 3 34 $config_default = array( -
extensions/File_Uploader/maintain.inc.php
r19676 r19775 3 3 4 4 function plugin_install() { 5 include(dirname(__FILE__).'/install/config_default.inc.php'); 5 include_once(dirname(__FILE__).'/install/config_default.inc.php'); 6 include_once(dirname(__FILE__).'/install/functions.inc.php'); 6 7 7 8 $query = 'INSERT INTO '.CONFIG_TABLE.' (param,value,comment) VALUES ("file_uploader" ,"'.pwg_db_real_escape_string(serialize($config_default)).'", "File Uploader plugin parameters");'; 8 9 pwg_query($query); 10 11 file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir); 9 12 } 10 13 11 14 function plugin_activate() { 12 15 include_once(dirname(__FILE__).'/install/config_default.inc.php'); 16 include_once(dirname(__FILE__).'/install/functions.inc.php'); 17 18 file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir); 13 19 } 14 20
Note: See TracChangeset
for help on using the changeset viewer.