X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2FObj%2Fplacing.phh;h=71cbca17bdf5dab758b8c4442d8967d8302c17bb;hb=9ffc7e5dc05fdd25cc273661ba8dc394c5d5518b;hp=5e1144aeeecfd24b420d429c81203f774703893c;hpb=a3111de89c89bb1a3a81e748592d26d85e4fd79d;p=brisk.git diff --git a/web/briskin5/Obj/placing.phh b/web/briskin5/Obj/placing.phh index 5e1144a..71cbca1 100644 --- a/web/briskin5/Obj/placing.phh +++ b/web/briskin5/Obj/placing.phh @@ -2,7 +2,7 @@ /* * brisk - placing.phh * - * Copyright (C) 2009-2011 Matteo Nastasi + * Copyright (C) 2009-2012 Matteo Nastasi * mailto: nastasi@alternativeoutput.it * matteo.nastasi@milug.org * web: http://www.alternativeoutput.it @@ -23,18 +23,18 @@ */ -define(TOP_NUM, 10); -define(TRI_LIMIT, (90 * 24 * 60 * 60)); -define(TRI_MIN_GAMES, 70); -define(TRI_MAX_GAMES, 140); +define('TOP_NUM', 10); +define('TRI_LIMIT', (90 * 24 * 60 * 60)); +define('TRI_MIN_GAMES', 70); +define('TRI_MAX_GAMES', 140); -define(MON_LIMIT, (30 * 24 * 60 * 60)); -define(MON_MIN_GAMES, 35); -define(MON_MAX_GAMES, 70); +define('MON_LIMIT', (30 * 24 * 60 * 60)); +define('MON_MIN_GAMES', 35); +define('MON_MAX_GAMES', 70); -define(WEE_LIMIT, (7 * 24 * 60 * 60)); -define(WEE_MIN_GAMES, 10); -define(WEE_MAX_GAMES, 35); +define('WEE_LIMIT', (7 * 24 * 60 * 60)); +define('WEE_MIN_GAMES', 10); +define('WEE_MAX_GAMES', 35); class Ptsgam { @@ -49,7 +49,7 @@ class Ptsgam { $this->gam = $gam; } - function &myclone() + function myclone() { $ret = new Ptsgam($this->username, $this->pts, $this->gam); @@ -105,7 +105,7 @@ define(SUBTY_FREQ_LO, 0); define(SUBTY_FREQ_HI, 1); -function placings_show(&$user) +function placings_show($user) { $mtime = placing_time(); $tm = placing_date($mtime); @@ -142,8 +142,11 @@ function placing_time_file() function placing_time_pgsql() { GLOBAL $G_dbpfx; - // FIXME: now create can return FALSE - $bdb = BriskDB::create(); + + if (($bdb = BriskDB::create()) == FALSE) { + log_crit("placing: database connection failed"); + return (FALSE); + } $mti_sql = sprintf("SELECT CAST(EXTRACT(EPOCH FROM mtime) AS INTEGER) as mtime FROM %sbin5_places_mtime WHERE code = 0;", $G_dbpfx); @@ -174,7 +177,7 @@ function placing_date($mtime) } -function placing_show_file(&$user, $ty, $subty) +function placing_show_file($user, $ty, $subty) { $tail = FALSE; @@ -248,12 +251,14 @@ function placing_show_file(&$user, $ty, $subty) // // -function placing_show_pgsql(&$user, $ty, $subty) +function placing_show_pgsql($user, $ty, $subty) { GLOBAL $G_dbpfx; - // FIXME: now create can return FALSE - $bdb = BriskDB::create(); + if (($bdb = BriskDB::create()) == FALSE) { + log_crit("placing: database connection failed"); + return (""); + } if ($user != FALSE) { $pla_sql = sprintf("SELECT * from %sbin5_places where type = %d AND (rank <= %d OR ucode = '%s');", @@ -299,7 +304,7 @@ function placing_show_pgsql(&$user, $ty, $subty) return ($ret); } -function placing_show(&$user, $ty, $subty) +function placing_show($user, $ty, $subty) { GLOBAL $G_dbasetype;