From: Nicola S. <nso...@ti...> - 2003-12-27 01:19:27
|
header("Location: {$url}"); doesn't work without cookies if you don't put the PPA_ID in the URL. Login screen appears. Merry Xmas Nicola Alle 11:44, domenica 21 dicembre 2003, Christopher Kings-Lynne ha scritto: > Update of /cvsroot/phppgadmin/webdb > In directory sc8-pr-cvs1:/tmp/cvs-serv31185 > > Modified Files: > dataexport.php dbexport.php > Log Message: > if they have pg_dump installed and set up, then use that to dump tables, > not our built-in dodgy dumper > > Index: dataexport.php > =================================================================== > RCS file: /cvsroot/phppgadmin/webdb/dataexport.php,v > retrieving revision 1.7 > retrieving revision 1.8 > diff -C2 -d -r1.7 -r1.8 > *** dataexport.php 17 Dec 2003 09:11:32 -0000 1.7 > --- dataexport.php 21 Dec 2003 10:44:52 -0000 1.8 > *************** > *** 2,6 **** > > /** > ! * Does an export to the screen or as a download > * > * $Id$ > --- 2,7 ---- > > /** > ! * Does an export to the screen or as a download. This checks to > ! * see if they have pg_dump set up, and will use it if possible. > * > * $Id$ > *************** > *** 21,37 **** > // If format is set, then perform the export > if (isset($_REQUEST['what'])) { > ! > switch ($_REQUEST['what']) { > case 'dataonly': > ! $format = $_REQUEST['d_format']; > ! $oids = $_REQUEST['d_oids']; > break; > case 'structureonly': > ! $clean = $_REQUEST['s_clean']; > break; > case 'structureanddata': > ! $format = $_REQUEST['sd_format']; > ! $clean = $_REQUEST['sd_clean']; > ! $oids = $_REQUEST['sd_oids']; > break; > } > --- 22,86 ---- > // If format is set, then perform the export > if (isset($_REQUEST['what'])) { > ! > ! // Include application functions > ! $_no_output = true; > ! include_once('./libraries/lib.inc.php'); > ! > switch ($_REQUEST['what']) { > case 'dataonly': > ! // Check to see if they have pg_dump set up and if they do, use that > ! // instead of custom dump code > ! if ($conf['pg_dump_path'] !== null && $conf['pg_dump_path'] != '' > ! && ($_REQUEST['d_format'] == 'copy' || $_REQUEST['d_format'] == > 'sql')) { ! $url = 'dbexport.php?database=' . > urlencode($_REQUEST['database']); ! $url .= '&what=' . > urlencode($_REQUEST['what']); > ! $url .= '&table=' . urlencode($_REQUEST['table']); > ! $url .= '&d_format=' . urlencode($_REQUEST['d_format']); > ! if (isset($_REQUEST['d_oids'])) $url .= '&d_oids=' . > urlencode($_REQUEST['d_oids']); ! if (isset($_REQUEST['download'])) > $url .= '&download=' . urlencode($_REQUEST['download']); ! > ! header("Location: {$url}"); > ! exit; > ! } > ! else { > ! $format = $_REQUEST['d_format']; > ! $oids = isset($_REQUEST['d_oids']); > ! } > break; > case 'structureonly': > ! // Check to see if they have pg_dump set up and if they do, use that > ! // instead of custom dump code > ! if ($conf['pg_dump_path'] !== null && $conf['pg_dump_path'] != '') { > ! $url = 'dbexport.php?database=' . urlencode($_REQUEST['database']); > ! $url .= '&what=' . urlencode($_REQUEST['what']); > ! $url .= '&table=' . urlencode($_REQUEST['table']); > ! if (isset($_REQUEST['s_clean'])) $url .= '&s_clean=' . > urlencode($_REQUEST['s_clean']); ! if (isset($_REQUEST['download'])) > $url .= '&download=' . urlencode($_REQUEST['download']); ! > ! header("Location: {$url}"); > ! exit; > ! } > ! else $clean = isset($_REQUEST['s_clean']); > break; > case 'structureanddata': > ! // Check to see if they have pg_dump set up and if they do, use that > ! // instead of custom dump code > ! if ($conf['pg_dump_path'] !== null && $conf['pg_dump_path'] != '') { > ! $url = 'dbexport.php?database=' . urlencode($_REQUEST['database']); > ! $url .= '&what=' . urlencode($_REQUEST['what']); > ! $url .= '&table=' . urlencode($_REQUEST['table']); > ! $url .= '&sd_format=' . urlencode($_REQUEST['sd_format']); > ! if (isset($_REQUEST['sd_clean'])) $url .= '&sd_clean=' . > urlencode($_REQUEST['sd_clean']); ! if (isset($_REQUEST['sd_oids'])) > $url .= '&sd_oids=' . urlencode($_REQUEST['sd_oids']); ! if > (isset($_REQUEST['download'])) $url .= '&download=' . > urlencode($_REQUEST['download']); ! > ! header("Location: {$url}"); > ! exit; > ! } > ! else { > ! $format = $_REQUEST['sd_format']; > ! $clean = isset($_REQUEST['sd_clean']); > ! $oids = isset($_REQUEST['sd_oids']); > ! } > break; > } > *************** > *** 52,59 **** > } > > - // Include application functions > - $_no_output = true; > - include_once('./libraries/lib.inc.php'); > - > if (isset($_REQUEST['query'])) $_REQUEST['query'] = > trim(unserialize($_REQUEST['query'])); > > --- 101,104 ---- > *************** > *** 63,67 **** > // If the dump is not dataonly then dump the structure prefix > if ($_REQUEST['what'] != 'dataonly') > ! echo $data->getTableDefPrefix($_REQUEST['table'], isset($clean)); > > // If the dump is not structureonly then dump the actual data > --- 108,112 ---- > // If the dump is not dataonly then dump the structure prefix > if ($_REQUEST['what'] != 'dataonly') > ! echo $data->getTableDefPrefix($_REQUEST['table'], $clean); > > // If the dump is not structureonly then dump the actual data > *************** > *** 75,79 **** > // Execute the query, if set, otherwise grab all rows from the table > if (isset($_REQUEST['table'])) > ! $rs = &$data->dumpRelation($_REQUEST['table'], isset($oids)); > else > $rs = $data->conn->Execute($_REQUEST['query']); > --- 120,124 ---- > // Execute the query, if set, otherwise grab all rows from the table > if (isset($_REQUEST['table'])) > ! $rs = &$data->dumpRelation($_REQUEST['table'], $oids); > else > $rs = $data->conn->Execute($_REQUEST['query']); > *************** > *** 82,86 **** > $data->fieldClean($_REQUEST['table']); > echo "COPY \"{$_REQUEST['table']}\""; > ! if (isset($oids)) echo " WITH OIDS"; > echo " FROM stdin;\n"; > while (!$rs->EOF) { > --- 127,131 ---- > $data->fieldClean($_REQUEST['table']); > echo "COPY \"{$_REQUEST['table']}\""; > ! if ($oids) echo " WITH OIDS"; > echo " FROM stdin;\n"; > while (!$rs->EOF) { > *************** > *** 119,123 **** > foreach ($rs->f as $k => $v) { > $finfo = $rs->fetchField($j++); > ! if ($finfo->name == $data->id && !isset($oids)) continue; > echo "\t\t<th>", $misc->printVal($finfo->name, true), "</th>\r\n"; > } > --- 164,168 ---- > foreach ($rs->f as $k => $v) { > $finfo = $rs->fetchField($j++); > ! if ($finfo->name == $data->id && !$oids) continue; > echo "\t\t<th>", $misc->printVal($finfo->name, true), "</th>\r\n"; > } > *************** > *** 129,133 **** > foreach ($rs->f as $k => $v) { > $finfo = $rs->fetchField($j++); > ! if ($finfo->name == $data->id && !isset($oids)) continue; > echo "\t\t<td>", $misc->printVal($v, true, $finfo->type), > "</td>\r\n"; } > --- 174,178 ---- > foreach ($rs->f as $k => $v) { > $finfo = $rs->fetchField($j++); > ! if ($finfo->name == $data->id && !$oids) continue; > echo "\t\t<td>", $misc->printVal($v, true, $finfo->type), > "</td>\r\n"; } > > Index: dbexport.php > =================================================================== > RCS file: /cvsroot/phppgadmin/webdb/dbexport.php,v > retrieving revision 1.3 > retrieving revision 1.4 > diff -C2 -d -r1.3 -r1.4 > *** dbexport.php 17 Dec 2003 09:11:32 -0000 1.3 > --- dbexport.php 21 Dec 2003 10:44:52 -0000 1.4 > *************** > *** 1,5 **** > <?php > /** > ! * Does an export of a database to the screen or as a download > * > * $Id$ > --- 1,6 ---- > <?php > /** > ! * Does an export of a database to the screen or as a download. > ! * Can also dump a specific table of a database. > * > * $Id$ > *************** > *** 29,33 **** > $port = $conf['servers'][$_SESSION['webdbServerID']]['port']; > $username = escapeshellarg($_SESSION['webdbUsername']); > ! $database = escapeshellarg($_REQUEST['database']); > > // Build command for executing pg_dump > --- 30,34 ---- > $port = $conf['servers'][$_SESSION['webdbServerID']]['port']; > $username = escapeshellarg($_SESSION['webdbUsername']); > ! $database = escapeshellarg($_REQUEST['database']); > > // Build command for executing pg_dump > *************** > *** 39,42 **** > --- 40,48 ---- > $cmd .= " -p " . escapeshellarg($port); > } > + > + // Check for a table specified > + if (isset($_REQUEST['table'])) { > + $cmd .= " -t " . escapeshellarg($_REQUEST['table']); > + } > > switch ($_REQUEST['what']) { > *************** > *** 51,55 **** > break; > case 'structureanddata': > ! if ($_REQUEST['sd_format'] == 'sql') $cmd .= ' -d'; > elseif (isset($_REQUEST['sd_oids'])) $cmd .= ' -o'; > if (isset($_REQUEST['sd_clean'])) $cmd .= ' -c'; > --- 57,61 ---- > break; > case 'structureanddata': > ! if ($_REQUEST['sd_format'] == 'sql') $cmd .= ' -d'; > elseif (isset($_REQUEST['sd_oids'])) $cmd .= ' -o'; > if (isset($_REQUEST['sd_clean'])) $cmd .= ' -c'; > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > phpPgAdmin-cvs mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/phppgadmin-cvs -- Nicola Soranzo http://web.tiscali.it/soranzo Presidente del GOLUG - Gorizia Linux User Group http://golug.cc.uniud.it La mia chiave PGP: http://web.tiscali.it/soranzo/key.asc |