Exemple #1
0
/**
 * mime_image_update update file information in the database if there were changes.
 *
 * @param array $pStoreRow File data needed to update details in the database
 * @access public
 * @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
 */
function mime_image_update(&$pStoreRow, $pParams = NULL)
{
    global $gThumbSizes, $gBitSystem;
    $ret = TRUE;
    // this will set the correct pluign guid, even if we let default handle the store process
    $pStoreRow['attachment_plugin_guid'] = PLUGIN_MIME_GUID_IMAGE;
    // if storing works, we process the image
    if (!empty($pStoreRow['upload']) && ($ret = mime_default_update($pStoreRow))) {
        if (!mime_image_store_exif_data($pStoreRow)) {
            // if it all goes t**s up, we'll know why
            $pStoreRow['errors'] = $pStoreRow['log'];
            $ret = FALSE;
        }
    } elseif ($gBitSystem->isFeatureActive('mime_image_panoramas') && !empty($pParams['preference']['is_panorama']) && empty($pStoreRow['thumbnail_url']['panorama'])) {
        if (!mime_image_create_panorama($pStoreRow)) {
            $ret = FALSE;
        }
    } elseif (empty($pParams['preference']['is_panorama']) && !empty($pStoreRow['thumbnail_url']['panorama'])) {
        // we remove the panorama setting in the database and the panorama thumb
        if (LibertyAttachable::validateStoragePath(STORAGE_PKG_PATH . $pStoreRow['thumbnail_url']['panorama'])) {
            @unlink(STORAGE_PKG_PATH . $pStoreRow['thumbnail_url']['panorama']);
        }
    }
    return $ret;
}
Exemple #2
0
/**
 * Update file settings - taken over by mime_default_store appart from the width and height settings
 * 
 * @access public
 * @return TRUE on success, FALSE on failure - $pStoreRow['errors'] will contain reason
 */
function mime_flash_update(&$pStoreRow)
{
    global $gBitSystem;
    // this will set the correct pluign guid, even if we let default handle the store process
    $pStoreRow['attachment_plugin_guid'] = PLUGIN_MIME_GUID_FLASH;
    if ($ret = mime_default_update($pStoreRow)) {
        mime_flash_store_preferences($pStoreRow);
    }
    return $ret;
}
Exemple #3
0
/**
 * mime_pdf_update update file information in the database if there were changes.
 *
 * @param array $pStoreRow File data needed to update details in the database
 * @access public
 * @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
 */
function mime_pdf_update(&$pStoreRow, $pParams = NULL)
{
    global $gThumbSizes, $gBitSystem;
    $ret = TRUE;
    // this will set the correct pluign guid, even if we let default handle the store process
    $pStoreRow['attachment_plugin_guid'] = PLUGIN_MIME_GUID_PDF;
    // if storing works, we process the image
    if (!empty($pStoreRow['upload']) && ($ret = mime_default_update($pStoreRow))) {
    }
    return $ret;
}
Exemple #4
0
/**
 * mime_application_update update file information in the database if there were changes.
 * 
 * @param array $pStoreRow File data needed to update details in the database
 * @access public
 * @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
 */
function mime_application_update(&$pStoreRow, $pParams = NULL)
{
    $ret = FALSE;
    // this will set the correct pluign guid, even if we let default handle the store process
    $pStoreRow['attachment_plugin_guid'] = PLUGIN_MIME_GUID_APPLICATION;
    // if storing works, we process the image
    if (!empty($pStoreRow['upload']) && ($ret = mime_default_update($pStoreRow))) {
        // Dummy for later
    }
    return $ret;
}
Exemple #5
0
/**
 * mime_audio_update 
 * 
 * @param array $pStoreRow 
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function mime_audio_update(&$pStoreRow, $pParams = NULL)
{
    $ret = FALSE;
    if (BitBase::verifyId($pStoreRow['attachment_id'])) {
        $pStoreRow['log'] = array();
        // set the correct pluign guid, even if we let default handle the store process
        $pStoreRow['attachment_plugin_guid'] = PLUGIN_MIME_GUID_AUDIO;
        // remove the entire directory
        $pStoreRow['unlink_dir'] = TRUE;
        // if storing works, we process the audio
        if (!empty($pStoreRow['upload']) && ($ret = mime_default_update($pStoreRow))) {
            if (!mime_audio_converter($pStoreRow)) {
                // if it all goes t**s up, we'll know why
                $pStoreRow['errors'] = $pStoreRow['log'];
                $ret = FALSE;
            }
        }
        // if there was no upload we'll process the file parameters
        if (empty($pStoreRow['upload']) && !empty($pParams['meta'])) {
            // update our local version of the file
            $file = STORAGE_PKG_PATH . $pStoreRow['dest_branch'];
            if (is_file(dirname($file) . '/bitverted.mp3')) {
                $verted = dirname($file) . '/bitverted.mp3';
            } elseif (is_file(dirname($file) . '/bitverted.m4a')) {
                $verted = dirname($file) . '/bitverted.m4a';
            }
            // update audio tags of converted and original file (ignore errors since these might be m4a)
            mime_audio_update_tags($verted, $pParams['meta']);
            mime_audio_update_tags($file, $pParams['meta']);
            // finally we update the meta table data
            if (!LibertyMime::storeMetaData($pStoreRow['attachment_id'], 'ID3', $pParams['meta'])) {
                $log['store_meta'] = "There was a problem storing the meta data in the database";
            }
            if (empty($log)) {
                $ret = TRUE;
            } else {
                $pStoreRow['errors'] = $log;
            }
        }
    }
    return $ret;
}
Exemple #6
0
/**
 * mime_pdf_update update file information in the database if there were changes.
 *
 * @param array $pStoreRow File data needed to update details in the database
 * @access public
 * @return TRUE on success, FALSE on failure - $pStoreRow[errors] will contain reason
 */
function mime_pdfx_update(&$pStoreRow, $pParams = NULL)
{
    global $gThumbSizes, $gBitSystem;
    $ret = TRUE;
    // this will set the correct pluign guid, even if we let default handle the store process
    $pStoreRow['attachment_plugin_guid'] = PLUGIN_MIME_GUID_PDFX;
    // if storing works, we process the image
    if (!empty($pStoreRow['upload']) && ($ret = mime_default_update($pStoreRow))) {
        if (!mime_pdfx_convert_pdf2swf($pStoreRow)) {
            // if it all goes t**s up, we'll know why
            $pStoreRow['errors'] = $pStoreRow['log'];
            $ret = FALSE;
        }
    }
    if ($gBitSystem->getConfig('pdf_thumbnails', 'y') == 'y') {
        if (!mime_pdfx_thumbnail($pStoreRow)) {
            // if it all goes t**s up, we'll know why
            $pStoreRow['errors'] = $pStoreRow['log'];
            $ret = FALSE;
        }
    }
    return $ret;
}
Exemple #7
0
/**
 * mime_video_update
 *
 * @param array $pStoreRow
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function mime_video_update(&$pStoreRow, $pParams = NULL)
{
    $ret = FALSE;
    if (BitBase::verifyId($pStoreRow['attachment_id'])) {
        $pStoreRow['log'] = array();
        // set the correct pluign guid, even if we let default handle the store process
        $pStoreRow['attachment_plugin_guid'] = PLUGIN_MIME_GUID_VIDEO;
        // remove the entire directory
        $pStoreRow['unlink_dir'] = TRUE;
        // if storing works, we process the video
        if (!empty($pStoreRow['upload']) && ($ret = mime_default_update($pStoreRow))) {
            if (!mime_video_converter($pStoreRow)) {
                // if it all goes t**s up, we'll know why
                $pStoreRow['errors'] = $pStoreRow['log'];
                $ret = FALSE;
            }
        }
        // if there was no upload we'll process the file parameters
        if (empty($pStoreRow['upload']) && isset($pParams['meta']['aspect'])) {
            // set aspect NULL that it's removed from the database
            if (empty($pParams['meta']['aspect'])) {
                $pParams['meta']['aspect'] = NULL;
            }
            // we store the custom aspect ratio as a preference which we will use to override the original one
            if (!LibertyMime::storeAttachmentPreference($pStoreRow['attachment_id'], 'aspect', $pParams['meta']['aspect'])) {
                $log['store_meta'] = "There was a problem storing the preference in the database";
            }
            if (empty($log)) {
                $ret = TRUE;
            } else {
                $pStoreRow['errors'] = $log;
            }
        }
    }
    return $ret;
}