blob streaming code cleanup (work in progress)
This commit is contained in:
@@ -32,19 +32,17 @@
|
||||
// necessary variables exist
|
||||
if ($bsDB && $bsTable && $bsReference && $bsNewMIMEType)
|
||||
{
|
||||
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_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';
|
||||
|
||||
// redirect to specified page
|
||||
?>
|
||||
<script>
|
||||
window.location = "<?php echo $newLoc ?>";
|
||||
</script>
|
||||
<?php
|
||||
} // end if ($result)
|
||||
|
||||
// redirect to specified page
|
||||
?>
|
||||
<script>
|
||||
window.location = "<?php echo $newLoc ?>";
|
||||
</script>
|
||||
<?php
|
||||
} // end if ($result)
|
||||
} // end if ($bsDB && $bsTable && $bsReference && $bsNewMIMEType)
|
||||
|
||||
?>
|
||||
|
@@ -25,15 +25,21 @@ $c_type = preg_replace('/[^A-Za-z0-9/_-]/', '_', $_REQUEST['c_type']);
|
||||
|
||||
// Get the blob streaming URL
|
||||
$filename = PMA_BS_getURL($reference);
|
||||
if (empty($filename)) die('No blob streaming server configured!');
|
||||
if (empty($filename)) {
|
||||
die(__('No blob streaming server configured!'));
|
||||
}
|
||||
|
||||
$hdrs = get_headers($filename, 1);
|
||||
|
||||
if ($hdrs === FALSE) die('Failed to fetch headers');
|
||||
if ($hdrs === FALSE) {
|
||||
die(__('Failed to fetch headers'));
|
||||
}
|
||||
|
||||
$fHnd = fopen($filename, "rb");
|
||||
|
||||
if ($fHnd === FALSE) die('Failed to open remote URL');
|
||||
if ($fHnd === FALSE) {
|
||||
die(__('Failed to open remote URL'));
|
||||
}
|
||||
|
||||
$f_size = $hdrs['Content-Length'];
|
||||
|
||||
@@ -53,8 +59,9 @@ while (!feof($fHnd)) {
|
||||
$content .= fread($fHnd, $f_size);
|
||||
$pos = strlen($content);
|
||||
|
||||
if ($pos >= $f_size)
|
||||
if ($pos >= $f_size) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo $content;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
$mediaType = isset($_REQUEST['media_type']) ? $_REQUEST['media_type'] : NULL;
|
||||
|
||||
/*
|
||||
* @var string indicates whether media type is of custom type
|
||||
* @var string indicates whether media type is of custom type
|
||||
*/
|
||||
$customType = isset($_REQUEST['custom_type']) ? $_REQUEST['custom_type'] : false;
|
||||
|
||||
@@ -25,16 +25,16 @@
|
||||
$bsReference = isset($_REQUEST['bs_reference']) ? $_REQUEST['bs_reference'] : NULL;
|
||||
|
||||
// if media type and BS reference are specified
|
||||
if (isset($mediaType) && isset($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!');
|
||||
}
|
||||
|
||||
if (isset($mediaType) && isset($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!'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
@@ -150,17 +150,13 @@ $hidden_fields = array();
|
||||
$odd_row = true;
|
||||
$sum_row_count_pre = '';
|
||||
|
||||
// added by rajk - for blobstreaming
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
|
||||
$tableReductionCount = 0; // the amount to reduce the table count by
|
||||
|
||||
foreach ($tables as $keyname => $each_table) {
|
||||
|
||||
if (PMA_BS_IsHiddenTable($keyname)) {
|
||||
$tableReductionCount++;
|
||||
continue;
|
||||
}
|
||||
if (PMA_BS_IsHiddenTable($keyname)) {
|
||||
$tableReductionCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get valid statistics whatever is the table type
|
||||
|
||||
|
@@ -279,29 +279,26 @@ class PMA_File
|
||||
$is_bs_upload = FALSE;
|
||||
|
||||
// check if this field requires a repository upload
|
||||
if (isset($_REQUEST['upload_blob_repo_' . $key]))
|
||||
if (isset($_REQUEST['upload_blob_repo_' . $key])) {
|
||||
$is_bs_upload = ($_REQUEST['upload_blob_repo_' . $key]['multi_edit'][0] == "on") ? TRUE : FALSE;
|
||||
|
||||
}
|
||||
// if request is an upload to the BLOB repository
|
||||
if ($is_bs_upload)
|
||||
{
|
||||
$bs_db = $_REQUEST['db'];
|
||||
$bs_table = $_REQUEST['table'];
|
||||
$tmp_filename = $file['tmp_name'];
|
||||
$tmp_file_type = $file['type'];
|
||||
if ($is_bs_upload) {
|
||||
$bs_db = $_REQUEST['db'];
|
||||
$bs_table = $_REQUEST['table'];
|
||||
$tmp_filename = $file['tmp_name'];
|
||||
$tmp_file_type = $file['type'];
|
||||
|
||||
if (!$tmp_file_type)
|
||||
$tmp_file_type = NULL;
|
||||
|
||||
|
||||
if (!$bs_db || !$bs_table)
|
||||
{
|
||||
$this->_error_message = $GLOBALS['strUploadErrorUnknown'];
|
||||
return FALSE;
|
||||
}
|
||||
$blob_url = PMA_BS_UpLoadFile($bs_db, $bs_table, $tmp_file_type, $tmp_filename);
|
||||
PMA_File::setRecentBLOBReference($blob_url);
|
||||
if (! $tmp_file_type) {
|
||||
$tmp_file_type = NULL;
|
||||
}
|
||||
|
||||
if (! $bs_db || ! $bs_table) {
|
||||
$this->_error_message = $GLOBALS['strUploadErrorUnknown'];
|
||||
return FALSE;
|
||||
}
|
||||
$blob_url = PMA_BS_UpLoadFile($bs_db, $bs_table, $tmp_file_type, $tmp_filename);
|
||||
PMA_File::setRecentBLOBReference($blob_url);
|
||||
} // end if ($is_bs_upload)
|
||||
|
||||
// check for file upload errors
|
||||
@@ -399,45 +396,42 @@ class PMA_File
|
||||
$is_bs_upload = FALSE;
|
||||
|
||||
// check if this field requires a repository upload
|
||||
if (isset($_REQUEST['upload_blob_repo_' . $key]))
|
||||
if (isset($_REQUEST['upload_blob_repo_' . $key])) {
|
||||
$is_bs_upload = ($_REQUEST['upload_blob_repo_' . $key]['multi_edit'][0] == "on") ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
// is a request to upload file to BLOB repository using uploadDir mechanism
|
||||
if ($is_bs_upload)
|
||||
{
|
||||
$bs_db = $_REQUEST['db'];
|
||||
$bs_table = $_REQUEST['table'];
|
||||
$tmp_filename = $GLOBALS['cfg']['UploadDir'] . '/' . $_REQUEST['fields_uploadlocal_' . $key]['multi_edit'][$primary];
|
||||
if ($is_bs_upload) {
|
||||
$bs_db = $_REQUEST['db'];
|
||||
$bs_table = $_REQUEST['table'];
|
||||
$tmp_filename = $GLOBALS['cfg']['UploadDir'] . '/' . $_REQUEST['fields_uploadlocal_' . $key]['multi_edit'][$primary];
|
||||
|
||||
// check if fileinfo library exists
|
||||
if ($PMA_Config->get('FILEINFO_EXISTS'))
|
||||
{
|
||||
// attempt to init fileinfo
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
// check if fileinfo library exists
|
||||
if ($PMA_Config->get('FILEINFO_EXISTS')) {
|
||||
// attempt to init fileinfo
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
|
||||
// fileinfo exists
|
||||
if ($finfo)
|
||||
{
|
||||
// pass in filename to fileinfo and close fileinfo handle after
|
||||
$tmp_file_type = finfo_file($finfo, $tmp_filename);
|
||||
finfo_close($finfo);
|
||||
}
|
||||
}
|
||||
else // no fileinfo library exists, use file command
|
||||
$tmp_file_type = exec("file -bi " . escapeshellarg($tmp_filename));
|
||||
// fileinfo exists
|
||||
if ($finfo) {
|
||||
// pass in filename to fileinfo and close fileinfo handle after
|
||||
$tmp_file_type = finfo_file($finfo, $tmp_filename);
|
||||
finfo_close($finfo);
|
||||
}
|
||||
} else {
|
||||
// no fileinfo library exists, use file command
|
||||
$tmp_file_type = exec("file -bi " . escapeshellarg($tmp_filename));
|
||||
}
|
||||
|
||||
if (!$tmp_file_type)
|
||||
$tmp_file_type = NULL;
|
||||
|
||||
|
||||
if (!$bs_db || !$bs_table)
|
||||
{
|
||||
$this->_error_message = $GLOBALS['strUploadErrorUnknown'];
|
||||
return FALSE;
|
||||
}
|
||||
$blob_url = PMA_BS_UpLoadFile($bs_db, $bs_table, $tmp_file_type, $tmp_filename);
|
||||
PMA_File::setRecentBLOBReference($blob_url);
|
||||
if (! $tmp_file_type) {
|
||||
$tmp_file_type = NULL;
|
||||
}
|
||||
|
||||
if (! $bs_db || !$bs_table) {
|
||||
$this->_error_message = $GLOBALS['strUploadErrorUnknown'];
|
||||
return FALSE;
|
||||
}
|
||||
$blob_url = PMA_BS_UpLoadFile($bs_db, $bs_table, $tmp_file_type, $tmp_filename);
|
||||
PMA_File::setRecentBLOBReference($blob_url);
|
||||
} // end if ($is_bs_upload)
|
||||
|
||||
return $this->setLocalSelectedFile($_REQUEST['fields_uploadlocal_' . $key]['multi_edit'][$primary]);
|
||||
|
@@ -139,8 +139,9 @@ class PMA_StorageEngine
|
||||
*/
|
||||
static public function isValid($engine)
|
||||
{
|
||||
if ($engine == "PBMS")
|
||||
return TRUE;
|
||||
if ($engine == "PBMS") {
|
||||
return TRUE;
|
||||
}
|
||||
$storage_engines = PMA_StorageEngine::getStorageEngines();
|
||||
return isset($storage_engines[$engine]);
|
||||
}
|
||||
@@ -303,7 +304,7 @@ class PMA_StorageEngine
|
||||
$this->support = PMA_ENGINE_SUPPORT_NO;
|
||||
}
|
||||
} else {
|
||||
$this->engine_init();
|
||||
$this->engine_init();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6,36 +6,38 @@
|
||||
|
||||
function initPBMSDatabase()
|
||||
{
|
||||
$query = "create database IF NOT EXISTS pbms;"; // If no other choice then try this.
|
||||
/*
|
||||
* The user may not have privileges to create the 'pbms' database
|
||||
* so if it doesn't exist then we perform a select on a pbms system
|
||||
* table in an already existing database which will cause the PBMS
|
||||
* daemon to create the 'pbms' database.
|
||||
*/
|
||||
$db_array =PMA_DBI_fetch_result('SHOW DATABASES;');
|
||||
if (!empty($db_array)) {
|
||||
$target = "";
|
||||
foreach ($db_array as $current_db) {
|
||||
if ($current_db == 'pbms')
|
||||
return TRUE;
|
||||
|
||||
if ($target == "") {
|
||||
if (($current_db != 'pbxt') && ($current_db != 'mysql') && ($current_db != 'information_schema'))
|
||||
$target = $current_db;
|
||||
}
|
||||
}
|
||||
$query = "create database IF NOT EXISTS pbms;"; // If no other choice then try this.
|
||||
/*
|
||||
* The user may not have privileges to create the 'pbms' database
|
||||
* so if it doesn't exist then we perform a select on a pbms system
|
||||
* table in an already existing database which will cause the PBMS
|
||||
* daemon to create the 'pbms' database.
|
||||
*/
|
||||
$db_array = PMA_DBI_fetch_result('SHOW DATABASES;');
|
||||
if (! empty($db_array)) {
|
||||
$target = "";
|
||||
foreach ($db_array as $current_db) {
|
||||
if ($current_db == 'pbms') {
|
||||
return TRUE;
|
||||
}
|
||||
if ($target == "") {
|
||||
if (($current_db != 'pbxt') && ($current_db != 'mysql') && ($current_db != 'information_schema')) {
|
||||
$target = $current_db;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($target != "")
|
||||
$query = "select * from $target.pbms_metadata_header"; // If it exists this table will not contain much
|
||||
}
|
||||
if ($target != "") {
|
||||
$query = "select * from $target.pbms_metadata_header"; // If it exists this table will not contain much
|
||||
}
|
||||
}
|
||||
|
||||
$result = PMA_DBI_query($query );
|
||||
if (!$result)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
$result = PMA_DBI_query($query );
|
||||
if (! $result) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks whether the necessary plugins for BLOBStreaming exist
|
||||
@@ -95,23 +97,23 @@ function checkBLOBStreamingPlugins()
|
||||
// Retrieve MySQL plugins
|
||||
$existing_plugins = PMA_DBI_fetch_result('SHOW PLUGINS');
|
||||
|
||||
foreach ($existing_plugins as $one_existing_plugin) {
|
||||
foreach ($existing_plugins as $one_existing_plugin) {
|
||||
// check if required plugins exist
|
||||
if ( strtolower($one_existing_plugin['Library']) == 'libpbms.so'
|
||||
if ( strtolower($one_existing_plugin['Library']) == 'libpbms.so'
|
||||
&& $one_existing_plugin['Status'] == "ACTIVE") {
|
||||
$has_blobstreaming = true;
|
||||
break;
|
||||
}
|
||||
$has_blobstreaming = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($existing_plugins, $one_existing_plugin);
|
||||
unset($existing_plugins, $one_existing_plugin);
|
||||
}
|
||||
|
||||
// set variable indicating BS plugin existence
|
||||
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', $has_blobstreaming);
|
||||
|
||||
if ($has_blobstreaming) {
|
||||
$bs_variables = PMA_BS_GetVariables();
|
||||
|
||||
$bs_variables = PMA_BS_GetVariables();
|
||||
|
||||
// if no BS variables exist, set plugin existence to false and return
|
||||
if (count($bs_variables) <= 0) {
|
||||
$PMA_Config->set('BLOBSTREAMING_PLUGINS_EXIST', FALSE);
|
||||
@@ -136,7 +138,7 @@ function checkBLOBStreamingPlugins()
|
||||
$PMA_Config->set('PHP_PBMS_EXISTS', FALSE);
|
||||
$PMA_Config->set('FILEINFO_EXISTS', FALSE);
|
||||
|
||||
// check if PECL's fileinfo library exist
|
||||
// check if PECL's fileinfo library exist
|
||||
$finfo = NULL;
|
||||
|
||||
if (function_exists("finfo_open")) {
|
||||
@@ -148,7 +150,7 @@ function checkBLOBStreamingPlugins()
|
||||
$PMA_Config->set('FILEINFO_EXISTS', TRUE);
|
||||
finfo_close($finfo);
|
||||
} // end if (!empty($finfo))
|
||||
|
||||
|
||||
} else {
|
||||
PMA_cacheSet('skip_blobstreaming', true, true);
|
||||
return FALSE;
|
||||
@@ -223,8 +225,8 @@ function PMA_BS_GetVariables()
|
||||
//========================
|
||||
function PMA_BS_ReportPBMSError($msg)
|
||||
{
|
||||
$tmp_err = pbms_error();
|
||||
PMA_showMessage("PBMS error, $msg $tmp_err");
|
||||
$tmp_err = pbms_error();
|
||||
PMA_showMessage("PBMS error, $msg $tmp_err");
|
||||
}
|
||||
|
||||
//------------
|
||||
@@ -238,20 +240,21 @@ function PMA_do_connect($db_name, $quiet)
|
||||
|
||||
// generate bs reference link
|
||||
$pbms_host = $PMA_Config->get('BLOBSTREAMING_HOST');
|
||||
$pbms_port = $PMA_Config->get('BLOBSTREAMING_PORT');
|
||||
$pbms_port = $PMA_Config->get('BLOBSTREAMING_PORT');
|
||||
|
||||
if (pbms_connect($pbms_host, $pbms_port, $db_name) == FALSE) {
|
||||
if ($quiet == FALSE)
|
||||
PMA_BS_ReportPBMSError("PBMS Connectiuon failed: pbms_connect($pbms_host, $pbms_port, $db_name)");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
if (pbms_connect($pbms_host, $pbms_port, $db_name) == FALSE) {
|
||||
if ($quiet == FALSE) {
|
||||
PMA_BS_ReportPBMSError("PBMS Connectiuon failed: pbms_connect($pbms_host, $pbms_port, $db_name)");
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_do_disconnect()
|
||||
{
|
||||
pbms_close();
|
||||
pbms_close();
|
||||
}
|
||||
|
||||
//------------
|
||||
@@ -261,76 +264,76 @@ function PMA_do_disconnect()
|
||||
*/
|
||||
function PMA_BS_IsPBMSReference($bs_reference, $db_name)
|
||||
{
|
||||
if (PMA_cacheGet('skip_blobstreaming', true))
|
||||
return FALSE;
|
||||
|
||||
if (PMA_do_connect($db_name, TRUE) == FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
if (PMA_cacheGet('skip_blobstreaming', true)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (PMA_do_connect($db_name, TRUE) == FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
$ok = pbms_is_blob_reference($bs_reference);
|
||||
PMA_do_disconnect();
|
||||
return $ok ;
|
||||
PMA_do_disconnect();
|
||||
return $ok ;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_CreateReferenceLink($bs_reference, $db_name)
|
||||
{
|
||||
if (PMA_do_connect($db_name, FALSE) == FALSE) {
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
if (pbms_get_info($bs_reference) == FALSE) {
|
||||
PMA_BS_ReportPBMSError("PBMS get BLOB info failed: pbms_get_info($bs_reference)");
|
||||
PMA_do_disconnect();
|
||||
return 'Error';
|
||||
}
|
||||
if (PMA_do_connect($db_name, FALSE) == FALSE) {
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
if (pbms_get_info($bs_reference) == FALSE) {
|
||||
PMA_BS_ReportPBMSError("PBMS get BLOB info failed: pbms_get_info($bs_reference)");
|
||||
PMA_do_disconnect();
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
$content_type = pbms_get_metadata_value("Content-type");
|
||||
if ($content_type == FALSE) {
|
||||
PMA_BS_ReportPBMSError("PMA_BS_CreateReferenceLink($bs_reference, $db_name): get BLOB Content-type failed: ");
|
||||
}
|
||||
|
||||
PMA_do_disconnect();
|
||||
|
||||
if (!$content_type)
|
||||
$content_type = "image/jpeg";
|
||||
|
||||
$bs_url = PMA_BS_getURL($bs_reference);
|
||||
if (empty($bs_url)) {
|
||||
PMA_BS_ReportPBMSError("No blob streaming server configured!");
|
||||
return 'Error';
|
||||
PMA_do_disconnect();
|
||||
|
||||
if (! $content_type) {
|
||||
$content_type = "image/jpeg";
|
||||
}
|
||||
|
||||
$bs_url = PMA_BS_getURL($bs_reference);
|
||||
if (empty($bs_url)) {
|
||||
PMA_BS_ReportPBMSError("No blob streaming server configured!");
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
$output = "<a href=\"#\" onclick=\"requestMIMETypeChange('" . urlencode($db_name) . "', '" . urlencode($GLOBALS['table']) . "', '" . urlencode($bs_reference) . "', '" . urlencode($content_type) . "')\">$content_type</a>";
|
||||
|
||||
// specify custom HTML for various content types
|
||||
switch ($content_type)
|
||||
{
|
||||
// no content specified
|
||||
case NULL:
|
||||
$output = "NULL";
|
||||
break;
|
||||
// image content
|
||||
case 'image/jpeg':
|
||||
case 'image/png':
|
||||
$output .= ' (<a href="' . $bs_url . '" target="new">' . __('View image') . '</a>)';
|
||||
break;
|
||||
$output = "<a href=\"#\" onclick=\"requestMIMETypeChange('" . urlencode($db_name) . "', '" . urlencode($GLOBALS['table']) . "', '" . urlencode($bs_reference) . "', '" . urlencode($content_type) . "')\">$content_type</a>";
|
||||
|
||||
// specify custom HTML for various content types
|
||||
switch ($content_type) {
|
||||
// no content specified
|
||||
case NULL:
|
||||
$output = "NULL";
|
||||
break;
|
||||
// image content
|
||||
case 'image/jpeg':
|
||||
case 'image/png':
|
||||
$output .= ' (<a href="' . $bs_url . '" target="new">' . __('View image') . '</a>)';
|
||||
break;
|
||||
// audio content
|
||||
case 'audio/mpeg':
|
||||
$output .= ' (<a href="#" onclick="popupBSMedia(\'' . PMA_generate_common_url() . '\',\'' . urlencode($bs_reference) . '\', \'' . urlencode($content_type) . '\',' . ($is_custom_type ? 1 : 0) . ', 640, 120)">' . __('Play audio'). '</a>)';
|
||||
break;
|
||||
// video content
|
||||
case 'application/x-flash-video':
|
||||
case 'video/mpeg':
|
||||
$output .= ' (<a href="#" onclick="popupBSMedia(\'' . PMA_generate_common_url() . '\',\'' . urlencode($bs_reference) . '\', \'' . urlencode($content_type) . '\',' . ($is_custom_type ? 1 : 0) . ', 640, 480)">' . __('View video') . '</a>)';
|
||||
break;
|
||||
// unsupported content. specify download
|
||||
default:
|
||||
$output .= ' (<a href="' . $bs_url . '" target="new">' . __('Download file'). '</a>)';
|
||||
}
|
||||
case 'audio/mpeg':
|
||||
$output .= ' (<a href="#" onclick="popupBSMedia(\'' . PMA_generate_common_url() . '\',\'' . urlencode($bs_reference) . '\', \'' . urlencode($content_type) . '\',' . ($is_custom_type ? 1 : 0) . ', 640, 120)">' . __('Play audio'). '</a>)';
|
||||
break;
|
||||
// video content
|
||||
case 'application/x-flash-video':
|
||||
case 'video/mpeg':
|
||||
$output .= ' (<a href="#" onclick="popupBSMedia(\'' . PMA_generate_common_url() . '\',\'' . urlencode($bs_reference) . '\', \'' . urlencode($content_type) . '\',' . ($is_custom_type ? 1 : 0) . ', 640, 480)">' . __('View video') . '</a>)';
|
||||
break;
|
||||
// unsupported content. specify download
|
||||
default:
|
||||
$output .= ' (<a href="' . $bs_url . '" target="new">' . __('Download file'). '</a>)';
|
||||
}
|
||||
|
||||
//PMA_showMessage("PMA_BS_CreateReferenceLink($bs_reference, $db_name): $output");
|
||||
return $output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
//------------
|
||||
@@ -340,31 +343,36 @@ function PMA_BS_CreateReferenceLink($bs_reference, $db_name)
|
||||
// they are not currently needed.
|
||||
function PMA_BS_IsTablePBMSEnabled($db_name, $tbl_name, $tbl_type)
|
||||
{
|
||||
if (PMA_cacheGet('skip_blobstreaming', true))
|
||||
return FALSE;
|
||||
|
||||
if ((isset($tbl_type) == FALSE) || (strlen($tbl_type) == 0))
|
||||
return FALSE;
|
||||
|
||||
if (PMA_cacheGet('skip_blobstreaming', true)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((isset($tbl_type) == FALSE) || (strlen($tbl_type) == 0)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// load PMA configuration
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
|
||||
// return if unable to load PMA configuration
|
||||
if (empty($PMA_Config))
|
||||
if (empty($PMA_Config)) {
|
||||
return FALSE;
|
||||
|
||||
if (!$PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST') )
|
||||
}
|
||||
|
||||
if (! $PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// This information should be cached rather than selecting it each time.
|
||||
//$query = "SELECT count(*) FROM information_schema.TABLES T, pbms.pbms_enabled E where T.table_schema = ". PMA_backquote($db_name) . " and T.table_name = ". PMA_backquote($tbl_name) . " and T.engine = E.name";
|
||||
$query = "SELECT count(*) FROM pbms.pbms_enabled E where E.name = '". PMA_sqlAddslashes($tbl_type) . "'" ;
|
||||
$result = PMA_DBI_query($query);
|
||||
// This information should be cached rather than selecting it each time.
|
||||
//$query = "SELECT count(*) FROM information_schema.TABLES T, pbms.pbms_enabled E where T.table_schema = ". PMA_backquote($db_name) . " and T.table_name = ". PMA_backquote($tbl_name) . " and T.engine = E.name";
|
||||
$query = "SELECT count(*) FROM pbms.pbms_enabled E where E.name = '" . PMA_sqlAddslashes($tbl_type) . "'";
|
||||
$result = PMA_DBI_query($query);
|
||||
|
||||
$data = PMA_DBI_fetch_row($result);
|
||||
if ($data[0] == 1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$data = PMA_DBI_fetch_row($result);
|
||||
if ($data[0] == 1)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -372,107 +380,97 @@ function PMA_BS_IsTablePBMSEnabled($db_name, $tbl_name, $tbl_type)
|
||||
function PMA_BS_UpLoadFile($db_name, $tbl_name, $file_type, $file_name)
|
||||
{
|
||||
|
||||
if (PMA_cacheGet('skip_blobstreaming', true))
|
||||
return FALSE;
|
||||
if (PMA_cacheGet('skip_blobstreaming', true)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (PMA_do_connect($db_name, FALSE) == FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$fh = fopen($file_name, 'r');
|
||||
if (!$fh) {
|
||||
PMA_do_disconnect();
|
||||
PMA_showMessage("Could not open file: $file_name");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pbms_add_metadata("Content-type", $file_type);
|
||||
|
||||
$pbms_blob_url = pbms_read_stream($fh, filesize($file_name), $tbl_name);
|
||||
if (!$pbms_blob_url) {
|
||||
PMA_BS_ReportPBMSError("pbms_read_stream() Failed");
|
||||
if (PMA_do_connect($db_name, FALSE) == FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$fh = fopen($file_name, 'r');
|
||||
if (! $fh) {
|
||||
PMA_do_disconnect();
|
||||
PMA_showMessage("Could not open file: $file_name");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//PMA_showMessage(" PMA_BS_UpLoadFile($db_name, $tbl_name, $file_type, $file_name): $pbms_blob_url");
|
||||
fclose($fh);
|
||||
PMA_do_disconnect();
|
||||
return $pbms_blob_url;
|
||||
pbms_add_metadata("Content-type", $file_type);
|
||||
|
||||
$pbms_blob_url = pbms_read_stream($fh, filesize($file_name), $tbl_name);
|
||||
if (! $pbms_blob_url) {
|
||||
PMA_BS_ReportPBMSError("pbms_read_stream() Failed");
|
||||
}
|
||||
|
||||
fclose($fh);
|
||||
PMA_do_disconnect();
|
||||
return $pbms_blob_url;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_SetContentType($db_name, $bsTable, $blobReference, $contentType)
|
||||
{
|
||||
if (PMA_cacheGet('skip_blobstreaming', true))
|
||||
return FALSE;
|
||||
if (PMA_cacheGet('skip_blobstreaming', true)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// This is a really ugly way to do this but currently there is nothing better.
|
||||
// In a future version of PBMS the system tables will be redesigned to make this
|
||||
// more eficient.
|
||||
$query = "SELECT Repository_id, Repo_blob_offset FROM pbms_reference WHERE Blob_url='" . PMA_sqlAddslashes($blobReference) . "'";
|
||||
//error_log(" PMA_BS_SetContentType: $query\n", 3, "/tmp/mylog");
|
||||
$result = PMA_DBI_query($query);
|
||||
//error_log(" $query\n", 3, "/tmp/mylog");
|
||||
// This is a really ugly way to do this but currently there is nothing better.
|
||||
// In a future version of PBMS the system tables will be redesigned to make this
|
||||
// more eficient.
|
||||
$query = "SELECT Repository_id, Repo_blob_offset FROM pbms_reference WHERE Blob_url='" . PMA_sqlAddslashes($blobReference) . "'";
|
||||
//error_log(" PMA_BS_SetContentType: $query\n", 3, "/tmp/mylog");
|
||||
$result = PMA_DBI_query($query);
|
||||
//error_log(" $query\n", 3, "/tmp/mylog");
|
||||
|
||||
// if record exists
|
||||
if ($data = PMA_DBI_fetch_assoc($result))
|
||||
{
|
||||
$where = "WHERE Repository_id=" . $data['Repository_id'] . " AND Repo_blob_offset=" . $data['Repo_blob_offset'] ;
|
||||
$query = "SELECT name from pbms_metadata $where";
|
||||
$result = PMA_DBI_query($query);
|
||||
// if record exists
|
||||
if ($data = PMA_DBI_fetch_assoc($result)) {
|
||||
$where = "WHERE Repository_id=" . $data['Repository_id'] . " AND Repo_blob_offset=" . $data['Repo_blob_offset'] ;
|
||||
$query = "SELECT name from pbms_metadata $where";
|
||||
$result = PMA_DBI_query($query);
|
||||
|
||||
if (PMA_DBI_num_rows($result) == 0)
|
||||
$query = "INSERT into pbms_metadata Values( ". $data['Repository_id'] . ", " . $data['Repo_blob_offset'] . ", 'Content_type', '" . PMA_sqlAddslashes($contentType) . "')";
|
||||
else
|
||||
$query = "UPDATE pbms_metadata SET name = 'Content_type', Value = '" . PMA_sqlAddslashes($contentType) . "' $where";
|
||||
|
||||
if (PMA_DBI_num_rows($result) == 0) {
|
||||
$query = "INSERT into pbms_metadata Values( ". $data['Repository_id'] . ", " . $data['Repo_blob_offset'] . ", 'Content_type', '" . PMA_sqlAddslashes($contentType) . "')";
|
||||
} else {
|
||||
$query = "UPDATE pbms_metadata SET name = 'Content_type', Value = '" . PMA_sqlAddslashes($contentType) . "' $where";
|
||||
}
|
||||
//error_log("$query\n", 3, "/tmp/mylog");
|
||||
PMA_DBI_query($query);
|
||||
|
||||
|
||||
} else {
|
||||
// if ($result == FALSE) {
|
||||
// $err = PMA_DBI_getError();
|
||||
// error_log("MySQL ERROR: $err\n", 3, "/tmp/mylog");
|
||||
// } else
|
||||
// error_log("No results: $query\n", 3, "/tmp/mylog");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
PMA_DBI_query($query);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_IsHiddenTable($table)
|
||||
{
|
||||
switch ($table) {
|
||||
case 'pbms_repository' :
|
||||
case 'pbms_reference' :
|
||||
case 'pbms_metadata' :
|
||||
case 'pbms_metadata_header' :
|
||||
case 'pbms_dump' :
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
switch ($table) {
|
||||
case 'pbms_repository' :
|
||||
case 'pbms_reference' :
|
||||
case 'pbms_metadata' :
|
||||
case 'pbms_metadata_header' :
|
||||
case 'pbms_dump' :
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//------------
|
||||
function PMA_BS_getURL($reference)
|
||||
{
|
||||
// load PMA configuration
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
if (empty($PMA_Config))
|
||||
return FALSE;
|
||||
// load PMA configuration
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
if (empty($PMA_Config)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// retrieve BS server variables from PMA configuration
|
||||
$bs_server = $PMA_Config->get('BLOBSTREAMING_SERVER');
|
||||
if (empty($bs_server))
|
||||
return FALSE;
|
||||
// retrieve BS server variables from PMA configuration
|
||||
$bs_server = $PMA_Config->get('BLOBSTREAMING_SERVER');
|
||||
if (empty($bs_server)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$bs_url = 'http://' . $bs_server . '/' . rtrim($reference);
|
||||
//PMA_showMessage(" PMA_BS_getURL($reference): $bs_url");
|
||||
return $bs_url;
|
||||
|
||||
$bs_url = 'http://' . $bs_server . '/' . rtrim($reference);
|
||||
return $bs_url;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -788,7 +788,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
|
||||
$_SESSION['PMA_Theme_Manager']->setThemeCookie();
|
||||
|
||||
if (! empty($cfg['Server'])) {
|
||||
if (! empty($cfg['Server'])) {
|
||||
|
||||
/**
|
||||
* Loads the proper database interface for this server
|
||||
@@ -953,7 +953,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
// checks for blobstreaming plugins and databases that support
|
||||
// blobstreaming (by having the necessary tables for blobstreaming)
|
||||
checkBLOBStreamingPlugins();
|
||||
|
||||
|
||||
} // end if !defined('PMA_MINIMUM_COMMON')
|
||||
|
||||
// remove sensitive values from session
|
||||
|
@@ -654,19 +654,19 @@ function PMA_mysqlDie($error_message = '', $the_query = '',
|
||||
$back_url .= '?no_history=true';
|
||||
}
|
||||
|
||||
$_SESSION['Import_message']['go_back_url'] = $back_url;
|
||||
$_SESSION['Import_message']['go_back_url'] = $back_url;
|
||||
|
||||
$error_msg_output .= '<fieldset class="tblFooters">';
|
||||
$error_msg_output .= '[ <a href="' . $back_url . '">' . __('Back') . '</a> ]';
|
||||
$error_msg_output .= '</fieldset>' . "\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo $error_msg_output;
|
||||
/**
|
||||
* display footer and exit
|
||||
*/
|
||||
echo $error_msg_output;
|
||||
/**
|
||||
* display footer and exit
|
||||
*/
|
||||
|
||||
require_once './libraries/footer.inc.php';
|
||||
require_once './libraries/footer.inc.php';
|
||||
} else {
|
||||
echo $error_msg_output;
|
||||
}
|
||||
@@ -793,10 +793,9 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count =
|
||||
|
||||
foreach ($tables as $table_name => $table) {
|
||||
// if BS tables exist
|
||||
if (PMA_BS_IsHiddenTable($table_name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PMA_BS_IsHiddenTable($table_name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check for correct row count
|
||||
if (null === $table['Rows']) {
|
||||
|
@@ -311,10 +311,11 @@ function PMA_getTableCount($db)
|
||||
$num_tables = PMA_DBI_num_rows($tables);
|
||||
|
||||
// do not count hidden blobstreaming tables
|
||||
while ((($num_tables > 0)) && $data = PMA_DBI_fetch_assoc($tables)) {
|
||||
if (PMA_BS_IsHiddenTable($data['Tables_in_' . $db]))
|
||||
$num_tables--;
|
||||
}
|
||||
while ((($num_tables > 0)) && $data = PMA_DBI_fetch_assoc($tables)) {
|
||||
if (PMA_BS_IsHiddenTable($data['Tables_in_' . $db])) {
|
||||
$num_tables--;
|
||||
}
|
||||
}
|
||||
|
||||
PMA_DBI_free_result($tables);
|
||||
} else {
|
||||
|
@@ -1285,10 +1285,9 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
||||
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
|
||||
} else {
|
||||
// for blobstreaming
|
||||
|
||||
// if valid BS reference exists
|
||||
if (PMA_BS_IsPBMSReference($row[$i], $db)) {
|
||||
$blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
|
||||
// if valid BS reference exists
|
||||
if (PMA_BS_IsPBMSReference($row[$i], $db)) {
|
||||
$blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
|
||||
} else {
|
||||
$blobtext = PMA_handle_non_printable_contents('BLOB', (isset($row[$i]) ? $row[$i] : ''), $transform_function, $transform_options, $default_function, $meta, $_url_params);
|
||||
}
|
||||
@@ -1340,9 +1339,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
||||
// user asked to see the real contents of BINARY
|
||||
// fields
|
||||
if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && PMA_contains_nonprintable_ascii($row[$i])) {
|
||||
$row[$i] = bin2hex($row[$i]);
|
||||
}
|
||||
else {
|
||||
$row[$i] = bin2hex($row[$i]);
|
||||
} else {
|
||||
$row[$i] = htmlspecialchars(PMA_replace_binary_contents($row[$i]));
|
||||
}
|
||||
} else {
|
||||
@@ -1696,7 +1694,7 @@ function PMA_displayTable_checkConfigParams()
|
||||
} else {
|
||||
// display_binary_as_hex config option
|
||||
if (isset($GLOBALS['cfg']['DisplayBinaryAsHex']) && true === $GLOBALS['cfg']['DisplayBinaryAsHex']) {
|
||||
$_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] = true;
|
||||
$_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,12 +18,12 @@ class PMA_StorageEngine_pbms extends PMA_StorageEngine
|
||||
*/
|
||||
function engine_init()
|
||||
{
|
||||
$this->engine = "PBMS";
|
||||
$this->title = "PrimeBase Media Streaming Daemon";
|
||||
$this->comment = "Provides BLOB streaming service for storage engines,";
|
||||
$this->support = PMA_ENGINE_SUPPORT_YES;
|
||||
}
|
||||
|
||||
$this->engine = "PBMS";
|
||||
$this->title = "PrimeBase Media Streaming Daemon";
|
||||
$this->comment = "Provides BLOB streaming service for storage engines,";
|
||||
$this->support = PMA_ENGINE_SUPPORT_YES;
|
||||
}
|
||||
|
||||
function getVariables()
|
||||
{
|
||||
return array(
|
||||
@@ -64,16 +64,16 @@ class PMA_StorageEngine_pbms extends PMA_StorageEngine
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
function getInfoPages()
|
||||
|
||||
//--------------------
|
||||
function getInfoPages()
|
||||
{
|
||||
$pages = array();
|
||||
$pages['Documentation'] = __('Documentation');
|
||||
$pages['Documentation'] = __('Documentation');
|
||||
return $pages;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
//--------------------
|
||||
function getPage($id)
|
||||
{
|
||||
if (! array_key_exists($id, $this->getInfoPages())) {
|
||||
@@ -87,27 +87,27 @@ class PMA_StorageEngine_pbms extends PMA_StorageEngine
|
||||
|
||||
function getPageConfigure()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
function getPageDocumentation()
|
||||
{
|
||||
$output = '<p> Documentation and furtther information about PBMS can be found on ' . "\n"
|
||||
. '<a href="http://www.blobstreaming.org/" target="_blank">The PrimeBase Media Streaming home page</a>.<br><br>' . "\n"
|
||||
. '<table id="PBMS_Related_Links" >' . "\n"
|
||||
$output = '<p> Documentation and further information about PBMS can be found on ' . "\n"
|
||||
. '<a href="http://www.blobstreaming.org/" target="_blank">The PrimeBase Media Streaming home page</a>.<br><br>' . "\n"
|
||||
. '<table id="PBMS_Related_Links" >' . "\n"
|
||||
. '<tr>' . "\n"
|
||||
. '<td>' . "\n"
|
||||
. '<p>' . "\n"
|
||||
. '<strong><font size="2"><b>Related Links</b></font></strong>' . "\n"
|
||||
. '<br>' . "\n"
|
||||
. '<a href="http://bpbdev.blogspot.com/" target="_blank">The PrimeBase Media Streaming Blog by Barry Leslie</a><br><br>' . "\n"
|
||||
. '<a href="http://www.primebase.com/xt" target="_blank">PrimeBase XT Home Page</a><br><br>' . "\n"
|
||||
. '</font>' . "\n"
|
||||
. '</td>' . "\n"
|
||||
. '</tr>' . "\n"
|
||||
. '</table>' . "\n";
|
||||
. '<td>' . "\n"
|
||||
. '<p>' . "\n"
|
||||
. '<strong><font size="2"><b>Related Links</b></font></strong>' . "\n"
|
||||
. '<br>' . "\n"
|
||||
. '<a href="http://bpbdev.blogspot.com/" target="_blank">The PrimeBase Media Streaming Blog by Barry Leslie</a><br><br>' . "\n"
|
||||
. '<a href="http://www.primebase.com/xt" target="_blank">PrimeBase XT Home Page</a><br><br>' . "\n"
|
||||
. '</font>' . "\n"
|
||||
. '</td>' . "\n"
|
||||
. '</tr>' . "\n"
|
||||
. '</table>' . "\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -98,16 +98,16 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine
|
||||
}
|
||||
return PMA_formatByteDown($value);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
function getInfoPages()
|
||||
|
||||
//--------------------
|
||||
function getInfoPages()
|
||||
{
|
||||
$pages = array();
|
||||
$pages['Documentation'] = __('Documentation');
|
||||
$pages['Documentation'] = __('Documentation');
|
||||
return $pages;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
//--------------------
|
||||
function getPage($id)
|
||||
{
|
||||
if (! array_key_exists($id, $this->getInfoPages())) {
|
||||
@@ -121,23 +121,23 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine
|
||||
|
||||
function getPageDocumentation()
|
||||
{
|
||||
$output = '<p> Documentation and furtther information about PBXT can be found on the ' . "\n"
|
||||
. '<a href="http://www.primebase.com/xt/" target="_blank">PrimeBase XT Home Page</a>.<br><br>' . "\n"
|
||||
. '<table id="PBMS_Related_Links" >' . "\n"
|
||||
. '<tr>' . "\n"
|
||||
. '<td>' . "\n"
|
||||
. '<p>' . "\n"
|
||||
. '<strong><font size="2"><b>Related Links</b></font></strong>' . "\n"
|
||||
. '<br>' . "\n"
|
||||
. '<a href="http://pbxt.blogspot.com/" target="_blank">The PrimeBase XT Blog by Paul McCullagh</a><br><br>' . "\n"
|
||||
. '<a href="http://www.blobstreaming.org/" target="_blank">The PrimeBase Media Streaming (PBMS) home page</a>.<br><br>' . "\n"
|
||||
. '</font>' . "\n"
|
||||
. '</td>' . "\n"
|
||||
. '</tr>' . "\n"
|
||||
. '</table>' . "\n";
|
||||
$output = '<p> Documentation and further information about PBXT can be found on the ' . "\n"
|
||||
. '<a href="http://www.primebase.com/xt/" target="_blank">PrimeBase XT Home Page</a>.<br><br>' . "\n"
|
||||
. '<table id="PBMS_Related_Links" >' . "\n"
|
||||
. '<tr>' . "\n"
|
||||
. '<td>' . "\n"
|
||||
. '<p>' . "\n"
|
||||
. '<strong><font size="2"><b>Related Links</b></font></strong>' . "\n"
|
||||
. '<br>' . "\n"
|
||||
. '<a href="http://pbxt.blogspot.com/" target="_blank">The PrimeBase XT Blog by Paul McCullagh</a><br><br>' . "\n"
|
||||
. '<a href="http://www.blobstreaming.org/" target="_blank">The PrimeBase Media Streaming (PBMS) home page</a>.<br><br>' . "\n"
|
||||
. '</font>' . "\n"
|
||||
. '</td>' . "\n"
|
||||
. '</tr>' . "\n"
|
||||
. '</table>' . "\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* display list of server enignes and additonal information about them
|
||||
* display list of server engines and additonal information about them
|
||||
*
|
||||
* @todo falcon storage enginge is not listed under dev.mysql.com/doc/refman but dev.mysql.com/doc/falcon/
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
|
||||
@@ -81,20 +80,20 @@ if (empty($_REQUEST['engine'])
|
||||
$odd_row = !$odd_row;
|
||||
}
|
||||
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) {
|
||||
// Special case for PBMS daemon which is not listed as an engine
|
||||
echo '<tr class="'
|
||||
. ($odd_row ? 'odd' : 'even')
|
||||
. '">' . "\n"
|
||||
. ' <td><a href="./server_engines.php'
|
||||
. PMA_generate_common_url(array('engine' => "PBMS")) . '">' . "\n"
|
||||
. ' ' . "PBMS\n"
|
||||
. ' </a></td>' . "\n"
|
||||
. ' <td>' . htmlspecialchars("PrimeBase MediaStream (PBMS) daemon") . '</td>' . "\n"
|
||||
. '</tr>' . "\n";
|
||||
}
|
||||
|
||||
$PMA_Config = $GLOBALS['PMA_Config'];
|
||||
if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) {
|
||||
// Special case for PBMS daemon which is not listed as an engine
|
||||
echo '<tr class="'
|
||||
. ($odd_row ? 'odd' : 'even')
|
||||
. '">' . "\n"
|
||||
. ' <td><a href="./server_engines.php'
|
||||
. PMA_generate_common_url(array('engine' => "PBMS")) . '">' . "\n"
|
||||
. ' ' . "PBMS\n"
|
||||
. ' </a></td>' . "\n"
|
||||
. ' <td>' . htmlspecialchars("PrimeBase MediaStream (PBMS) daemon") . '</td>' . "\n"
|
||||
. '</tr>' . "\n";
|
||||
}
|
||||
|
||||
unset($odd_row, $engine, $details);
|
||||
echo '</tbody>' . "\n"
|
||||
. '</table>' . "\n";
|
||||
|
@@ -456,17 +456,17 @@ foreach ($rows as $row_id => $vrow) {
|
||||
} else {
|
||||
// special binary "characters"
|
||||
if ($field['is_binary'] || ($field['is_blob'] && ! $cfg['ProtectBinary'])) {
|
||||
if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) {
|
||||
$vrow[$field['Field']] = bin2hex($vrow[$field['Field']]);
|
||||
$field['display_binary_as_hex'] = true;
|
||||
} else {
|
||||
$vrow[$field['Field']] = PMA_replace_binary_contents($vrow[$field['Field']]);
|
||||
}
|
||||
if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $cfg['ShowFunctionFields']) {
|
||||
$vrow[$field['Field']] = bin2hex($vrow[$field['Field']]);
|
||||
$field['display_binary_as_hex'] = true;
|
||||
} else {
|
||||
$vrow[$field['Field']] = PMA_replace_binary_contents($vrow[$field['Field']]);
|
||||
}
|
||||
} // end if
|
||||
$special_chars = htmlspecialchars($vrow[$field['Field']]);
|
||||
|
||||
//We need to duplicate the first \n or otherwise we will lose the first newline entered in a VARCHAR or TEXT column
|
||||
$special_chars_encoded = PMA_duplicateFirstNewline($special_chars);
|
||||
//We need to duplicate the first \n or otherwise we will lose the first newline entered in a VARCHAR or TEXT column
|
||||
$special_chars_encoded = PMA_duplicateFirstNewline($special_chars);
|
||||
|
||||
$data = $vrow[$field['Field']];
|
||||
} // end if... else...
|
||||
@@ -562,9 +562,9 @@ foreach ($rows as $row_id => $vrow) {
|
||||
}
|
||||
|
||||
// this is set only when appropriate and is always true
|
||||
if (isset($field['display_binary_as_hex'])) {
|
||||
$default_function = 'UNHEX';
|
||||
}
|
||||
if (isset($field['display_binary_as_hex'])) {
|
||||
$default_function = 'UNHEX';
|
||||
}
|
||||
|
||||
// loop on the dropdown array and print all available options for that field.
|
||||
foreach ($dropdown as $each_dropdown){
|
||||
@@ -834,7 +834,7 @@ foreach ($rows as $row_id => $vrow) {
|
||||
|| ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) {
|
||||
echo "\n";
|
||||
// for blobstreaming
|
||||
if (PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type) && PMA_BS_IsPBMSReference($data, $db))
|
||||
if (PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type) && PMA_BS_IsPBMSReference($data, $db))
|
||||
{
|
||||
echo '<input type="hidden" name="remove_blob_ref_' . $field['Field_md5'] . $vkey . '" value="' . $data . '" />';
|
||||
echo '<input type="checkbox" name="remove_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Remove BLOB Repository Reference') . "<br />";
|
||||
@@ -889,10 +889,9 @@ foreach ($rows as $row_id => $vrow) {
|
||||
|
||||
if ($is_upload && $field['is_blob']) {
|
||||
// check if field type is of longblob and if the table is PBMS enabled.
|
||||
if (($field['pma_type'] == "longblob") && PMA_BS_IsTablePBMSEnabled($db_name, $tbl_name, $tbl_type))
|
||||
{
|
||||
echo '<br />';
|
||||
echo '<input type="checkbox" name="upload_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Upload to BLOB repository');
|
||||
if (($field['pma_type'] == "longblob") && PMA_BS_IsTablePBMSEnabled($db_name, $tbl_name, $tbl_type)) {
|
||||
echo '<br />';
|
||||
echo '<input type="checkbox" name="upload_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Upload to BLOB repository');
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
|
Reference in New Issue
Block a user