示例#1
0
/**
* Display query has been execute
*
* @param string $query
* @param bool $withLink if true some links will be display
*/
function displayQuery($query, $withLink = true, $changesLines = '')
{
    global $SQLiteManagerAuth;
    if (empty($query) && isset($GLOBALS['DisplayQuery'])) {
        $query = $GLOBALS['DisplayQuery'];
    }
    $linkBase = 'main.php?dbsel=' . $GLOBALS['dbsel'] . '&table=' . $GLOBALS['table'];
    if ($posLim = strpos($query, 'LIMIT')) {
        $queryLink = substr($query, 0, $posLim - 1);
    } else {
        $queryLink = $query;
    }
    if (isset($GLOBALS['DbGrid']) && is_object($GLOBALS['DbGrid'])) {
        if (!empty($GLOBALS['DbGrid']->infoNav['start']) || !empty($GLOBALS['DbGrid']->infoNav['end']) || !empty($GLOBALS['DbGrid']->infoNav['all'])) {
            $infoNav = '<span style="font-size: 12px">' . $GLOBALS['traduct']->get(136) . ' ' . $GLOBALS['DbGrid']->infoNav['start'] . '-' . $GLOBALS['DbGrid']->infoNav['end'] . '/' . $GLOBALS['DbGrid']->infoNav['all'] . '&nbsp;&nbsp;</span>';
        }
    }
    if (!isset($infoNav)) {
        $infoNav = '';
    }
    if (WITH_AUTH && isset($SQLiteManagerAuth) && !$SQLiteManagerAuth->getAccess('execSQL')) {
        $withLink = false;
    }
    $modifyLink = '[<a href="' . $linkBase . '&amp;action=sql&amp;sql_action=modify&amp;displayResult=&amp;DisplayQuery=' . urlencode($queryLink) . '" class="titleHeader" target="main">' . $GLOBALS['traduct']->get(14) . '</a>]';
    $explainLink = '[<a href="' . $linkBase . '&amp;action=sql&amp;sql_action=explain&amp;displayResult=1&amp;DisplayQuery=' . urlencode($queryLink) . '" class="titleHeader" target="main">' . $GLOBALS['traduct']->get(145) . '</a>]';
    $replayLink = '[<a href="' . $linkBase . '&amp;action=sql&amp;displayResult=1&amp;DisplayQuery=' . urlencode($queryLink) . '" class="titleHeader" target="main">' . $GLOBALS['traduct']->get(223) . '</a>]';
    echo '
		<table class="query" cellspacing="0" align="center">';
    if ($changesLines != '') {
        echo '<tr><td bgcolor="#CCCCCC"><span class="sqlsyntaxe">&nbsp;' . $changesLines . ' ' . $GLOBALS['traduct']->get(71) . '</span></td></tr>';
    }
    echo '		<tr>
				<td class="queryTitle" bgcolor="' . $GLOBALS['displayQueryTitleColor'] . '"  style="white-space: nowrap">
					' . $GLOBALS['traduct']->get(90) . ' : ' . ($withLink ? '&nbsp;&nbsp;' . $infoNav . $modifyLink . '&nbsp;' . $explainLink . '&nbsp;' . $replayLink : '') . '</td></tr>
			<tr><td class="queryBody" bgcolor="' . $GLOBALS['displayQueryBgColor'] . '" style="white-space: nowrap"><div class="sqlsyntaxe">' . highlight_query($query) . '</div></td></tr>
		</table><br/>
		';
}
    /**
     * Display current VIEW properties
     *
     * @access public
     */
    function propView()
    {
        echo '<!-- SQLiteViewProperties.class.php : propView() -->' . "\n";
        echo '<br>';
        echo '	<table cellpadding="2" cellspacing="0" width="90%" class="viewProp">
					<tr class="viewPropTitle"><td align="right" width="20%" class="viewPropTitle">' . $GLOBALS['traduct']->get(19) . ' :&nbsp;</td><td align="center" class="viewPropTitle">' . $this->view . '</td></tr>
					<tr><td align="right" class="viewProp">' . $GLOBALS['traduct']->get(61) . ' :&nbsp;</td><td class="viewProp">' . highlight_query($this->viewProperties) . '</td></tr>
				</table>';
        echo '<div align="center">';
        if (!$GLOBALS['workDb']->isReadOnly() && displayCondition('properties')) {
            echo '<a href="main.php?dbsel=' . $GLOBALS['dbsel'] . '&amp;view=' . $this->view . '&amp;action=modify" class="base" target="main">' . $GLOBALS['traduct']->get(14) . '</a>';
        } else {
            echo '<span class="base"><i>' . $GLOBALS['traduct']->get(14) . '</i></span>';
        }
        echo str_repeat('&nbsp;', 10);
        if (!$GLOBALS['workDb']->isReadOnly() && displayCondition('del')) {
            echo '<a href="main.php?dbsel=' . $GLOBALS['dbsel'] . '&amp;view=' . $this->view . '&amp;action=delete" class="base" target="main">' . $GLOBALS['traduct']->get(15) . '</a>';
        } else {
            echo '<span class="base"><i>' . $GLOBALS['traduct']->get(15) . '</i></span>';
        }
        echo '</div>';
    }