bug #2064649 Missing question mark
[phpmyadmin/crack.git] / bs_change_mime_type.php
blobc59fa181a158ba1b8681168fd52d12d2fe7b1781
1 <?php
2 /**
3 * @author Raj Kissu Rajandran
4 * @version 1.0
5 * @package BLOBStreaming
6 */
7 require_once './libraries/common.inc.php';
9 /**
10 * @var string contains database name
12 $bsDB = isset($_REQUEST['bs_db']) ? urldecode($_REQUEST['bs_db']) : NULL;
14 /**
15 * @var string contains table name
17 $bsTable = isset($_REQUEST['bs_table']) ? urldecode($_REQUEST['bs_table']) : NULL;
19 /**
20 * @var string contains BLOB reference
22 $bsReference = isset($_REQUEST['bs_reference']) ? urldecode($_REQUEST['bs_reference']) : NULL;
24 /**
25 * @var string contains MIME type
27 $bsNewMIMEType = isset($_REQUEST['bs_new_mime_type']) ? urldecode($_REQUEST['bs_new_mime_type']) : NULL;
29 // necessary variables exist
30 if ($bsDB && $bsTable && $bsReference && $bsNewMIMEType)
32 // load PMA configuration
33 $PMA_Config = $_SESSION['PMA_Config'];
35 // if PMA configuration exists
36 if (!empty($PMA_Config))
38 // if BS plugins exist
39 if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST'))
41 $mybs_ref_tbl = $PMA_Config->get('PBMS_NAME') . '_reference';
42 $mybs_cust_content_type_tbl = $PMA_Config->get('PBMS_NAME') . '_custom_content_type';
44 // if specified DB is selected
45 if (PMA_DBI_select_db($bsDB))
47 $query = "SELECT * FROM " . PMA_backquote($mybs_ref_tbl);
48 $query .= " WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'";
50 $result = PMA_DBI_query($query);
52 // if record exists
53 if ($data = PMA_DBI_fetch_assoc($result))
55 $query = "SELECT count(*) FROM " . PMA_backquote($mybs_cust_content_type_tbl);
56 $result = PMA_DBI_query($query);
58 // if record exists
59 if ($data = PMA_DBI_fetch_assoc($result))
61 if (1 == $data['count(*)'])
63 $query = "UPDATE " . PMA_backquote($mybs_cust_content_type_tbl) . " SET Content_type='";
64 $query .= PMA_sqlAddslashes($bsNewMIMEType) . "' WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'";
66 else
68 $query = "INSERT INTO " . PMA_backquote($mybs_cust_content_type_tbl) . " (Blob_url, Content_type)";
69 $query .= " VALUES('" . PMA_sqlAddslashes($bsReference) . "', '" . PMA_sqlAddslashes($bsNewMIMEType) . "')";
72 $result = PMA_DBI_query($query);
74 // if query execution succeeded
75 if ($result)
77 // determine redirector page
78 $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';
80 // redirect to specified page
82 <script>
83 window.location = "<?php echo $newLoc ?>";
84 </script>
85 <?php
86 } // end if ($result)
87 } // end if ($data = PMA_DBI_fetch_assoc($result))
88 } // end if ($data = PMA_DBI_fetch_assoc($result))
89 } // end if (PMA_DBI_select_db($bsDB))
90 } // end if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST'))
91 } // end if (!empty($PMA_Config))
92 } // end if ($bsDB && $bsTable && $bsReference && $bsNewMIMEType)