Source for file storage.existing.php
Documentation is available at storage.existing.php
* @subpackage plugins_storage
global $gLibertySystem, $gBitSystem, $gBitSmarty, $gBitThemes;
define( 'PLUGIN_GUID_EXISTING_FILES', 'existing' );
'store_function' => 'existing_files_store',
'verify_function' => 'existing_files_verify',
'description' => 'Always load for handling ajax attachments',
'edit_label' => 'Ajax Upload Files',
'auto_activate' => FALSE,
if( isset ( $gBitSystem ) ) {
global $gBitUser, $gContent;
if( @BitBase::verifyId( $gContent->mContentId ) ) {
// Pull all the data on the attachment in question
$query = "SELECT * FROM `". BIT_DB_PREFIX. "liberty_attachments` a ".
"WHERE a.`attachment_id`=?";
if( $result = $gContent->mDb->query( $query, array( $pStoreRow ))) {
$pStoreRow = $result->fetchRow();
// Tell LA not to do the insert.
$pStoreRow['skip_insert'] = TRUE;
// Verify the user owns this attachment
if( $gBitUser->isAdmin() || $pStoreRow['user_id'] == $gBitUser->mUserId ) {
// Verify that it isn't attached already
if( empty( $pStoreRow['content_id'] )) {
global $gBitSystem, $gContent;
if ( @BitBase::verifyId( $gContent->mContentId ) ) {
// Update the attachments content_id
"content_id = ? WHERE attachment_id = ?";
$result = $gContent->mDb->query( $query, array( $gContent->mContentId, $pStoreRow['attachment_id'] ) );
|