Changeset 19875 for extensions/File_Uploader/install
- Timestamp:
- Jan 6, 2013, 1:53:17 AM (11 years ago)
- Location:
- extensions/File_Uploader/install
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/File_Uploader/install/config_default.inc.php
r19821 r19875 1 1 <?php 2 2 $file_uploader_galleries_folder = 'file_uploader'; 3 $file_uploader_galleries_folder_name = 'File Uploader'; 3 4 $file_uploader_galleries_dir = PHPWG_ROOT_PATH.'galleries/'.$file_uploader_galleries_folder.'/'; 4 5 … … 32 33 ); 33 34 34 $ config_default= array(35 'new_tab' => 1,36 'overwrite' => 0,35 $file_uploader_default_config = array( 36 'new_tab' => '1', 37 'overwrite' => '0', 37 38 'pdf2tab_extensions' => array('pdf', 'docx', 'doc', 'odt', 'xlsx', 'xls', 'ods', 'pptx', 'ppt', 'odp'), 38 39 ); -
extensions/File_Uploader/install/functions.inc.php
r19821 r19875 5 5 } 6 6 7 function file_uploader_update_db( ) {7 function file_uploader_update_db($file_uploader_default_config) { 8 8 global $conf; 9 include(dirname(__FILE__).'/config_default.inc.php'); 10 9 11 10 $config = array(); 12 if (isset($conf['file_uploader'])) 11 12 if (isset($conf['file_uploader'])) { 13 13 $conf_file_uploader = unserialize($conf['file_uploader']); 14 15 if (isset($conf_file_uploader)) { 16 foreach ($config_default as $key => $value) { 14 foreach ($file_uploader_default_config as $key => $value) { 17 15 if (isset($conf_file_uploader[$key])) 18 16 $config[$key] = $conf_file_uploader[$key]; 19 17 else 20 $config[$key] = $ config_default[$key];18 $config[$key] = $file_uploader_default_config[$key]; 21 19 } 22 20 file_uploader_delete_conf("file_uploader"); 23 21 file_uploader_install($config); 24 22 } else { 25 file_uploader_install($ config_default);23 file_uploader_install($file_uploader_default_config); 26 24 } 27 25 } … … 32 30 } 33 31 34 function file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir ) {32 function file_uploader_folder($file_uploader_galleries_folder, $file_uploader_galleries_dir, $file_uploader_galleries_folder_name) { 35 33 //If the directory does not exist, we create it 36 34 if (!file_exists($file_uploader_galleries_dir)) 37 35 if(!mkdir($file_uploader_galleries_dir)) 38 36 array_push($page['errors'], l10n('Unable to create folder ').$file_uploader_galleries_dir); 39 //If the physical category sinot in database, we add it40 else if (pwg_db_num_rows(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE name= "'.$file_uploader_galleries_folder.'";')) == 0){37 //If the physical category is not in database, we add it 38 else if (pwg_db_num_rows(pwg_query('SELECT id FROM '.CATEGORIES_TABLE.' WHERE dir = "'.$file_uploader_galleries_folder.'";')) == 0){ 41 39 $next_id = pwg_db_nextval('id', CATEGORIES_TABLE); 42 40 $category_rank = pwg_db_fetch_assoc(pwg_query('SELECT MAX(rank) FROM '.CATEGORIES_TABLE.';')); 43 41 $category_rank = $category_rank['MAX(rank)'] + 1; 44 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);');42 pwg_query('INSERT INTO '.CATEGORIES_TABLE.' (id, name, comment, dir, rank, status, visible, uppercats, global_rank, site_id) VALUES ('.$next_id.', "'.$file_uploader_galleries_folder_name.'", "Created by the File Uploader plugin", "'.$file_uploader_galleries_folder.'", '.$category_rank.', "private", "true", "'.$next_id.'", '.$category_rank.', 1);'); 45 43 } 46 44 }
Note: See TracChangeset
for help on using the changeset viewer.