cvs: pearweb /include pear-database.php

From: Date: Sat, 26 Jan 2002 11:48:39 +0000
Subject: cvs: pearweb /include pear-database.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2133@lists.php.net to get a copy of this message
mj Sat Jan 26 06:48:39 2002 EDT Modified files: /pearweb/include pear-database.php Log: * Implement maintainer::get() and user::isAdmin() Index: pearweb/include/pear-database.php diff -u pearweb/include/pear-database.php:1.40 pearweb/include/pear-database.php:1.41 --- pearweb/include/pear-database.php:1.40 Mon Jan 14 19:55:54 2002 +++ pearweb/include/pear-database.php Sat Jan 26 06:48:39 2002 @@ -340,6 +340,31 @@ } // }}} + // {{{ *proto int maintainer::get(int, bool) + + function get($package, $lead = false) + { + global $dbh; + $query = "SELECT handle FROM maintains WHERE package = '" . $package . "'"; + + if ($lead) { + $query .= " AND role = 'lead'"; + } + + $sth = $dbh->query($query); + + if (DB::isError($sth)) { + return sth; + } + + while ($row = $sth->fetchRow()) { + $rows[] = $row[0]; + } + + return $rows; + } + + // }}} } class release @@ -628,6 +653,23 @@ $xhdr = "From: $PHP_AUTH_USER@php.net"; mail($user->email, "Your PEAR Account Request", $msg, $xhdr); return true; + } + + // }}} + // {{{ *proto bool user::isAdmin(string) + + function isAdmin($handle) + { + global $dbh; + + $query = "SELECT handle FROM users WHERE handle = '" . $handle . "' AND admin = 1"; + $sth = $dbh->query($query); + + if ($sth->numRows() > 0) { + return true; + } else { + return false; + } } // }}}

« previous php.pear.cvs (#2133) next »