diff --git a/bs_change_mime_type.php b/bs_change_mime_type.php
index 8ad8d1abc..51cf6cb3e 100644
--- a/bs_change_mime_type.php
+++ b/bs_change_mime_type.php
@@ -30,70 +30,21 @@
$bsNewMIMEType = isset($_REQUEST['bs_new_mime_type']) ? urldecode($_REQUEST['bs_new_mime_type']) : NULL;
// necessary variables exist
- if ($bsDB && $bsTable && $bsReference && $bsNewMIMEType)
+ if ($bsDB && $bsTable && $bsReference && $bsNewMIMEType)
{
- // load PMA configuration
- $PMA_Config = $GLOBALS['PMA_Config'];
+ if (PMA_BS_SetContentType($bsDB, $bsTable, $bsReference, $bsNewMIMEType))
+ {
+ // determine redirector page
+ $newLoc = $cfg['PmaAbsoluteUri'] . 'sql.php?' . PMA_generate_common_url ('','', '&') . (isset($bsDB) ? '&db=' . urlencode($bsDB) : '') . (isset($bsTable) ? '&table=' . urlencode($bsTable) : '') . (isset($token) ? '&token=' . urlencode($token) : '') . (isset($goto) ? '&goto=' . urlencode($goto) : '') . '&reload=1&purge=1';
- // if PMA configuration exists
- if (!empty($PMA_Config))
- {
- // if BS plugins exist
- if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST'))
- {
- $pbms_ref_tbl = $PMA_Config->get('PBMS_NAME') . '_reference';
- $pbms_cust_content_type_tbl = $PMA_Config->get('PBMS_NAME') . '_custom_content_type';
-
- // if specified DB is selected
- if (PMA_DBI_select_db($bsDB))
- {
- $query = "SELECT * FROM " . PMA_backquote($pbms_ref_tbl);
- $query .= " WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'";
-
- $result = PMA_DBI_query($query);
-
- // if record exists
- if ($data = PMA_DBI_fetch_assoc($result))
- {
- $query = "SELECT count(*) FROM " . PMA_backquote($pbms_cust_content_type_tbl);
- $query .= " WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'";
-
- $result = PMA_DBI_query($query);
-
- // if record exists
- if ($data = PMA_DBI_fetch_assoc($result))
- {
- if (1 == $data['count(*)'])
- {
- $query = "UPDATE " . PMA_backquote($pbms_cust_content_type_tbl) . " SET Content_type='";
- $query .= PMA_sqlAddslashes($bsNewMIMEType) . "' WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'";
- }
- else
- {
- $query = "INSERT INTO " . PMA_backquote($pbms_cust_content_type_tbl) . " (Blob_url, Content_type)";
- $query .= " VALUES('" . PMA_sqlAddslashes($bsReference) . "', '" . PMA_sqlAddslashes($bsNewMIMEType) . "')";
- }
-
- $result = PMA_DBI_query($query);
-
- // if query execution succeeded
- if ($result)
- {
- // determine redirector page
- $newLoc = $cfg['PmaAbsoluteUri'] . 'sql.php?' . PMA_generate_common_url ('','', '&') . (isset($bsDB) ? '&db=' . urlencode($bsDB) : '') . (isset($bsTable) ? '&table=' . urlencode($bsTable) : '') . (isset($token) ? '&token=' . urlencode($token) : '') . (isset($goto) ? '&goto=' . urlencode($goto) : '') . '&reload=1&purge=1';
-
- // redirect to specified page
- ?>
-
- get('BLOBSTREAMING_PLUGINS_EXIST'))
- } // end if (!empty($PMA_Config))
+ // redirect to specified page
+ ?>
+
+
diff --git a/bs_disp_as_mime_type.php b/bs_disp_as_mime_type.php
index 9b26a59ac..18fc20169 100644
--- a/bs_disp_as_mime_type.php
+++ b/bs_disp_as_mime_type.php
@@ -9,13 +9,6 @@
*/
require_once './libraries/common.inc.php';
-// load PMA configuration
-$PMA_Config = $GLOBALS['PMA_Config'];
-
-// retrieve BS server variables from PMA configuration
-$bs_server = $PMA_Config->get('BLOBSTREAMING_SERVER');
-if (empty($bs_server)) die('No blob streaming server configured!');
-
// Check URL parameters
PMA_checkParameters(array('reference', 'c_type'));
@@ -30,7 +23,9 @@ $reference = $_REQUEST['reference'];
*/
$c_type = preg_replace('/[^A-Za-z0-9/_-]/', '_', $_REQUEST['c_type']);
-$filename = 'http://' . $bs_server . '/' . $reference;
+// Get the blob streaming URL
+$filename = PMA_BS_getURL($reference);
+if (empty($filename)) die('No blob streaming server configured!');
$hdrs = get_headers($filename, 1);
diff --git a/bs_play_media.php b/bs_play_media.php
index ad3c9af51..e1081f9e0 100644
--- a/bs_play_media.php
+++ b/bs_play_media.php
@@ -27,21 +27,13 @@
// if media type and BS reference are specified
if (isset($mediaType) && isset($bsReference))
{
- // load PMA configuration
- $PMA_Config = $GLOBALS['PMA_Config'];
-
- // if PMA configuration exists
- if (!empty($PMA_Config))
- {
- // retrieve BS server variables from PMA configuration
- $bs_server = $PMA_Config->get('BLOBSTREAMING_SERVER');
- if (empty($bs_server)) die('No blob streaming server configured!');
-
- $bs_file_path = "http://" . $bs_server . '/' . $bsReference;
-
if (isset($customType) && $customType)
-
$bs_file_path = 'bs_disp_as_mime_type.php' . PMA_generate_common_url(array('reference' => $bsReference, 'c_type' => $mediaType));
+ else {
+ // Get the BLOB streaming URL
+ $bs_file_path = PMA_BS_getURL($bsReference);
+ if (empty($bs_file_path)) die('No blob streaming server configured!');
+ }
?>
@@ -69,7 +61,6 @@