Update of /cvsroot/basedb/basedb/www In directory usw-pr-cvs1:/tmp/cvs-serv25478 Modified Files: array.inc.php bio.inc.php bioassay.inc.php bioassayset.inc.php eventlog.inc.php experiment.inc.php genelist.inc.php hyb.inc.php image.inc.php item.inc.php job.inc.php left.phtml molecule.inc.php news.inc.php plate.inc.php plot.inc.php program.inc.php protocol.inc.php raw.inc.php sampleannotation.inc.php sampletissue.inc.php search.inc.php session.inc.php transformation.inc.php upload.inc.php user.inc.php ware.inc.php wizzzard.inc.php Log Message: Added backticks around all mixed/upper case column names Index: array.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/array.inc.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** array.inc.php 7 Sep 2002 11:36:31 -0000 1.32 --- array.inc.php 8 Sep 2002 22:38:08 -0000 1.33 *************** *** 78,86 **** if(!query($query) || db_affected_rows() < 1) return false; ! $query = "DELETE FROM ArrayTypePlate WHERE arrayType = $this->id"; query($query); ! $query = "DELETE FROM Element WHERE arrayType = $this->id"; query($query); ! $query = "DELETE FROM ArrayBlock WHERE arrayType = $this->id"; query($query); @unlink($this->getRepositoryFilename()); --- 78,86 ---- [...560 lines suppressed...] $search->getWhere()." ".$search->getExtraWhere()." ". --- 936,953 ---- { // Add more fields here ! $sortfields = array("barcode", array("`batchName`", "`orderNumber`"), ! "`orderNumber`", "`userName`", array("`designName`", "`batchName`", ! "`orderNumber`"), "`printStartDate`", "destroyed", "comment", ! "`hybName`", "`hybUserName`"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT a.*, ab.name AS `batchName`, ab.`arrayType`, ". ! "ab.`printStartDate`, at.name AS `designName`, u.`userName`, ". ! "h.name AS `hybName`, hu.`userName` AS `hybUserName` ". "FROM Array a, ArrayBatch ab, ArrayType at, Submitter u ". $search->getExtraTables()." ". "LEFT JOIN Hybridization h ON h.id = a.hybridization ". "LEFT JOIN Submitter hu ON hu.id = h.owner ". ! "WHERE a.batch = ab.id AND ab.`arrayType` = at.id ". "AND u.id = ab.owner ". $search->getWhere()." ".$search->getExtraWhere()." ". Index: bio.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/bio.inc.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** bio.inc.php 7 Sep 2002 11:59:40 -0000 1.18 --- bio.inc.php 8 Sep 2002 22:38:08 -0000 1.19 *************** *** 115,123 **** $ownerId = (int)$ownerId; // Add more fields and operators here ! $fields = array("s.name", "s.descr", "u.userName", "s.addedDate"); $search->makeWhere($fields); if($visible) ! $search->addExtraWhere("s.isVisible"); $query = "SELECT COUNT(*) FROM Sample s, Submitter u, SharedSample ss ". --- 115,123 ---- [...233 lines suppressed...] $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT le.*, se.owner AS extractPublic, ". ! "ss.owner AS samplePublic, p.name AS protocolName, ". ! "e.name AS extractName, e.sample, s.name AS sampleName ". "FROM LabeledExtract le, Extract e, SharedLabeledExtract sle, ". "Sample s, Protocol p ". --- 699,710 ---- // Add more fields here ! $sortfields = array("name", "label", "`extractName`", "`sampleName`", ! "`labelingDate`", "`protocolName`", "`quantityLeft`", 0); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT le.*, se.owner AS `extractPublic`, ". ! "ss.owner AS `samplePublic`, p.name AS `protocolName`, ". ! "e.name AS `extractName`, e.sample, s.name AS `sampleName` ". "FROM LabeledExtract le, Extract e, SharedLabeledExtract sle, ". "Sample s, Protocol p ". Index: bioassay.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/bioassay.inc.php,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** bioassay.inc.php 7 Sep 2002 11:36:31 -0000 1.30 --- bioassay.inc.php 8 Sep 2002 22:38:08 -0000 1.31 *************** *** 76,80 **** $query = "DELETE FROM $config[dbDynamic].BioAssayData$this->experiment ". ! "WHERE bioAssay = $this->id"; query($query); --- 76,80 ---- $query = "DELETE FROM $config[dbDynamic].BioAssayData$this->experiment ". ! "WHERE `bioAssay` = $this->id"; query($query); [...705 lines suppressed...] ! else $extra .= " 0 AS C"; ! $query = "SELECT $xc AS A, $yc AS B, $extra ". "FROM $config[dbDynamic].BioAssayData$this->experiment bad ". $sea->getExtraTables()." ". ! "WHERE bad.bioAssay = $this->id ".$sea->getExtraWhere()." ". "$groupby"; $res = query($query); --- 1046,1056 ---- } else if($third >= 0) ! $extra .= " $groups[$third] AS `C`"; ! else $extra .= " 0 AS `C`"; ! $query = "SELECT $xc AS `A`, $yc AS `B`, $extra ". "FROM $config[dbDynamic].BioAssayData$this->experiment bad ". $sea->getExtraTables()." ". ! "WHERE bad.`bioAssay` = $this->id ".$sea->getExtraWhere()." ". "$groupby"; $res = query($query); Index: bioassayset.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/bioassayset.inc.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** bioassayset.inc.php 7 Sep 2002 11:36:31 -0000 1.24 --- bioassayset.inc.php 8 Sep 2002 22:38:08 -0000 1.25 *************** *** 65,70 **** function write() { ! if($this->id) return parent::write(array()); ! else return parent::write(array("experiment", "transformation")); } --- 65,72 ---- function write() { ! if($this->id) [...413 lines suppressed...] if($row =& db_fetch_assoc($res)) return $row; --- 652,656 ---- { $query = "SELECT * FROM BioAssaySetExplore ". ! "WHERE `bioAssaySet` = $this->id"; $res = query($query); if($row =& db_fetch_assoc($res)) return $row; *************** *** 696,700 **** { $query = "SELECT * FROM BioAssaySetCreation ". ! "WHERE bioAssaySet = $this->id"; $res = query($query); return db_fetch_assoc($res); --- 706,710 ---- { $query = "SELECT * FROM BioAssaySetCreation ". ! "WHERE `bioAssaySet` = $this->id"; $res = query($query); return db_fetch_assoc($res); Index: eventlog.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/eventlog.inc.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** eventlog.inc.php 7 Sep 2002 11:36:32 -0000 1.4 --- eventlog.inc.php 8 Sep 2002 22:38:08 -0000 1.5 *************** *** 30,44 **** function log($type, $message) { ! $query = "INSERT INTO EventLog (eventDate, eventType, message) ". ! "VALUES (NOW(), '".addslashes($type)."', '".addslashes($message)."')"; return (bool)query($query); } ! // Returns array(array(date,type,message)) function getLast($cnt) { ! $query = "SELECT eventDate AS date, eventType AS type, message ". ! "FROM EventLog WHERE eventType='broadcast' ". ! "ORDER BY eventDate DESC ".db_limit(0, (int)$cnt); $res = query($query); $arr = array(); --- 30,45 ---- function log($type, $message) { ! $query = "INSERT INTO EventLog ". ! "(`eventDate`, `eventType`, message) VALUES ". ! "(NOW(), '".addslashes($type)."', '".addslashes($message)."')"; return (bool)query($query); } ! // Returns array(array(eventDate,eventType,message)) function getLast($cnt) { ! $query = "SELECT `eventDate`, `eventType`, message ". ! "FROM EventLog WHERE `eventType` = 'broadcast' ". ! "ORDER BY `eventDate` DESC ".db_limit(0, (int)$cnt); $res = query($query); $arr = array(); Index: experiment.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/experiment.inc.php,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** experiment.inc.php 7 Sep 2002 11:36:32 -0000 1.43 --- experiment.inc.php 8 Sep 2002 22:38:08 -0000 1.44 *************** *** 111,115 **** $query = "DELETE FROM Experiment WHERE id = $id"; ! if(!query($query)) return false; db_table_drop("$config[dbDynamic].BioAssayData$id"); --- 111,116 ---- $query = "DELETE FROM Experiment WHERE id = $id"; ! if(!query($query)) ! return false; [...209 lines suppressed...] --- 399,403 ---- $rc = false; $query = "DELETE FROM ExperimentRawBioAssay ". ! "WHERE experiment = $expid AND `rawBioAssay` = $rawid"; if(query($query) && db_affected_rows() == 1) { *************** *** 405,409 **** "WHERE experiment = $this->id"; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0]; else return false; } --- 415,420 ---- "WHERE experiment = $this->id"; $res = query($query); ! if($row =& db_fetch_row($res)) ! return $row[0]; else return false; } Index: genelist.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/genelist.inc.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** genelist.inc.php 8 Sep 2002 14:02:42 -0000 1.18 --- genelist.inc.php 8 Sep 2002 22:38:08 -0000 1.19 *************** *** 55,59 **** if(query($query)) { ! $query = "DELETE FROM GeneListGene WHERE geneList = $this->id"; query($query); } --- 55,59 ---- if(query($query)) { ! $query = "DELETE FROM GeneListGene WHERE `geneList` = $this->id"; query($query); [...152 lines suppressed...] $query = "SELECT glg.molecule, glg.score ". "FROM GeneListGene glg ". ! "WHERE glg.geneList = $this->id ". "ORDER BY score"; $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) $arr[$row[0]] = $row[1]; return $arr; } --- 323,332 ---- $query = "SELECT glg.molecule, glg.score ". "FROM GeneListGene glg ". ! "WHERE glg.`geneList` = $this->id ". "ORDER BY score"; $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) ! $arr[$row[0]] = $row[1]; return $arr; } Index: hyb.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/hyb.inc.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** hyb.inc.php 7 Sep 2002 11:36:32 -0000 1.17 --- hyb.inc.php 8 Sep 2002 22:38:08 -0000 1.18 *************** *** 118,123 **** // Add more fields and operators here ! $fields = array("h.name", "h.descr", "u.userName", ! "h.addedDate", "h.hybridizationDate", "p.name"); $search->addExtraWhere("sh.owner IN (0, $ownerId)"); --- 118,123 ---- // Add more fields and operators here ! $fields = array("h.name", "h.descr", "u.`userName`", [...122 lines suppressed...] } *************** *** 261,267 **** { $query = "SELECT COUNT(*) FROM ImageAcquisition ia, RawBioAssay r ". ! "WHERE ia.hybridization = $this->id AND r.imageAcquisition = ia.id"; $res = query($query); ! if($row =& db_fetch_row($res)) return($row[0]); return 0; } --- 269,277 ---- { $query = "SELECT COUNT(*) FROM ImageAcquisition ia, RawBioAssay r ". ! "WHERE ia.hybridization = $this->id ". ! "AND r.`imageAcquisition` = ia.id"; $res = query($query); ! if($row =& db_fetch_row($res)) ! return($row[0]); return 0; } Index: image.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/image.inc.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** image.inc.php 7 Sep 2002 11:36:32 -0000 1.9 --- image.inc.php 8 Sep 2002 22:38:08 -0000 1.10 *************** *** 51,60 **** $id = (int)$id; $owner = (int)$owner; ! if($owner < 0) $query = "SELECT * FROM $this->type WHERE id = $id"; else { $query = "SELECT i.* FROM Image i, ImageAcquisition ia, ". "SharedHybridization sh ". ! "WHERE ia.id = i.imageAcquisition AND sh.item = ia.hybridization ". "AND sh.owner IN (0, $owner) AND i.id = $id"; } --- 51,62 ---- $id = (int)$id; $owner = (int)$owner; ! if($owner < 0) ! $query = "SELECT * FROM $this->type WHERE id = $id"; else { $query = "SELECT i.* FROM Image i, ImageAcquisition ia, ". "SharedHybridization sh ". ! "WHERE ia.id = i.`imageAcquisition` ". ! "AND sh.item = ia.hybridization ". "AND sh.owner IN (0, $owner) AND i.id = $id"; } *************** *** 64,68 **** function write() { ! return parent::write(array("imageAcquisition", "channels", "fileSize")); } --- 66,71 ---- function write() { ! return parent::write(array("`imageAcquisition`", "channels", ! "`fileSize`")); } *************** *** 127,131 **** $fields = array(); ! $search->addExtraWhere("im.imageAcquisition = ".(int)$acq); $search->makeWhere($fields); --- 130,134 ---- $fields = array(); ! $search->addExtraWhere("im.`imageAcquisition` = ".(int)$acq); $search->makeWhere($fields); *************** *** 144,148 **** { // Add more fields here ! $sortfields = array("name", "channels", "fileSize", "descr"); $ob = $search->makeOrderBy($sortfields); --- 147,151 ---- { // Add more fields here ! $sortfields = array("name", "channels", "`fileSize`", "descr"); $ob = $search->makeOrderBy($sortfields); *************** *** 153,158 **** "$ob ".$search->makeLimit(); $arr = array(); ! if(!($res = query($query))) return $arr; ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } --- 156,163 ---- "$ob ".$search->makeLimit(); $arr = array(); ! if(!($res = query($query))) ! return $arr; ! while($row =& db_fetch_assoc($res)) ! $arr[] = $row; return $arr; } Index: item.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/item.inc.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** item.inc.php 7 Sep 2002 11:36:32 -0000 1.23 --- item.inc.php 8 Sep 2002 22:38:08 -0000 1.24 *************** *** 70,74 **** } if($visible) ! $query .= " AND i.isVisible"; return $this->readQuery($query); } --- 70,74 ---- } if($visible) ! $query .= " AND i.`isVisible`"; return $this->readQuery($query); [...201 lines suppressed...] ! "WHERE id = $id AND `useCount` = -1"; return query($query) && db_affected_rows() == 1; } ! $query = "UPDATE $type SET `useCount` = `useCount` - 1 ". ! "WHERE id = $id AND `useCount` > 0"; return query($query) && db_affected_rows() == 1; } *************** *** 446,450 **** function getUseCount() { ! $query = "SELECT useCount FROM $this->type WHERE id = $this->id"; $res = query($query); if($row =& db_fetch_row($res)) --- 452,456 ---- function getUseCount() { ! $query = "SELECT `useCount` FROM $this->type WHERE id = $this->id"; $res = query($query); if($row =& db_fetch_row($res)) Index: job.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/job.inc.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** job.inc.php 7 Sep 2002 11:36:32 -0000 1.33 --- job.inc.php 8 Sep 2002 22:38:08 -0000 1.34 *************** *** 91,95 **** $vals = array(); for($i = 0; $i < count($vars); $i++) ! $vals[] = "'".addslashes($this->{$vars[$i]})."'"; $id = db_insert("Job", $vars, $vals); if(!$id) --- 91,95 ---- $vals = array(); for($i = 0; $i < count($vars); $i++) ! $vals[] =& $this->{$vars[$i]}; $id = db_insert("Job", $vars, $vals); [...144 lines suppressed...] // worst thing that can happen isn't all that horrible. $query = "INSERT INTO JobFileSection ". ! "(`jobFile`, `fileSection`, `sectionCount`) ". "VALUES ($this->id, $section, $count)"; return (bool)query($query); *************** *** 651,656 **** function sectionCount($section) { ! $query = "SELECT sectionCount FROM JobFileSection ". ! "WHERE jobFile = $this->id AND fileSection = ".(int)$section; $res = query($query); if($row =& db_fetch_row($res)) --- 652,657 ---- function sectionCount($section) { ! $query = "SELECT `sectionCount` FROM JobFileSection ". ! "WHERE `jobFile` = $this->id AND `fileSection` = ".(int)$section; $res = query($query); if($row =& db_fetch_row($res)) Index: left.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/left.phtml,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** left.phtml 7 Sep 2002 11:36:32 -0000 1.44 --- left.phtml 8 Sep 2002 22:38:08 -0000 1.45 *************** *** 376,383 **** for($i = count($events) - 1; $i >= 0; $i--) { ! $txt = sprintf($et[$events[$i]["type"]], html($events[$i]["message"])); ! $date = (int)substr($events[$i]["date"], 8, 2).". ". ! substr($events[$i]["date"], 11, 5); echo "$date $txt<br>\n"; } --- 376,383 ---- for($i = count($events) - 1; $i >= 0; $i--) { ! $txt = sprintf($et[$events[$i]["eventType"]], html($events[$i]["message"])); ! $date = (int)substr($events[$i]["eventDate"], 8, 2).". ". ! substr($events[$i]["eventDate"], 11, 5); echo "$date $txt<br>\n"; } Index: molecule.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/molecule.inc.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** molecule.inc.php 8 Sep 2002 14:46:57 -0000 1.27 --- molecule.inc.php 8 Sep 2002 22:38:08 -0000 1.28 *************** *** 125,129 **** $vals = array(); for($i = 0; $i < count($vars); $i++) ! $vals[] = "'".addslashes($this->{$vars[$i]})."'"; $vals[] = chr(strlen($this->cloneId)).$this->cloneId; $id = db_insert("Molecule", $vars, $vals); --- 125,129 ---- $vals = array(); for($i = 0; $i < count($vars); $i++) ! $vals[] =& $this->{$vars[$i]}; $vals[] = chr(strlen($this->cloneId)).$this->cloneId; [...101 lines suppressed...] ! "tissueName", "vectorName", "libraryName", "lastUpdate"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT m.*, v.name AS vectorName, t.name AS tissueName, ". ! "l.name AS libraryName ". "FROM Molecule m ".$search->getExtraTables()." ". "WHERE 1 ".$search->getWhere()." ".$search->getExtraWhere(). --- 643,654 ---- "l.id = m.library")); ! $sortfields = array("`cloneId`", array("species", "`clusterId`"), ! "`geneSymbol`", "`geneName`", "chromosome", "`cytoBand`", ! "markers", "`locusLink`", "omim", "accession", "nid", "antibiotics", ! "`tissueName`", "`vectorName`", "`libraryName`", "`lastUpdate`"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT m.*, v.name AS `vectorName`, t.name AS `tissueName`, ". ! "l.name AS `libraryName` ". "FROM Molecule m ".$search->getExtraTables()." ". "WHERE 1 ".$search->getWhere()." ".$search->getExtraWhere(). Index: news.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/news.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** news.inc.php 7 Sep 2002 11:36:32 -0000 1.5 --- news.inc.php 8 Sep 2002 22:38:08 -0000 1.6 *************** *** 44,48 **** function getLatest($count, $from = 0) { ! $query = "SELECT * FROM News ORDER BY addedDate DESC ". db_limit((int)$from, (int)$count); $res = query($query); --- 44,48 ---- function getLatest($count, $from = 0) { ! $query = "SELECT * FROM News ORDER BY `addedDate` DESC ". db_limit((int)$from, (int)$count); $res = query($query); *************** *** 82,86 **** $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT n.*, u.userName ". "FROM News n, Submitter u WHERE n.owner = u.id ". $search->getWhere()." $ob ".$search->makeLimit(); --- 82,86 ---- $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT n.*, u.`userName` ". "FROM News n, Submitter u WHERE n.owner = u.id ". $search->getWhere()." $ob ".$search->makeLimit(); Index: plate.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/plate.inc.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** plate.inc.php 7 Sep 2002 11:36:32 -0000 1.28 --- plate.inc.php 8 Sep 2002 22:38:08 -0000 1.29 *************** *** 59,63 **** { $query = "SELECT pt.* FROM PlateType pt, Plate p ". ! "WHERE p.id = ".(int)$plate." AND pt.id = p.plateType"; return $this->readQuery($query); } --- 59,63 ---- { $query = "SELECT pt.* FROM PlateType pt, Plate p ". ! "WHERE p.id = ".(int)$plate." AND pt.id = p.`plateType`"; return $this->readQuery($query); [...638 lines suppressed...] $arr[1][$row[0]] = $row[1]; ! $query = "SELECT `bacterialGrowth`, COUNT(*) ". ! "FROM Well WHERE `bacterialGrowth` <> '' AND probe = $probe ". ! "GROUP BY `bacterialGrowth`"; $res = query($query); while($row =& db_fetch_row($res)) *************** *** 962,966 **** { $probe = (int)$probe; ! $query = "SELECT w.*, p.plateType, p.name ". "FROM Well w, Plate p WHERE p.id = w.plate AND w.probe = $probe"; $res = query($query); --- 964,968 ---- { $probe = (int)$probe; ! $query = "SELECT w.*, p.`plateType`, p.name ". "FROM Well w, Plate p WHERE p.id = w.plate AND w.probe = $probe"; $res = query($query); Index: plot.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/plot.inc.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** plot.inc.php 7 Sep 2002 11:36:32 -0000 1.19 --- plot.inc.php 8 Sep 2002 22:38:08 -0000 1.20 *************** *** 112,121 **** } else $mn = "Median"; ! if($this->item == 0) $s = "$table.FCh1$mn-$table.BCh1$mn"; ! else if($this->item == 1) $s = "$table.FCh2$mn-$table.BCh2$mn"; ! else if($this->item == 2) $s = "($table.FCh1$mn-$table.BCh1$mn)/". ! "($table.FCh2$mn-$table.BCh2$mn)"; ! else $s = "($table.FCh1$mn-$table.BCh1$mn)*". ! "($table.FCh2$mn-$table.BCh2$mn)"; if($log) $s = "LOG($s)/LOG($log)"; if($this->item == 3) --- 112,121 ---- } else $mn = "Median"; ! if($this->item == 0) $s = "$table.`FCh1$mn`-$table.`BCh1$mn`"; ! else if($this->item == 1) $s = "$table.`FCh2$mn`-$table.`BCh2$mn`"; ! else if($this->item == 2) $s = "($table.`FCh1$mn`-$table.`BCh1$mn`)/". ! "($table.`FCh2$mn`-$table.`BCh2$mn`)"; ! else $s = "($table.`FCh1$mn`-$table.`BCh1$mn`)*". ! "($table.`FCh2$mn`-$table.`BCh2$mn`)"; if($log) $s = "LOG($s)/LOG($log)"; if($this->item == 3) *************** *** 444,449 **** "), AVG(".$a2->getExpression("t1", $ylog). ") FROM $table1 ". ! "WHERE t1.".($a1->type == "v" ? "bioAssay" : "rawBioAssay"). ! " = $a1->id"; } else --- 444,449 ---- "), AVG(".$a2->getExpression("t1", $ylog). ") FROM $table1 ". ! "WHERE t1.`".($a1->type == "v" ? "bioAssay" : "rawBioAssay"). ! "` = $a1->id"; } else *************** *** 451,456 **** $query = "SELECT ".$a1->getExpression("t1", $xlog).", ". $a2->getExpression("t1", $ylog)." FROM $table1 ". ! "WHERE t1.".($a1->type == "v" ? "bioAssay" : "rawBioAssay"). ! " = $a1->id"; } if($excluded && $a1->type == "v") --- 451,456 ---- $query = "SELECT ".$a1->getExpression("t1", $xlog).", ". $a2->getExpression("t1", $ylog)." FROM $table1 ". ! "WHERE t1.`".($a1->type == "v" ? "bioAssay" : "rawBioAssay"). ! "` = $a1->id"; } if($excluded && $a1->type == "v") *************** *** 488,494 **** "WHERE t1.position = t2.position"; } ! $query .= " AND t1.".($a1->type == "v" ? "bioAssay" : "rawBioAssay"). ! " = $a1->id AND t2.". ! ($a2->type == "v" ? "bioAssay" : "rawBioAssay")." = $a2->id"; if($excluded) { --- 488,494 ---- "WHERE t1.position = t2.position"; } ! $query .= " AND t1.`".($a1->type == "v" ? "bioAssay" : "rawBioAssay"). ! "` = $a1->id AND t2.`". ! ($a2->type == "v" ? "bioAssay" : "rawBioAssay")."` = $a2->id"; if($excluded) { Index: program.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/program.inc.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** program.inc.php 7 Sep 2002 11:36:32 -0000 1.19 --- program.inc.php 8 Sep 2002 22:38:08 -0000 1.20 *************** *** 167,174 **** { $query = "SELECT id, name FROM Program ". ! "WHERE onServer ORDER BY name"; $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) $arr[$row[0]] = $row[1]; return $arr; } --- 167,175 ---- { $query = "SELECT id, name FROM Program ". ! "WHERE `onServer` ORDER BY name"; $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) ! $arr[$row[0]] = $row[1]; return $arr; } *************** *** 207,212 **** { $query = "REPLACE INTO ProgramParameter ". ! "(program, position, name, commonName, valueType, options, ". ! "defaultValue, enumOptions) VALUES ". "($this->id, ".(int)$pos.", ". "'".addslashes($name)."', ". --- 208,213 ---- { $query = "REPLACE INTO ProgramParameter ". ! "(program, position, name, `commonName`, `valueType`, options, ". ! "`defaultValue`, `enumOptions`) VALUES ". "($this->id, ".(int)$pos.", ". "'".addslashes($name)."', ". *************** *** 271,280 **** { // Add more fields here ! $sortfields = array("name", "execName", array("addedDate", "p.id"), ! "userName", "onServer", "geneAverages", "serialFormat", "url"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT p.*, u.userName ". "FROM Program p, Submitter u ". "WHERE u.id = p.owner ".$search->getWhere()." ". --- 272,282 ---- { // Add more fields here ! $sortfields = array("name", "`execName`", array("`addedDate`", "p.id"), ! "`userName`", "`onServer`", "`geneAverages`", "`serialFormat`", ! "url"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT p.*, u.`userName` ". "FROM Program p, Submitter u ". "WHERE u.id = p.owner ".$search->getWhere()." ". Index: protocol.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/protocol.inc.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** protocol.inc.php 7 Sep 2002 11:36:32 -0000 1.7 --- protocol.inc.php 8 Sep 2002 22:38:08 -0000 1.8 *************** *** 82,86 **** "descr = '".addslashes($this->descr)."', ". "submitter = ".$this->submitter.", ". ! "fileId = ".$this->fileId." ". "WHERE id = $this->id"; return query($query); --- 82,86 ---- "descr = '".addslashes($this->descr)."', ". "submitter = ".$this->submitter.", ". ! "`fileId` = ".$this->fileId." ". "WHERE id = $this->id"; return query($query); *************** *** 182,187 **** { $type = (int)$type; ! $query = "SELECT p.*, u.name AS fname, u.fileSize, ". ! "u.addedDate AS fdate, s.userName AS sname ". "FROM Protocol p, Submitter s ". "LEFT JOIN Upload u ON u.id = p.fileid ". --- 182,187 ---- { $type = (int)$type; ! $query = "SELECT p.*, u.name AS fname, u.`fileSize`, ". ! "u.`addedDate` AS fdate, s.`userName` AS sname ". "FROM Protocol p, Submitter s ". "LEFT JOIN Upload u ON u.id = p.fileid ". *************** *** 203,207 **** $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) $arr[$row[0]] = $row[1]; return $arr; } --- 203,208 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) ! $arr[$row[0]] = $row[1]; return $arr; } Index: raw.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/raw.inc.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** raw.inc.php 7 Sep 2002 11:36:32 -0000 1.31 --- raw.inc.php 8 Sep 2002 22:38:08 -0000 1.32 *************** *** 87,99 **** query($query); $query = "DELETE FROM RawBioAssayData ". ! "WHERE rawBioAssay = $this->id"; query($query); $query = "DELETE FROM RawBioAssayHeader ". ! "WHERE rawBioAssay = $this->id"; query($query); // This is silly and will be deleted. $query = "DELETE FROM ExperimentRawBioAssay ". [...629 lines suppressed...] $res2 = query($query); ! if($row2 =& db_fetch_row($res2)) $row[3] = $row2[0]; ! else $row[3] = false; } $arr[] = $row; --- 754,767 ---- else if($grouping == 2) { ! $query = "SELECT h.`hybridizationDate` FROM RawBioAssay r, ". "ImageAcquisition ia, Hybridization h ". ! "WHERE r.id = $row[3] AND ia.id = r.`imageAcquisition` ". "AND h.id = ia.hybridization"; } $res2 = query($query); ! if($row2 =& db_fetch_row($res2)) ! $row[3] = $row2[0]; ! else ! $row[3] = false; } $arr[] = $row; Index: sampleannotation.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/sampleannotation.inc.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sampleannotation.inc.php 7 Sep 2002 11:36:32 -0000 1.15 --- sampleannotation.inc.php 8 Sep 2002 22:38:08 -0000 1.16 *************** *** 65,69 **** $vals = array(); for($i = 0; $i < count($vars); $i++) ! $vals[] = "'".addslashes($this->{$vars[$i]})."'"; $id = db_insert("SampleAnnotationType", $vars, $vals); if(!$id) --- 65,69 ---- $vals = array(); for($i = 0; $i < count($vars); $i++) ! $vals[] =& $this->{$vars[$i]}; $id = db_insert("SampleAnnotationType", $vars, $vals); [...108 lines suppressed...] function getBrieferForSample($sample) { ! $query = "SELECT sa.`annotationType`, sa.annotation ". "FROM SampleAnnotation sa ". ! "WHERE sa.sample = ".(int)$sample." ORDER BY sa.`annotationType`"; $arr = array(); $res = query($query); *************** *** 289,293 **** $annotationType = (int)$annotationType; $query = "DELETE FROM SampleAnnotation ". ! "WHERE sample = $sample AND annotationType = $annotationType"; query($query); } --- 293,297 ---- $annotationType = (int)$annotationType; $query = "DELETE FROM SampleAnnotation ". ! "WHERE sample = $sample AND `annotationType` = $annotationType"; query($query); } Index: sampletissue.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/sampletissue.inc.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sampletissue.inc.php 7 Sep 2002 11:36:32 -0000 1.7 --- sampletissue.inc.php 8 Sep 2002 22:38:08 -0000 1.8 *************** *** 80,84 **** query($query); if(db_affected_rows() <= 0) return false; ! $query = "UPDATE Sample SET tissue = $this->parent WHERE tissue = $this->id"; query($query); return true; --- 80,85 ---- query($query); if(db_affected_rows() <= 0) return false; ! $query = "UPDATE Sample SET tissue = $this->parent ". ! "WHERE tissue = $this->id"; query($query); return true; Index: search.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/search.inc.php,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** search.inc.php 8 Sep 2002 13:18:04 -0000 1.35 --- search.inc.php 8 Sep 2002 22:38:08 -0000 1.36 *************** *** 140,144 **** $search = (int)$search; $query = "SELECT * FROM Preset ". ! "WHERE search = $search AND searchType = $searchType ". "AND owner = ".(int)$owner; return $this->readQuery($query); --- 140,144 ---- $search = (int)$search; $query = "SELECT * FROM Preset ". ! "WHERE search = $search AND `searchType` = $searchType ". "AND owner = ".(int)$owner; [...179 lines suppressed...] $this->search = (int)$search; $this->position = (int)$position; ! $query = "SELECT * FROM SearchCriterion ". ! "WHERE search = $this->search ". "AND position = $this->position"; $res = query($query); *************** *** 887,891 **** { $search = (int)$search; ! $query = "SELECT * FROM SearchCriterion WHERE search = $search ORDER BY position"; $res = query($query); $arr = array(); --- 898,903 ---- { $search = (int)$search; ! $query = "SELECT * FROM SearchCriterion ". ! "WHERE search = $search ORDER BY position"; $res = query($query); $arr = array(); Index: session.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/session.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** session.inc.php 8 Sep 2002 14:46:58 -0000 1.5 --- session.inc.php 8 Sep 2002 22:38:08 -0000 1.6 *************** *** 44,49 **** if($cookie != "") $this->cookie = $cookie; ! $query = "SELECT * FROM Cookie WHERE cookie = '".addslashes($this->cookie)."' "; ! if($ip != "") $query .= "AND IP = '".addslashes($ip)."'"; $res = query($query); if($row =& db_fetch_assoc($res)) --- 44,51 ---- if($cookie != "") $this->cookie = $cookie; ! $query = "SELECT * FROM Cookie ". [...91 lines suppressed...] function justLoggedIn() { ! $query = "SELECT u.userName FROM Cookie c, Submitter u ". ! "WHERE c.owner = u.id AND c.loginDate > NOW() - ".db_interval(200); $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) $arr[] = $row[0]; return $arr; } --- 215,224 ---- function justLoggedIn() { ! $query = "SELECT u.`userName` FROM Cookie c, Submitter u ". ! "WHERE c.owner = u.id AND c.`loginDate` > NOW() - ".db_interval(200); $res = query($query); $arr = array(); ! while($row =& db_fetch_row($res)) ! $arr[] = $row[0]; return $arr; } Index: transformation.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/transformation.inc.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** transformation.inc.php 7 Sep 2002 12:04:26 -0000 1.14 --- transformation.inc.php 8 Sep 2002 22:38:08 -0000 1.15 *************** *** 139,144 **** $query = "SELECT tr.* ". "FROM Transformation tr, BioAssaySet bas ". ! "WHERE bas.experiment = $expid AND tr.bioAssaySet = bas.id ". ! "ORDER BY addedDate, id"; $res = query($query); $arr = array(); --- 139,144 ---- $query = "SELECT tr.* ". "FROM Transformation tr, BioAssaySet bas ". ! "WHERE bas.experiment = $expid AND tr.`bioAssaySet` = bas.id ". [...118 lines suppressed...] "AND bas.experiment = $expid"; $res = query($query); ! if($row =& db_fetch_row($res)) ! return true; return false; } *************** *** 226,230 **** "WHERE p.id = j.program AND j.transformation = ".(int)$id; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0]; return ""; } --- 232,237 ---- "WHERE p.id = j.program AND j.transformation = ".(int)$id; $res = query($query); ! if($row =& db_fetch_row($res)) ! return $row[0]; return ""; } Index: upload.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/upload.inc.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** upload.inc.php 7 Sep 2002 11:36:32 -0000 1.19 --- upload.inc.php 8 Sep 2002 22:38:08 -0000 1.20 *************** *** 138,142 **** $owner = (int)$owner; $query = "SELECT * FROM Upload WHERE owner = $owner ". ! "AND !hidden ORDER BY addedDate"; $res = query($query); $arr = array(); --- 138,142 ---- $owner = (int)$owner; $query = "SELECT * FROM Upload WHERE owner = $owner ". ! "AND hidden = 0 ORDER BY `addedDate`"; $res = query($query); [...116 lines suppressed...] { // Add more fields here ! $sortfields = array("name", "`fileSize`", "`addedDate`", ! "descr", "`userName`"); if($search->getSortField() == 4) { *************** *** 313,317 **** $query = "SELECT up.* ". "FROM Upload up". $search->getExtraTables()." ". ! "WHERE !up.hidden ".$search->getExtraWhere()." ".$search->getWhere(). " $ob ".$search->makeLimit(); --- 315,320 ---- $query = "SELECT up.* ". "FROM Upload up". $search->getExtraTables()." ". ! "WHERE up.hidden = 0 ".$search->getExtraWhere()." ". ! $search->getWhere(). " $ob ".$search->makeLimit(); Index: user.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/user.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** user.inc.php 7 Sep 2002 11:36:32 -0000 1.5 --- user.inc.php 8 Sep 2002 22:38:08 -0000 1.6 *************** *** 94,100 **** if($pass != "") $this->setPassword($pass); $query = "SELECT * FROM Submitter ". ! "WHERE userName = '".addslashes($this->userName)."' ". ! "AND md5Pass = '".addslashes($this->md5Pass)."' ". ! "AND activeUntil >= NOW()"; return $this->readQuery($query); } --- 94,100 ---- if($pass != "") $this->setPassword($pass); $query = "SELECT * FROM Submitter ". [...183 lines suppressed...] $ob = $search->makeOrderBy($sortfields); $query = "SELECT u.*, ". ! "TO_DAYS(activeUntil) - TO_DAYS(NOW()) AS daysLeft, ". ! "(u.accessMask & (".BUA_SUPERUSER.")) AS superUser ". "FROM Submitter u WHERE 1 ".$search->getWhere(). " $ob ".$search->makeLimit(); --- 373,384 ---- { // Add more fields here ! $sortfields = array("`userName`", "name", "phone", "email", ! "`activeUntil`", "`superUser`", "`accessMask`"); $ob = $search->makeOrderBy($sortfields); $query = "SELECT u.*, ". ! "TO_DAYS(`activeUntil`) - TO_DAYS(NOW()) AS `daysLeft`, ". ! "(u.`accessMask` & (".BUA_SUPERUSER.")) AS `superUser` ". "FROM Submitter u WHERE 1 ".$search->getWhere(). " $ob ".$search->makeLimit(); Index: ware.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/ware.inc.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ware.inc.php 7 Sep 2002 11:36:32 -0000 1.8 --- ware.inc.php 8 Sep 2002 22:38:08 -0000 1.9 *************** *** 105,113 **** // Add more fields here $sortfields = array("shown", array("name", "version"), ! array("version", "name"), "addedDate", "userName"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT w.*, u.userName ". "FROM $type w, Submitter u ". "WHERE u.id = w.owner ". --- 105,113 ---- // Add more fields here $sortfields = array("shown", array("name", "version"), ! array("version", "name"), "`addedDate`", "`userName`"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT w.*, u.`userName` ". "FROM $type w, Submitter u ". "WHERE u.id = w.owner ". *************** *** 115,120 **** "$ob ".$search->makeLimit(); $arr = array(); ! if(!($res = query($query))) return $arr; ! while($row =& db_fetch_assoc($res)) $arr[] = $row; return $arr; } --- 115,122 ---- "$ob ".$search->makeLimit(); $arr = array(); ! if(!($res = query($query))) ! return $arr; ! while($row =& db_fetch_assoc($res)) ! $arr[] = $row; return $arr; } *************** *** 169,173 **** $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) $arr[$row["id"]] = $row; return $arr; } --- 171,176 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) ! $arr[$row["id"]] = $row; return $arr; } *************** *** 236,240 **** $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) $arr[$row["id"]] = $row; return $arr; } --- 239,244 ---- $res = query($query); $arr = array(); ! while($row =& db_fetch_assoc($res)) ! $arr[$row["id"]] = $row; return $arr; } Index: wizzzard.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/wizzzard.inc.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** wizzzard.inc.php 7 Sep 2002 11:36:32 -0000 1.24 --- wizzzard.inc.php 8 Sep 2002 22:38:08 -0000 1.25 *************** *** 63,67 **** { $vars = array("id", "owner", "etype", "name", "numCols", ! "extraCols", "dataHeader", "typeHeader", "typeHeaderLine", "mapping"); for($i = 0; $i < count($vars); $i++) $this->$vars[$i] = $row[$vars[$i]]; --- 63,68 ---- { $vars = array("id", "owner", "etype", "name", "numCols", ! "extraCols", "dataHeader", "typeHeader", "typeHeaderLine", ! "mapping"); for($i = 0; $i < count($vars); $i++) $this->$vars[$i] = $row[$vars[$i]]; *************** *** 83,87 **** $vals = array(); for($i = 0; $i < count($vars); $i++) ! $vals[] = "'".addslashes($this->{$vars[$i]})."'"; $id = db_insert("Wizzzard", $vars, $vals); if(!$id) --- 84,88 ---- $vals = array(); for($i = 0; $i < count($vars); $i++) ! $vals[] =& $this->{$vars[$i]}; $id = db_insert("Wizzzard", $vars, $vals); if(!$id) *************** *** 93,97 **** { for($i = 0; $i < count($vars); $i++) ! $vars[$i] = "$vars[$i] = '".addslashes($this->{$vars[$i]})."'"; $query = "UPDATE Wizzzard SET ".implode(", ", $vars)." ". "WHERE id = $this->id"; --- 94,98 ---- { for($i = 0; $i < count($vars); $i++) ! $vars[$i] = "`$vars[$i]` = '".addslashes($this->{$vars[$i]})."'"; $query = "UPDATE Wizzzard SET ".implode(", ", $vars)." ". "WHERE id = $this->id"; *************** *** 671,679 **** $ownerId = (int)$ownerId; // Add more fields here ! $sortfields = array("name", "userName", "extraCols", "useWiz"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT w.*, u.userName, (wu.owner IS NOT NULL) AS useWiz ". "FROM Wizzzard w, Submitter u ". "LEFT JOIN WizzzardUser wu ON wu.wizzzard = w.id ". --- 672,681 ---- $ownerId = (int)$ownerId; // Add more fields here ! $sortfields = array("name", "`userName`", "`extraCols`", "`useWiz`"); $ob = $search->makeOrderBy($sortfields); ! $query = "SELECT w.*, u.`userName`, ". ! "(wu.owner IS NOT NULL) AS `useWiz` ". "FROM Wizzzard w, Submitter u ". "LEFT JOIN WizzzardUser wu ON wu.wizzzard = w.id ". *************** *** 713,717 **** $query = "SELECT owner FROM Wizzzard WHERE id = ".(int)$id; $res = query($query); ! if($row =& db_fetch_row($res)) return $row[0] == (int)$owner; return false; } --- 715,720 ---- $query = "SELECT owner FROM Wizzzard WHERE id = ".(int)$id; $res = query($query); ! if($row =& db_fetch_row($res)) ! return $row[0] == (int)$owner; return false; } |