$uv = substr($uv, 4, 32);
         break;
     }
 }
 $date = strtotime(substr($date, 1, strlen($date) - 2));
 $formatted_date = strftime("%Y-%m-%d %H:%M:%S", $date);
 $s = urldecode($url);
 $s = parse_url($s, PHP_URL_QUERY);
 $vars = parse_vars($s);
 if ($mode == 1 && $desired_mode & 1) {
     $ps2_lines++;
     $partner_id = @$vars["partner_id"];
     $obj_type = @$vars["obj_type"];
     if ($obj_type == "entry") {
         $extra_info = @$vars["extra_info"];
         $evars = parse_vars($extra_info);
         if (!array_key_exists("obj_id", $vars) || !array_key_exists("command", $vars)) {
             fprintf($stderr, "\n%s\n", $s);
             continue;
         }
         $widget_id = @$evars["widgetId"];
         $entry_id = @$vars["obj_id"];
         $uid = @$vars["uid"];
         $command = @$vars["command"];
         if ($command == "view") {
             $event_type = "2";
         } else {
             if ($command == "play") {
                 $event_type = "3";
             } else {
                 $event_type = "0";
        $tables = $setup_info[$appname]['tables'];
        $i = 0;
        $tbls = count($tables);
        while (list($key, $table) = @each($tables)) {
            $i++;
            if ($i == $tbls) {
                $term = '';
            }
            parse_vars($table, $term);
            $dlstring .= printout('sqlbody');
            /* $i++; */
        }
        $dlstring .= printout('sqlfooter');
    } elseif ($table) {
        $term = ';';
        parse_vars($table, $term);
        $dlstring .= printout('sqlheader');
        $dlstring .= printout('sqlbody');
        $dlstring .= printout('sqlfooter');
    }
    if ($download) {
        download_handler($dlstring);
    }
} else {
    $GLOBALS['phpgw_setup']->html->show_header();
    $setup_tpl->set_var('action_url', 'sqltoarray.php');
    $setup_tpl->set_var('lang_submit', 'Show selected');
    $setup_tpl->set_var('lang_showall', 'Show all');
    $setup_tpl->set_var('title', 'SQL to schema_proc array util');
    $setup_tpl->set_var('lang_applist', 'Applications');
    $setup_tpl->set_var('select_to_download_file', lang('Select to download file'));