예제 #1
0
파일: game.php 프로젝트: kulebri/trouble
 /**
  * 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;
     }
 }
예제 #2
0
파일: kill.php 프로젝트: kulebri/trouble
 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;
 }
예제 #3
0
파일: func.php 프로젝트: arpad9/bygmarket
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;
}
예제 #4
0
파일: index.php 프로젝트: kulebri/trouble
define("LOCALE", "en_GB");
define("SITE_PATH", realpath(dirname(__FILE__) . DIRSEP . '..' . DIRSEP) . DIRSEP);
define("BASE_HREF", preg_replace("/(.*?)\\/index.php/", "\$1", $_SERVER['PHP_SELF']));
define("CONFIG_PATH", SITE_PATH . DIRSEP . "config");
define("CORE_PATH", SITE_PATH . "core");
define("HOST", $_SERVER["HTTP_HOST"]);
# If this is set to 1, searching will far faster but less det
# -ailed. (Using mysql full text natural searching). This for
# if there are many articles.
define("QUICK_SEARCH", 0);
function __autoload($class_name)
{
    if (strtolower(substr($class_name, 0, 5)) == "model" && strtolower($class_name) != "model") {
        $class_path = SITE_PATH . "models";
        $class_name = substr($class_name, 5);
    } else {
        $class_path = CORE_PATH;
    }
    $filename = str_replace("_", DIRSEP, strtolower($class_name)) . '.php';
    if (file_exists($class_path . DIRSEP . $filename)) {
        include $class_path . DIRSEP . $filename;
    } else {
        die("Could not find " . $class_path . DIRSEP . $filename . "!\n");
        return false;
    }
}
# Load router
$router = new router();
REGISTRY::set('router', $router);
$router->set_path(SITE_PATH . 'controllers');
$router->delegate();