diff options
| author | TekiMaki <tekimaki@users.sourceforge.net> | 2007-02-25 22:58:17 +0000 |
|---|---|---|
| committer | TekiMaki <tekimaki@users.sourceforge.net> | 2007-02-25 22:58:17 +0000 |
| commit | a0a98225d40024e0fcac1b68f9d319485828e3a6 (patch) | |
| tree | 32d544c3848b622ef3a55e440c1967416f1304fb /plugins/storage.bitfile.php | |
| parent | 8eb1e8eea669639534a40da81ed4d3bb75eafa1a (diff) | |
| download | liberty-a0a98225d40024e0fcac1b68f9d319485828e3a6.tar.gz liberty-a0a98225d40024e0fcac1b68f9d319485828e3a6.tar.bz2 liberty-a0a98225d40024e0fcac1b68f9d319485828e3a6.zip | |
remove antiqueated site_upload_dir preference and use STORAGE defines. previously, site_upload_dir had to be defined, and only worked with same defined name as storage package, typcially 'storage'. also only save of 'site_temp_dir' if it is different from the TEMP_PKG_PATH. Handle using of define defaults for both of those settings. Also, remove ancient junk from kernel/setup_inc.php
Diffstat (limited to 'plugins/storage.bitfile.php')
| -rw-r--r-- | plugins/storage.bitfile.php | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/plugins/storage.bitfile.php b/plugins/storage.bitfile.php index ffb6b85..a04d8fd 100644 --- a/plugins/storage.bitfile.php +++ b/plugins/storage.bitfile.php @@ -1,6 +1,6 @@ <?php /** - * @version $Revision: 1.19 $ + * @version $Revision: 1.20 $ * @package liberty * @subpackage plugins_storage */ @@ -43,20 +43,17 @@ function bit_files_verify( &$pStoreRow ) { function bit_files_store( &$pStoreRow ) { global $gBitSystem, $gBitUser; $ret = NULL; - $pref = $gBitSystem->getConfig('site_upload_dir'); - if( isset( $pref ) ) { - if( !empty( $pStoreRow['foreign_id'] ) ) { - $sql = "UPDATE `".BIT_DB_PREFIX."liberty_files SET `storage_path`=?, `mime_type`=?, `file_size`=? WHERE `file_id` = ?"; - $gBitSystem->mDb->query( $sql, array( $pStoreRow['dest_file_path'], $pStoreRow['type'], $pStoreRow['size'], $pStoreRow['foreign_id'] ) ); - } else { - $pStoreRow['file_id'] = $gBitSystem->mDb->GenID( 'liberty_files_id_seq' ); - $sql = "INSERT INTO `".BIT_DB_PREFIX."liberty_files` ( `storage_path`, `file_id`, `mime_type`, `file_size`, `user_id` ) VALUES ( ?, ?, ?, ?, ? )"; - $userId = !empty( $pStoreRow['upload']['user_id'] ) ? $pStoreRow['upload']['user_id'] : $gBitUser->mUserId; - $gBitSystem->mDb->query($sql, array( $pStoreRow['upload']['dest_path'].$pStoreRow['upload']['name'], $pStoreRow['file_id'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $userId ) ); - } - $sql = "UPDATE `".BIT_DB_PREFIX."liberty_attachments` SET `foreign_id`=? WHERE `attachment_id` = ?"; - $gBitSystem->mDb->query( $sql, array( $pStoreRow['file_id'], $pStoreRow['attachment_id'] ) ); + if( !empty( $pStoreRow['foreign_id'] ) ) { + $sql = "UPDATE `".BIT_DB_PREFIX."liberty_files SET `storage_path`=?, `mime_type`=?, `file_size`=? WHERE `file_id` = ?"; + $gBitSystem->mDb->query( $sql, array( $pStoreRow['dest_file_path'], $pStoreRow['type'], $pStoreRow['size'], $pStoreRow['foreign_id'] ) ); + } else { + $pStoreRow['file_id'] = $gBitSystem->mDb->GenID( 'liberty_files_id_seq' ); + $sql = "INSERT INTO `".BIT_DB_PREFIX."liberty_files` ( `storage_path`, `file_id`, `mime_type`, `file_size`, `user_id` ) VALUES ( ?, ?, ?, ?, ? )"; + $userId = !empty( $pStoreRow['upload']['user_id'] ) ? $pStoreRow['upload']['user_id'] : $gBitUser->mUserId; + $gBitSystem->mDb->query($sql, array( $pStoreRow['upload']['dest_path'].$pStoreRow['upload']['name'], $pStoreRow['file_id'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $userId ) ); } + $sql = "UPDATE `".BIT_DB_PREFIX."liberty_attachments` SET `foreign_id`=? WHERE `attachment_id` = ?"; + $gBitSystem->mDb->query( $sql, array( $pStoreRow['file_id'], $pStoreRow['attachment_id'] ) ); return $ret; } |
