if ($tempDb->dbVersion == 2) {
         $tempDb->close();
     } else {
         $tempDb = null;
     }
 }
 echo "\n\t" . '<tr class="database" style="vertical-align: middle">' . "\n\t\t" . '<td class="img_db" width="18">' . displayPics($dbPics, '', 0, 20) . '</td>' . "\n\t\t" . '<td class="name_db"><a href="index.php?dbsel=' . $ligne['id'] . '" target="_parent" class="dbsel">' . $ligne['name'] . '</a></td>' . "\n\t" . '</tr>';
 if ($dbsel == $ligne['id']) {
     include_once INCLUDE_LIB . 'SQLiteDbConnect.class.php';
     $tempDir = dirname($ligne['location']);
     if ($tempDir == '.') {
         $baseLocation = DEFAULT_DB_PATH . $ligne['location'];
     } else {
         $baseLocation = $ligne['location'];
     }
     $workDb = new SQLiteDbConnect($baseLocation);
     if (is_resource($workDb->connId) || is_object($workDb->connId)) {
         echo "\n\t" . '<tr valign="middle"><td colspan="2" class="objects" align="right">' . "\n\t\t" . '<table class="items" width="' . (LEFT_FRAME_WIDTH - 25) . '" border="0" cellspacing="0" cellpadding="0">';
         foreach ($dbItems as $item) {
             $list = $workDb->getPropList($item);
             if (is_array($list) && count($list)) {
                 foreach ($list as $Name) {
                     $actionLink = '<a href="main.php?dbsel=' . $dbsel . '&amp;' . strtolower($item) . '=' . urlencode($Name) . '" target="main" class="item">';
                     echo "\n\t\t" . '<tr>';
                     echo '<td class="image" style="white-space: nowrap">' . $actionLink . displayPics(strtolower($item) . 's.png') . '</a>';
                     if ($item != 'Function' && $item != 'Trigger') {
                         echo '<a href="main.php?dbsel=' . $dbsel . '&amp;' . strtolower($item) . '=' . urlencode($Name) . '&amp;action=browseItem" target="main">' . displayPics('browse.png', '', 0, 10) . '</a>';
                     } else {
                         echo displayPics('nobrowse.png');
                     }
                     echo '</td>';
    ?>
				</div>
			</td>
		</tr>
	</table>
<?php 
} elseif (!isset($GLOBALS["action"]) || $GLOBALS["action"] != "auth") {
    // gestion de la base selectionné
    include_once INCLUDE_LIB . "SQLiteDbConnect.class.php";
    $tempDir = dirname($tabInfoDb['location']);
    if ($tempDir == '.') {
        $baseLocation = DEFAULT_DB_PATH . $tabInfoDb['location'];
    } else {
        $baseLocation = $tabInfoDb['location'];
    }
    $workDb = new SQLiteDbConnect($baseLocation);
    displayHeader("main");
    displayMenuTitle();
    $workDb->includeUDF();
    if (ALLOW_FULLSEARCH) {
        include_once INCLUDE_LIB . "sqlite_fulltextsearchex.class.php";
        $sqlite_fts = new sqlite_fulltextsearchex();
        $sqlite_fts->register($workDb->connId);
        $sqlite_fts->use_against_cache = true;
    }
    switch ($action) {
        case '':
        case 'properties':
        default:
            if ($workDb->isReadable()) {
                if ($table || $TableName) {
    /**
     * Database attachment management and display
     *
     * @access public	
     */
    function attachDb()
    {
        // save form result Or Del attach database
        if (isset($_REQUEST['attach_action']) && $_REQUEST['attachId']) {
            switch ($_REQUEST['attach_action']) {
                case 'add':
                    $query = 'INSERT INTO attachment (base_id, attach_id) VALUES (' . quotes($GLOBALS['dbsel']) . ', ' . quotes($_REQUEST['attachId']) . ');';
                    break;
                case 'del':
                    $query = 'DELETE FROM attachment WHERE id=' . quotes($_REQUEST['attachId']) . ';';
                    break;
            }
            $GLOBALS['db']->query($query);
        }
        //echo "<script type=\"text/javascript\">parent.left.location.reload();</script>";
        // display attach database attach and form to add it
        $out = '<table width="80%"><tr><td align="center">';
        $out .= '<fieldset><legend>' . $GLOBALS['traduct']->get(146) . '</legend>
					<table class="Browse" cellspacing="0" width="200">
						<thead>
							<tr class="Browse">
								<td colspan=2 align="center" class="tapPropTitle">' . $GLOBALS['traduct']->get(131) . '</td>
							</tr>
						</thead>' . "\n";
        $tabAttach = SQLiteDbConnect::getAttachDb();
        $tabAttachId = array();
        foreach ($tabAttach as $attach_id => $attachInfo) {
            $tabAttachId[] = $attach_id;
            $color = $attach_id % 2 ? '#f7f3ef' : '#e7dfce';
            $out .= '		<tr class="Browse" bgcolor="' . $color . '">
							<td class="Browse">' . $attachInfo['name'] . '</td><td class="Browse" align="center"><a href="?dbsel=' . $GLOBALS['dbsel'] . '&amp;action=options&amp;options_action=attach&amp;attach_action=del&amp;attachId=' . $attachInfo['id'] . '">' . displayPics("supprime.gif", $GLOBALS['traduct']->get(86)) . '</a></td>
						</tr>' . "\n";
        }
        $query = 'SELECT * FROM database';
        $tabDb = $GLOBALS['db']->array_query($query, SQLITE_ASSOC);
        $out .= '			<tr class="Browse">
							<form name="attachDb" method="POST">
							<td style="padding:5px" colspan="2" align="center">
								<select name="attachId">
								<option value="">' . $GLOBALS['traduct']->get(227) . '</option>' . "\n";
        foreach ($tabDb as $dbInfo) {
            if (!in_array($dbInfo['id'], $tabAttachId) && $dbInfo['id'] != $GLOBALS['dbsel']) {
                $tempDb = $GLOBALS["SQLiteFactory"]->sqliteGetInstance($dbInfo["location"]);
                if (is_object($tempDb)) {
                    $versionNum = $tempDb->getVersion();
                    if ($versionNum == $this->connId->connId->getVersion()) {
                        $out .= '<option value="' . $dbInfo['id'] . '">' . $dbInfo['name'] . '</option>';
                    }
                }
            }
        }
        $out .= '						</select>
									<input class="button" type="submit" value="' . $GLOBALS['traduct']->get(43) . '">
							</td>
							<input type="hidden" name="dbsel" value="' . $GLOBALS['dbsel'] . '">
							<input type="hidden" name="action" value="options">
							<input type="hidden" name="options_action" value="attach">
							<input type="hidden" name="attach_action" value="add">
							</form>
						</tr>';
        $out .= '			</table>
				</fieldset>
			</td></tr></table>';
        return $out;
    }