*/
function PMA_query_as_cu($sql, $show_error = true, $options = 0)
{
// Comparing resource ids works on PHP 5 because, when no controluser
// is defined, connecting with the same user for controllink does
// not create a new connection. However a new connection is created
// on PHP 4, so we cannot directly compare resource ids.
if ($GLOBALS['controllink'] == $GLOBALS['userlink'] || PMA_MYSQL_INT_VERSION < 50000) {
PMA_DBI_select_db($GLOBALS['cfg']['Server']['pmadb'], $GLOBALS['controllink']);
}
if ($show_error) {
$result = PMA_DBI_query($sql, $GLOBALS['controllink'], $options);
} else {
$result = @PMA_DBI_try_query($sql, $GLOBALS['controllink'], $options);
} // end if... else...
// It makes no sense to restore database on control user
if ($GLOBALS['controllink'] == $GLOBALS['userlink'] || PMA_MYSQL_INT_VERSION < 50000) {
PMA_DBI_select_db($GLOBALS['db'], $GLOBALS['controllink']);
}
if ($result) {
return $result;
} else {
return false;
}
} // end of the "PMA_query_as_cu()" function
/**
* @uses $GLOBALS['cfgRelation'] to set it
* @uses PMA__getRelationsParam()
* @uses PMA_printRelationsParamDiagnostic()
* @param bool $verbose whether to print diagnostic info
* @return array $cfgRelation
*/
function PMA_getRelationsParam($verbose = false)
{
static $cfgRelation = null;
if (null === $cfgRelation) {
$cfgRelation = PMA__getRelationsParam();
}
if ($verbose) {
PMA_printRelationsParamDiagnostic($cfgRelation);
}
// just for BC
$GLOBALS['cfgRelation'] = $cfgRelation;
return $cfgRelation;
}
/**
* prints out diagnostic info for pma relation feature
*
* @uses $GLOBALS['server']
* @uses $GLOBALS['controllink']
* @uses $GLOBALS['strNotOK']
* @uses $GLOBALS['strDocu']
* @uses $GLOBALS['strGeneralRelationFeat']
* @uses $GLOBALS['strDisabled']
* @uses $GLOBALS['strEnabled']
* @uses $GLOBALS['strDisplayFeat']
* @uses $GLOBALS['strCreatePdfFeat']
* @uses $GLOBALS['strColComFeat']
* @uses $GLOBALS['strBookmarkQuery']
* @uses $GLOBALS['strUpdComTab']
* @uses $GLOBALS['strQuerySQLHistory']
* @uses $GLOBALS['strDesigner']
* @uses $cfg['Server']['pmadb']
* quses sprintf()
* @param array $cfgRelation
*/
function PMA_printRelationsParamDiagnostic($cfgRelation)
{
if (false === $GLOBALS['cfg']['Server']['pmadb']) {
echo 'PMA Database ... '
. '' . $GLOBALS['strNotOK'] . ''
. '[ ' . $GLOBALS['strDocu']
. ' ]
' . "\n"
. $GLOBALS['strGeneralRelationFeat']
. ' ' . $GLOBALS['strDisabled']
. '' . "\n";
return;
}
$shit = '' . $GLOBALS['strNotOK']
. ' [ '
. $GLOBALS['strDocu'] . ' ]';
$hit = '' . $GLOBALS['strOK'] . '';
$enabled = '' . $GLOBALS['strEnabled'] . '';
$disabled = '' . $GLOBALS['strDisabled'] . '';
echo '
$cfg[\'Servers\'][$i][\'pmadb\'] ... | ' . (($GLOBALS['cfg']['Server']['pmadb'] == false) ? sprintf($shit, 'pmadb') : $hit) . ' |
---|---|
$cfg[\'Servers\'][$i][\'relation\'] ... | ' . ((isset($cfgRelation['relation'])) ? $hit : sprintf($shit, 'relation')) . ' |
'. $GLOBALS['strGeneralRelationFeat'] . ': ' . ($cfgRelation['relwork'] ? $enabled : $disabled) . ' | |
$cfg[\'Servers\'][$i][\'table_info\'] ... | ' . (($cfgRelation['displaywork'] == false) ? sprintf($shit, 'table_info') : $hit) . ' |
' . $GLOBALS['strDisplayFeat'] . ': ' . ($cfgRelation['displaywork'] ? $enabled : $disabled) . ' | |
$cfg[\'Servers\'][$i][\'table_coords\'] ... | ' . ((isset($cfgRelation['table_coords'])) ? $hit : sprintf($shit, 'table_coords')) . ' |
$cfg[\'Servers\'][$i][\'pdf_pages\'] ... | ' . ((isset($cfgRelation['pdf_pages'])) ? $hit : sprintf($shit, 'table_coords')) . ' |
' . $GLOBALS['strCreatePdfFeat'] . ': ' . ($cfgRelation['pdfwork'] ? $enabled : $disabled) . ' | |
$cfg[\'Servers\'][$i][\'column_info\'] ... | ' . ((isset($cfgRelation['column_info'])) ? $hit : sprintf($shit, 'col_com')) . ' |
' . $GLOBALS['strColComFeat'] . ': ' . ($cfgRelation['commwork'] ? $enabled : $disabled) . ' | |
' . $GLOBALS['strBookmarkQuery'] . ': ' . ($cfgRelation['bookmarkwork'] ? $enabled : $disabled) . ' | |
MIME ... | ' . ($cfgRelation['mimework'] ? $hit : sprintf($shit, 'col_com')) . ' |
' . $GLOBALS['strUpdComTab'] . ' | |
$cfg[\'Servers\'][$i][\'history\'] ... | ' . ((isset($cfgRelation['history'])) ? $hit : sprintf($shit, 'history')) . ' |
' . $GLOBALS['strQuerySQLHistory'] . ': ' . ($cfgRelation['historywork'] ? $enabled : $disabled) . ' | |
$cfg[\'Servers\'][$i][\'designer_coords\'] ... | ' . ((isset($cfgRelation['designer_coords'])) ? $hit : sprintf($shit, 'designer_coords')) . ' |
' . $GLOBALS['strDesigner'] . ': ' . ($cfgRelation['designerwork'] ? $enabled : $disabled) . ' |