2007-10-26 21:14:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("../inc/db_conn.inc");
|
|
|
|
|
|
|
|
class BoincDb extends DbConn {
|
2007-10-29 04:02:41 +00:00
|
|
|
static $instance;
|
2007-10-26 21:14:35 +00:00
|
|
|
|
|
|
|
static function get() {
|
|
|
|
if (!isset($instance)) {
|
|
|
|
$instance = new DbConn();
|
|
|
|
$retval = $instance->init_conn(
|
|
|
|
"<db_user>", "<db_passwd>", "<db_host>", "<db_name>"
|
|
|
|
);
|
|
|
|
if (!$retval) return null;
|
|
|
|
}
|
|
|
|
return $instance;
|
|
|
|
}
|
2007-10-27 20:38:12 +00:00
|
|
|
static function escape_string($string) {
|
|
|
|
$db = self::get();
|
|
|
|
return $db->base_escape_string($string);
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincUser {
|
|
|
|
static function lookup_auth($auth) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('user', 'BoincUser', "authenticator='$auth'");
|
|
|
|
}
|
|
|
|
|
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'user', 'BoincUser');
|
|
|
|
}
|
|
|
|
|
|
|
|
static function count($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->count('user', $clause);
|
|
|
|
}
|
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'user', $clause);
|
|
|
|
}
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('user', 'BoincUser', $clause);
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->insert('user', $clause);
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincTeam {
|
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'team', 'BoincTeam');
|
|
|
|
}
|
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'team', $clause);
|
|
|
|
}
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('team', 'BoincTeam', $clause);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class BoincTeamDelta {
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('team_delta', 'BoincTeamDelta', $clause);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-27 20:38:12 +00:00
|
|
|
class BoincHost {
|
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'host', 'BoincHost');
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'host', $clause);
|
|
|
|
}
|
2007-10-27 20:38:12 +00:00
|
|
|
function delete() {
|
|
|
|
return $db->delete($this, 'host');
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
static function enum($clause, $clause2=null) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('host', 'BoincHost', $clause, $clause2);
|
|
|
|
}
|
2007-10-27 20:38:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincResult {
|
|
|
|
static function count($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->count('result', $clause);
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('result', 'BoincResult', $clause);
|
|
|
|
}
|
2007-10-29 04:02:41 +00:00
|
|
|
static function update_aux($clause) {
|
2007-10-28 15:03:14 +00:00
|
|
|
$db = BoincDb::get();
|
2007-10-29 04:02:41 +00:00
|
|
|
return $db->update_aux('result', $clause);
|
2007-10-28 15:03:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class BoincPost {
|
|
|
|
static function count($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->count('post', $clause);
|
|
|
|
}
|
2007-10-27 20:38:12 +00:00
|
|
|
}
|
|
|
|
|
2007-10-29 04:02:41 +00:00
|
|
|
class BoincProfile {
|
|
|
|
static function lookup($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('profile', 'BoincProfile', $clause);
|
|
|
|
}
|
|
|
|
static function update_aux($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update_aux('profile', $clause);
|
|
|
|
}
|
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->insert('profile', $clause);
|
|
|
|
}
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('profile', 'BoincProfile', $clause);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-26 21:14:35 +00:00
|
|
|
?>
|