示例#1
0
$cup = cs_sql_select(__FILE__, 'cups', '*', 'cups_id = ' . $cups_id);
$rounds = cs_cups_log($cup['cups_teams']);
$rounds_1 = $rounds;
if ($account['access_cups'] < $cup['cups_access'] || $cup['cups_access'] == 0) {
    echo $cs_lang['access_denied'];
    return;
}
if (defined('IN_TREE')) {
    $tree = true;
} else {
    $tree = false;
}
$width = empty($cs_option['width']) ? empty($_GET['width']) ? 600 : (int) $_GET['width'] : $cs_option['width'];
$key = 'lang=' . $account['users_lang'] . '&cup=' . $cups_id . '&lb=0&gridonly=' . ($gridonly ? 1 : 0) . '&tree=' . ($tree ? 1 : 0) . '&width=' . $width . '&access=' . $account['access_cups'];
if (function_exists('cs_datacache_load')) {
    $cachedata = cs_datacache_load('cups', 'viewtree', $key, false);
} else {
    $cachedata = false;
}
if ($cachedata !== false) {
    echo $cachedata;
    return;
}
$tables = 'cupmatches cm LEFT JOIN ';
$tables .= $cup['cups_system'] == CS_CUPS_TYPE_USERS ? '{pre}_users u1 ON u1.users_id = cm.squad1_id LEFT JOIN {pre}_users u2 ON u2.users_id = cm.squad2_id' : '{pre}_squads sq1 ON sq1.squads_id = cm.squad1_id LEFT JOIN {pre}_squads sq2 ON sq2.squads_id = cm.squad2_id';
$tables .= ' LEFT JOIN {pre}_cupsquads cs1 ON cm.squad1_id = cs1.squads_id AND cs1.cups_id = cm.cups_id LEFT JOIN {pre}_cupsquads cs2 ON cm.squad2_id = cs2.squads_id AND cs2.cups_id = cm.cups_id';
$cells = $cup['cups_system'] == CS_CUPS_TYPE_USERS ? 'u1.users_nick AS team1_name, cm.squad1_id AS team1_id, u2.users_nick AS team2_name, cm.squad2_id AS team2_id' : 'sq1.squads_name AS team1_name, cm.squad1_id AS team1_id, sq2.squads_name AS team2_name, cm.squad2_id AS team2_id';
$cells .= ', cm.cupmatches_winner AS cupmatches_winner, cm.cupmatches_accepted1 AS cupmatches_accepted1';
$cells .= ', cm.cupmatches_accepted2 AS cupmatches_accepted2, cm.cupmatches_tree_order AS cupmatches_tree_order';
$cells .= ', cs1.cupsquads_seed AS seed1, cs1.cupsquads_autoseed AS autoseed1';
$cells .= ', cs2.cupsquads_seed AS seed2, cs2.cupsquads_autoseed AS autoseed2';
示例#2
0
<?php

// ClanSphere 2011
//
$cs_lang = cs_translate('cups');
include_once 'mods/cups/functions.php';
$cups_id = (int) $_GET['id'];
$cup = cs_sql_select(__FILE__, 'cups', '*', 'cups_id = ' . $cups_id);
if ($account['access_cups'] < $cup['cups_access'] || $cup['cups_access'] == 0) {
    echo $cs_lang['access_denied'];
    return;
}
$key = 'lang=' . $account['users_lang'] . '&cup=' . $cups_id . '&access=' . $account['access_cups'];
if (function_exists('cs_datacache_load')) {
    $cachedata = cs_datacache_load('cups', 'result', $key, false);
} else {
    $cachedata = false;
}
if ($cachedata !== false) {
    echo $cachedata;
    return;
}
$gridsize = $cup['cups_teams'];
$rounds = cs_cups_log($gridsize);
$cpos = $gridsize;
$result = array();
/* get the teams */
$teams = cs_cups_get_teams($cups_id, $cup['cups_system'], $cs_lang);
$thirdplace = null;
switch ($cup['cups_brackets']) {
    case CS_CUPS_SYSTEM_KO3RD:
示例#3
0
        $top = 0;
    }
    $left = ($width - $fw * iconv_strlen($cs_lang['access_denied'], $cs_main['charset'])) / 2;
    if ($left < 0) {
        $left = 0;
    }
    imagestring($img, $font_csp, $left, $top, $cs_lang['access_denied'], $col_csp_red);
    header('Content-type: image/png');
    imagepng($img);
    imagedestroy($img);
    exit(0);
}
$width = empty($cs_option['width']) ? empty($_GET['width']) ? 600 : (int) $_GET['width'] : $cs_option['width'];
$key = 'lang=' . $account['users_lang'] . '&cup=' . $cups_id . '&lb=1&width=' . $width . '&access=' . $account['access_cups'];
if (function_exists('cs_datacache_load')) {
    $cachedata = cs_datacache_load('cups', 'image', $key, false);
} else {
    $cachedata = false;
}
if ($cachedata !== false) {
    header('Content-type: image/png');
    echo base64_decode($cachedata);
    exit(0);
}
$tables = 'cupmatches cm LEFT JOIN ';
$tables .= $cup['cups_system'] == CS_CUPS_TYPE_USERS ? '{pre}_users u1 ON u1.users_id = cm.squad1_id LEFT JOIN {pre}_users u2 ON u2.users_id = cm.squad2_id' : '{pre}_squads sq1 ON sq1.squads_id = cm.squad1_id LEFT JOIN {pre}_squads sq2 ON sq2.squads_id = cm.squad2_id';
$tables .= ' LEFT JOIN {pre}_cupsquads cs1 ON cm.squad1_id = cs1.squads_id AND cs1.cups_id = cm.cups_id LEFT JOIN {pre}_cupsquads cs2 ON cm.squad2_id = cs2.squads_id AND cs2.cups_id = cm.cups_id';
$cells = $cup['cups_system'] == CS_CUPS_TYPE_USERS ? 'u1.users_nick AS team1_name, cm.squad1_id AS team1_id, u2.users_nick AS team2_name, cm.squad2_id AS team2_id' : 'sq1.squads_name AS team1_name, cm.squad1_id AS team1_id, sq2.squads_name AS team2_name, cm.squad2_id AS team2_id';
$cells .= ', cm.cupmatches_winner AS cupmatches_winner, cm.cupmatches_accepted1 AS cupmatches_accepted1';
$cells .= ', cm.cupmatches_accepted2 AS cupmatches_accepted2, cm.cupmatches_tree_order AS cupmatches_tree_order';
$cells .= ', cs1.cupsquads_seed AS seed1, cs1.cupsquads_autoseed AS autoseed1';
示例#4
0
if ($games_id > 0) {
    $where .= ' AND cup.games_id = ' . $games_id;
} else {
    $games_id = 0;
}
$select = 'DISTINCT(cup.cups_id), cup.*, ga.games_name';
$order = 'cup.cups_start DESC';
$data_games = cs_sql_select(__FILE__, 'games', 'games_name, games_id', 0, 'games_name', 0, 0);
$data['games'] = cs_dropdownsel($data_games, $games_id, 'games_id');
$count = cs_sql_count(__FILE__, $table, $where, 'cup.cups_id');
if ($start < 0 || $start >= $count) {
    $start = 0;
}
$key = 'lang=' . $account['users_lang'] . '&games_id=' . $games_id . '&start=' . $start . '&access=' . $account['access_cups'];
if (function_exists('cs_datacache_load')) {
    $cachedata = cs_datacache_load('cups', 'halloffame', $key, false);
} else {
    $cachedata = false;
}
if ($cachedata !== false) {
    echo $cachedata;
    return;
}
if ($count) {
    $data['if']['hascups'] = true;
    $cups = cs_sql_select(__FILE__, $table, $select, $where, $order, $start, 0);
    // TODO: pagination $account['users_limit']
    $data['cups'] = array();
    $data['count']['all'] = $count;
    $run = 0;
    /* take icons from awards module */
示例#5
0
 * to omit the above disclaimer in their general documentation and/or
 * ClanSphere about section of the code.
 */
# Overwrite global settings by using the following array
$cs_main = array('init_sql' => true, 'init_tpl' => false, 'init_mod' => true);
chdir('../../');
require_once 'system/core/functions.php';
cs_init($cs_main);
@error_reporting(E_ALL);
$cs_lang = cs_translate('cups');
$cs_option = cs_sql_option(__FILE__, 'cups');
include_once 'mods/cups/defines.php';
include_once 'mods/cups/functions.php';
$key = 'lang=' . $account['users_lang'] . '&access=' . $account['access_cups'];
if (function_exists('cs_datacache_load')) {
    $cachedata = cs_datacache_load('cups', 'style', $key, false);
} else {
    $cachedata = false;
}
if ($cachedata !== false) {
    header('Content-type: text/css');
    echo $cachedata;
    exit(0);
}
$data = array();
$width = empty($cs_option['width']) ? empty($_GET['width']) ? 0 : (int) $_GET['width'] : $cs_option['width'];
$height = empty($cs_option['height']) ? 0 : $cs_option['height'];
$data['grid']['width'] = $width > 0 ? 'width: ' . $width . 'px;' : '';
$data['grid']['height'] = $height > 0 ? 'height: ' . $height . 'px;' : '';
$data['grid']['score_width'] = CS_CUPS_GRID_SCORE_WIDTH;
$data['grid']['image_width'] = CS_CUPS_GRID_IMAGE_WIDTH;