diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/db.php | 18 | ||||
| -rw-r--r-- | src/fextdata.php | 2 | ||||
| -rw-r--r-- | src/filedownload.php | 2 | ||||
| -rw-r--r-- | src/filewindow.php | 2 |
4 files changed, 12 insertions, 12 deletions
@@ -33,28 +33,28 @@ function DB_lo_open($conn, $file, $mode) { else return pg_lo_open ($conn, $file, $mode); } -function DB_lo_read_tobrowser($contest,$id) { - $str = DB_lo_read($contest,$id); - echo $str; - return true; +function DB_lo_read_tobrowser($contest,$id,$c=null) { + $str = DB_lo_read($contest,$id,-1,$c); + echo $str; + return true; } -function DB_lo_read($contest,$id,$s=-1) { +function DB_lo_read($contest,$id,$s=-1,$c=null) { if (strcmp(phpversion(),'4.2.0')<0) { if($s<0) { $str=''; - while (($buf = pg_loread ($id, 100000)) != false) $str .= $buf; + while (($buf = pg_loread ($id, 1000000)) != false) $str .= $buf; } else $str = pg_loread ($id, $s); } else { if($s<0) { $str=''; - while (($buf = pg_lo_read ($id, 100000)) != false) $str .= $buf; + while (($buf = pg_lo_read ($id, 1000000)) != false) $str .= $buf; } else $str = pg_lo_read ($id, $s); } - if(($str2 = DB_unlock($contest,$str))===false) return $str; + if(($str2 = DB_unlock($contest,$str,$c))===false) return $str; return $str2; } function DB_unlock($contest,$str,$c=null) { @@ -296,7 +296,7 @@ function DBcrc($contest,$id, $c=null) { // just to return a unique string that will not match any other... return "no-HASH-" . rand() . "-" . rand() . "-" . time(); } - $str = DB_lo_read($contest,$f); + $str = DB_lo_read($contest,$f,-1,$c); DB_lo_close($f); if($docommit) DBExec($c, "commit work", "DBcrc(commit)"); diff --git a/src/fextdata.php b/src/fextdata.php index 4a891c5..231489b 100644 --- a/src/fextdata.php +++ b/src/fextdata.php @@ -730,7 +730,7 @@ function generateSiteXML($contest,$site,$updatetime, $mainsite=1) { foreach($atual as $key => $val) { if($meta[$key]['type'] == 'oid' && $val != '') { if (($lo = DB_lo_open ($c, $val, "r")) !== false) { - $str .= " <" . $key . ">" . base64_encode("base64:" . base64_encode(DB_lo_read($contest,$lo))) . "</" . $key . ">\n"; + $str .= " <" . $key . ">" . base64_encode("base64:" . base64_encode(DB_lo_read($contest,$lo,-1,$c))) . "</" . $key . ">\n"; DB_lo_close($lo); } else { LOGError("large object ($key,$val) not readable"); diff --git a/src/filedownload.php b/src/filedownload.php index 92de694..6b56ca9 100644 --- a/src/filedownload.php +++ b/src/filedownload.php @@ -74,7 +74,7 @@ if ($_GET["oid"]>=0) { header ("Content-Disposition: attachment; filename=" . basename($fname)); ob_end_flush(); - if (DB_lo_read_tobrowser ($_SESSION["usertable"]["contestnumber"],$lo) === false) { + if (DB_lo_read_tobrowser ($_SESSION["usertable"]["contestnumber"],$lo,$c) === false) { echo "<html><head><title>Download Page</title>"; DBExec($c, "rollback work"); LOGError ("Unable to download file (" . basename($fname) . ")"); diff --git a/src/filewindow.php b/src/filewindow.php index 594e483..64bd1ec 100644 --- a/src/filewindow.php +++ b/src/filewindow.php @@ -79,7 +79,7 @@ if ($_GET["oid"]>=0) { echo $msg ."\n\n\n"; } // echo "<pre>\n"; - if (DB_lo_read_tobrowser ($_SESSION["usertable"]["contestnumber"],$lo) === false) { + if (DB_lo_read_tobrowser ($_SESSION["usertable"]["contestnumber"],$lo,$c) === false) { header ("Content-type: text/html"); echo "<html><head><title>View Page</title>"; DBExec($c, "rollback work"); |