function display_companies()
{
    global $def_coy, $db_connections;
    $coyno = $_SESSION["wa_current_user"]->company;
    echo "\n\t\t<script language='javascript'>\n\t\tfunction deleteCompany(id, name) {\n\t\t\tif (!confirm('" . _("Are you sure you want to delete company no. ") . "'+id+' '+name+'?'))\n\t\t\t\treturn\n\t\t\tdocument.location.replace('create_coy.php?c=df&id='+id)\n\t\t}\n\t\t</script>";
    start_table(TABLESTYLE);
    $th = array(_("Company"), _("Database Host"), _("Database User"), _("Database Name"), _("Table Pref"), _("Default"), "", "");
    table_header($th);
    $k = 0;
    $conn = $db_connections;
    $n = count($conn);
    for ($i = 0; $i < $n; $i++) {
        if ($i == $def_coy) {
            $what = _("Yes");
        } else {
            $what = _("No");
        }
        if ($i == $coyno) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        label_cell($conn[$i]['name']);
        label_cell($conn[$i]['host']);
        label_cell($conn[$i]['dbuser']);
        label_cell($conn[$i]['dbname']);
        label_cell($conn[$i]['tbpref']);
        label_cell($what);
        $edit = _("Edit");
        $delete = _("Delete");
        if (user_graphic_links()) {
            $edit = set_icon(ICON_EDIT, $edit);
            $delete = set_icon(ICON_DELETE, $delete);
        }
        label_cell("<a href='" . $_SERVER['PHP_SELF'] . "?selected_id={$i}'>{$edit}</a>");
        $name = "\"" . $conn[$i]['name'] . "\"";
        label_cell($i == $coyno ? '' : "<a href='javascript:deleteCompany({$i}, {$name})'>{$delete}</a>");
        end_row();
    }
    end_table();
    display_note(_("The marked company is the current company which cannot be deleted."), 0, 0, "class='currentfg'");
    display_note(_("If no Admin Password is entered, the new Admin Password will be '<b>password</b>' by default "), 1, 0, "class='currentfg'");
}
possible separators can be added by modifying the array definition by editing that file */
if (!isset($_POST['language'])) {
    $_POST['language'] = $_SESSION['language']->code;
}
table_section_title(_("Language"));
languages_list_row(_("Language:"), 'language', $_POST['language']);
table_section(2);
table_section_title(_("Miscellaneous"));
check_row(_("Show hints for new users:"), 'show_hints', user_hints());
check_row(_("Show GL Information:"), 'show_gl', user_show_gl_info());
check_row(_("Show Item Codes:"), 'show_codes', user_show_codes());
themes_list_row(_("Theme:"), "theme", user_theme());
/* The array $themes is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
pagesizes_list_row(_("Page Size:"), "page_size", user_pagesize());
tab_list_row(_("Start-up Tab"), 'startup_tab', user_startup_tab());
/* The array $pagesizes is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
if (!isset($_POST['print_profile'])) {
    $_POST['print_profile'] = user_print_profile();
}
print_profiles_list_row(_("Printing profile") . ':', 'print_profile', null, _('Browser printing support'));
check_row(_("Use popup window to display reports:"), 'rep_popup', user_rep_popup(), false, _('Set this option to on if your browser directly supports pdf files'));
check_row(_("Use icons instead of text links:"), 'graphic_links', user_graphic_links(), false, _('Set this option to on for using icons instead of text links'));
text_row_ex(_("Query page size:"), 'query_size', 5, 5, '', user_query_size());
check_row(_("Remember last document date:"), 'sticky_doc_date', sticky_doc_date(), false, _('If set document date is remembered on subsequent documents, otherwise default is current date'));
end_outer_table(1);
submit_center('setprefs', _("Update"), true, '', 'default');
end_form(2);
//-------------------------------------------------------------------------------------------------
end_page();
 function pager_link($link_text, $url, $icon = false)
 {
     global $path_to_root;
     if (user_graphic_links() && $icon) {
         $link_text = set_icon($icon, $link_text);
     }
     $href = $path_to_root . $url;
     return "<a href='{$href}'>" . $link_text . "</a>";
 }
 function button($name, $value, $title = false, $icon = false, $aspect = '')
 {
     // php silently changes dots,spaces,'[' and characters 128-159
     // to underscore in POST names, to maintain compatibility with register_globals
     $rel = '';
     if ($aspect == 'selector') {
         $rel = " rel='{$value}'";
         $value = _("Select");
     }
     if (user_graphic_links() && $icon) {
         if ($value == _("Delete")) {
             // Helper during implementation
             $icon = ICON_DELETE;
         }
         return "<button type='submit' class='btn editbutton' name='" . htmlentities(strtr($name, array('.' => '=2E', '=' => '=3D'))) . "' value='1'" . ($title ? " title='{$title}'" : " title='{$value}'") . ($aspect ? " aspect='{$aspect}'" : '') . $rel . " />" . set_icon($icon) . "</button>\n";
     } else {
         return "<input type='submit' class='btn editbutton' name='" . htmlentities(strtr($name, array('.' => '=2E', '=' => '=3D'))) . "' value='{$value}'" . ($title ? " title='{$title}'" : '') . ($aspect ? " aspect='{$aspect}'" : '') . $rel . " />\n";
     }
 }