summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2007-06-16 16:45:57 +0000
committerMax Kremmel <xing@synapse.plus.com>2007-06-16 16:45:57 +0000
commit6679a4cb389e621ac0fd907345ee2a01897ea045 (patch)
treeca384f12e60805bde20d1394d1e823edf1147d88
parentcbf8a70a8af7169cbdf8e0bc7eef77cca64622a0 (diff)
downloadliberty-6679a4cb389e621ac0fd907345ee2a01897ea045.tar.gz
liberty-6679a4cb389e621ac0fd907345ee2a01897ea045.tar.bz2
liberty-6679a4cb389e621ac0fd907345ee2a01897ea045.zip
finally fix the friggin image replacement bug
-rw-r--r--LibertyAttachable.php5
-rw-r--r--plugins/storage.bitfile.php13
2 files changed, 11 insertions, 7 deletions
diff --git a/LibertyAttachable.php b/LibertyAttachable.php
index b3d11cd..d865bb7 100644
--- a/LibertyAttachable.php
+++ b/LibertyAttachable.php
@@ -3,7 +3,7 @@
* Management of Liberty Content
*
* @package liberty
- * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.102 2007/06/16 11:36:38 lsces Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.103 2007/06/16 16:45:57 squareing Exp $
* @author spider <spider@steelsun.com>
*/
// +----------------------------------------------------------------------+
@@ -317,8 +317,7 @@ Disable for now - instead fend off new uploads once quota is exceeded. Need a ni
}
}
- if( isset($storeRow['attachment_id']) && $gLibertySystem->getPluginFunction( $storeRow['plugin_guid'], 'store_function' ) ) {
- $storeFunc = $gLibertySystem->mPlugins[$storeRow['plugin_guid']]['store_function'];
+ if( @BitBase::verifyId( $storeRow['attachment_id'] ) && $storeFunc = $gLibertySystem->getPluginFunction( $storeRow['plugin_guid'], 'store_function' )) {
$this->mStorage = $storeFunc( $storeRow );
}
diff --git a/plugins/storage.bitfile.php b/plugins/storage.bitfile.php
index ac2df07..ee4ac91 100644
--- a/plugins/storage.bitfile.php
+++ b/plugins/storage.bitfile.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.31 $
+ * @version $Revision: 1.32 $
* @package liberty
* @subpackage plugins_storage
*/
@@ -74,9 +74,14 @@ function bit_files_verify( &$pStoreRow ) {
function bit_files_store( &$pStoreRow ) {
global $gBitSystem, $gBitUser;
$ret = NULL;
- 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'] ) );
+ // we have been given an attachment_id but no foreign_id. we will make a last attempt to see if this is an update or an insert
+ if( @BitBase::verifyId( $pStoreRow['attachment_id'] ) && !@BitBase::verifyId( $pStoreRow['foreign_id'] )) {
+ $pStoreRow['foreign_id'] = $gBitSystem->mDb->getOne( "SELECT `foreign_id` FROM `".BIT_DB_PREFIX."liberty_attachments` WHERE `attachment_id` = ?", array( $pStoreRow['attachment_id'] ));
+ }
+
+ if( @BitBase::verifyId( $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['upload']['dest_path'].$pStoreRow['upload']['name'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $pStoreRow['foreign_id'] ) );
} else {
$pStoreRow['foreign_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 ( ?, ?, ?, ?, ? )";