/** * Asks the database what games are currently running. */ public static function current_games($db = 0) { if (!$db) { $db = REGISTRY::get("db"); } $sth = $db->prepare("\n\t\t\tSELECT \tid\n\t\t\tFROM \tgames\n\t\t\tWHERE\tstart_date < CURRENT_TIMESTAMP()\n\t\t\tAND\tend_date > CURRENT_TIMESTAMP()\n\t\t"); $sth->execute(); if ($sth->rowCount() > 0) { return $sth->fetchAll(PDO::FETCH_COLUMN, 0); } else { return 0; } }
public static function killboard_list() { $db = REGISTRY::get("db"); $sth = $db->prepare("\n\t\t\tSELECT kills.id as id,\n\t\t\t\tkills.description \tas description,\n\t\t\t\tkills.timestamp \tas timestamp,\n\t\t\t\tassassins.name \t\tas assassin,\n\t\t\t\ttargets.name \t\tas target,\n\t\t\t\tweapons.name \t\tas weapon,\n\t\t\t\tkills.assassin\t\tas aid,\n\t\t\t\tkills.target\t\tas tid\n\t\t\tFROM kills\n\t\t\tLEFT JOIN agents \t\tas assassins\n\t\t\t\tON kills.assassin \t= assassins.id\n\t\t\tLEFT JOIN agents \t\tas targets\n\t\t\t\tON kills.target \t= targets.id\n\t\t\tLEFT JOIN weapons\n\t\t\t\tON kills.weapon \t= weapons.id\n\t\t\tWHERE\tkills.game = :curgame\n\t\t\tORDER BY kills.timestamp DESC\n\t\t\tLIMIT 20\n\t\t"); $sth->bindParam(":curgame", $gid); $curgame = MODEL_GAME::current_games(); if (!is_array($curgame)) { return 0; } else { foreach ($curgame as $gid) { $sth->execute(); $res = $sth->fetchAll(PDO::FETCH_ASSOC); $kills[$gid] = $res; } } return $kills; }
function fn_twg_get_feature_value($value, $feature_type, $value_int, $variant_id, $variants) { if ($feature_type == "D") { $value = fn_date_format($value_int, REGISTRY::get('settings.Appearance.date_format')); } elseif ($feature_type == "M") { $value = array(); foreach ($variants as $variant) { if ($variant['selected']) { $value[] = $variant['variant']; } } } elseif ($variant_id) { $value = $variants[$variant_id]['variant']; } elseif ($value_int) { $value = $value_int; } return $value; }