/**
  * Return current installation version
  *
  * @param void
  * @return string
  */
 function currentVersion()
 {
     if ($this->current_version === false) {
         $row = $this->db->execute_one('SELECT version FROM ' . TABLE_PREFIX . 'update_history ORDER BY created_on DESC LIMIT 0, 1');
         $this->current_version = is_array($row) ? $row['version'] : '1.0';
         // activeCollab 2.0.2 failed to record proper version into update
         // history  so we need to manually check if we have 2.0.2. This is done
         // by checking if acx_attachments table exists (introduced in aC 2).
         if (version_compare($this->current_version, '2.0') < 0 && in_array(TABLE_PREFIX . 'attachments', $this->db->listTables(TABLE_PREFIX))) {
             $this->current_version = '2.0.2';
         }
         // if
     }
     // if
     return $this->current_version;
 }
        header('Pragma: public');
    } else {
        header('Content-Disposition: attachment; filename="' . $filename . '.' . $ext . '"');
        header('Expires: 0');
        header('Pragma: no-cache');
    }
}
// end download
/**
 * Builds the dump
 */
// Gets the number of tables if a dump of a database has been required
if (!isset($_POST['table_select']) || count($_POST['table_select']) != 1) {
    $auxConn = new DbConnection();
    $auxConn->connect();
    $result = $auxConn->listTables();
    $numTables = $result ? $auxConn->numRows() : 0;
    $single = false;
} else {
    $numTables = 1;
    $single = true;
}
// No table -> error message
if ($numTables == 0) {
    echo '# ' . _("No tables found in database.");
} else {
    // No csv or xml format -> add some comments at the top
    if ($_POST['what'] != 'csv' && $_POST['what'] != 'excel' && $_POST['what'] != 'xml') {
        switch ($_POST['what']) {
            case "data":
                $auxStr = _("Structure and data");