Example #1
0
function sec_admin()
{
    global $rules, $settings, $DEA, $coach, $lng, $admin_menu;
    global $leagues, $divisions, $tours;
    if (!is_object($coach)) {
        fatal('Please login.');
    }
    if (!isset($_GET['subsec'])) {
        $_GET['subsec'] = '_NONE_';
    }
    $IS_GLOBAL_ADMIN = $coach->ring == Coach::T_RING_GLOBAL_ADMIN;
    $ONLY_FOR_GLOBAL_ADMIN = "Note: This feature may only be used by <i>global</i> administrators.";
    # Used string in a few common feature/action boxes.
    // Deny un-authorized users.
    if (!in_array($_GET['subsec'], array_keys($admin_menu))) {
        fatal("Sorry. Your access level does not allow you opening the requested page.");
    }
    switch ($_GET['subsec']) {
        case 'usr_man':
            include 'admin/admin_usr_man.php';
            break;
        case 'ct_man':
            include 'admin/admin_ct_man.php';
            break;
        case 'nodes':
            include 'admin/admin_nodes.php';
            break;
        case 'schedule':
            include 'admin/admin_schedule.php';
            break;
        case 'import':
            include 'admin/admin_import.php';
            break;
        case 'log':
            Module::run('LogSubSys', array('logViewPage'));
            break;
        case 'cpanel':
            include 'admin/admin_cpanel.php';
            break;
        default:
            fatal('The requested admin page does not exist.');
    }
    echo "<br><br>";
    HTMLOUT::dnt();
}
Example #2
0
    public static function conferenceAdmin()
    {
        global $lng, $tours, $coach;
        title($lng->getTrn('name', 'Conference'));
        self::handleActions();
        $tour_id = 0;
        if (isset($_POST['tour_id'])) {
            $tour_id = $_POST['tour_id'];
        }
        $firstTour = self::tournamentSelector($tour_id);
        // no tournament - they need to select something to see more.
        if ($tour_id == 0) {
            $tour_id = $firstTour;
        }
        // double check this coach is allowed to administer this tournament
        if (!$coach->isNodeCommish(T_NODE_TOURNAMENT, $tour_id)) {
            echo "<div class='boxWide'>";
            HTMLOUT::helpBox($lng->getTrn('not-admin', 'Conference'));
            echo "</div>";
            return;
        }
        $tour = new Tour($tour_id);
        $addConfTitle = $lng->getTrn('addConf', 'Conference');
        echo <<<EOQ
\t<div class='boxWide'>
\t\t<h3 class='boxTitle4'>{$tour->name}</h3>
\t\t<br />
\t\t<form name="add_conf" method="POST" action="handler.php?type=conference">
\t\t\t<input name='action' type='hidden' value='add_conf' />
\t\t\t<input name='tour_id' type='hidden' value='{$tour_id}' />
\t\t\t<input name='conf_name' type='hidden' value='{$tour_id}' />
\t\t\t<input id='conf_name' type="text" name="conf_name" size="30" maxlength="50">
\t\t\t<input type="submit" value="{$addConfTitle}">
\t\t</form>
\t</div>
    <script language="javascript">
    \tfunction removeTeam(conf_id, team_id) {
\t\t\tdocument.forms["remove_team"].conf_id.value=conf_id;
\t\t\tdocument.forms["remove_team"].team_id.value=team_id;
\t\t\tdocument.forms["remove_team"].submit();
\t\t}
    \tfunction removeConf(conf_id) {
\t\t\tdocument.forms["remove_conf"].conf_id.value=conf_id;
\t\t\tdocument.forms["remove_conf"].submit();
\t\t}
    </script>
\t<form name="remove_team" method="POST" action="handler.php?type=conference">
\t\t<input name='action' type='hidden' value='remove_team' />
\t\t<input name='tour_id' type='hidden' value='{$tour_id}' />
\t\t<input name='conf_id' id='conf_id' type='hidden' value='0' />
\t\t<input name='team_id' id='team_id' type='hidden' value='0' />
\t</form>
\t<form name="remove_conf" method="POST" action="handler.php?type=conference">
\t\t<input name='action' type='hidden' value='remove_conf' />
\t\t<input name='tour_id' type='hidden' value='{$tour_id}' />
\t\t<input name='conf_id' id='conf_id' type='hidden' value='0' />
\t</form>
\t<table class="boxTable">
EOQ;
        $confs = self::getConferencesForTour($tour->tour_id);
        $idx = 0;
        foreach ($confs as $conf) {
            $conf->loadTeams();
            if ($idx % 2 == 0) {
                echo "<tr valign='top'>";
            }
            echo <<<EOQ
\t\t<td>
\t\t<div class='boxCommon' style='margin-top: 0px; width=325px'>
\t\t\t<h4 class='boxTitleConf'>{$conf->name} <a onclick="return removeConf({$conf->conf_id});"><img src="images/remove.png" height="16" width="16" title="remove {$conf->name}" alt="remove {$conf->name}"/></a></h4>
\t\t\t<div style='white-space:nowrap; margin: 0px; padding: 5px; padding-top: 0px; line-height:175%; border 0px;'>
EOQ;
            self::findTeam($tour->tour_id, $conf->conf_id);
            foreach ($conf->teams as $team) {
                $link = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . "'>{$team->name}</a>";
                echo <<<EOQ
\t\t\t\t<br />{$link} <a onclick="return removeTeam({$conf->conf_id},{$team->team_id});"><img src="images/remove.png" height="12" width="12" title="remove {$team->name} from {$conf->name}" alt="remove {$team->name} from {$conf->name}"/></a>
EOQ;
            }
            echo <<<EOQ
\t\t\t</div>
\t\t</div>
\t\t</td>
EOQ;
            if ($idx % 2 == 1) {
                echo "</tr>";
            }
            $idx++;
        }
        echo <<<EOQ
\t</table>
EOQ;
    }
Example #3
0
    public static function frame_begin($stylesheet = false, $menu = true)
    {
        global $settings;
        ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title><?php 
        echo $settings['site_name'];
        ?>
</title>
        <link type="text/css" href="css/stylesheet<?php 
        echo $stylesheet ? $stylesheet : $settings['stylesheet'];
        ?>
.css" rel="stylesheet">
        <link rel="alternate" type="application/rss+xml" title="RSS Feed"href="rss.xml">
        <script type="text/javascript" src="lib/misc_functions.js"></script>
        <script type="text/javascript" src="lib/jquery-1.3.2.min.js"></script>
		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
        <script type="text/javascript" src="lib/jquery.autocomplete-min.js"></script>
        <script type="text/javascript" src="lib/jquery.expander.js"></script>
        <link type="text/css" href="css/autocomplete.css" rel="stylesheet">

        <!-- CSS MENU (./cssmenu extension) -->
        <link href="cssmenu/css/dropdown/dropdown.css" media="all" rel="stylesheet" type="text/css">
        <link href="cssmenu/css/dropdown/themes/default/default.ultimate.css" media="all" rel="stylesheet" type="text/css">
        <!-- <script type="text/javascript" src="cssmenu/js/jquery/jquery.js"></script> -->
        <script type="text/javascript" src="cssmenu/js/jquery/jquery.dropdown.js"></script>
        <!--[if lt IE 7]>
        <script type="text/javascript" src="cssmenu/js/jquery/jquery.js"></script>
        <script type="text/javascript" src="cssmenu/js/jquery/jquery.dropdown.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="everything">
            <div class="banner"></div>
            <div class="menu">
                <?php 
        if ($menu) {
            HTMLOUT::make_menu();
        }
        ?>
            </div> <!-- Menu div end -->
            <div class="section"> <!-- This container holds the section specific content -->
    <?php 
    }
Example #4
0
    private function _ES()
    {
        global $lng;
        ?>
    <div class="row">
        <div class="boxWide">
            <div class="boxTitle<?php 
        echo T_HTMLBOX_STATS;
        ?>
"><a href='javascript:void(0);' onClick="slideToggleFast('ES');"><b>[+/-]</b></a> &nbsp;<?php 
        echo $lng->getTrn('common/extrastats');
        ?>
</div>
            <div class="boxBody" id="ES" style='display:none;'>
                <?php 
        HTMLOUT::generateEStable($this);
        ?>
            </div>
        </div>
    </div>
    <?php 
    }
Example #5
0
 private function _games()
 {
     global $lng;
     $team = $this;
     // Copy. Used instead of $this for readability.
     title('<div class="team-management-title">' . $lng->getTrn('profile/team/games') . '</div>');
     HTMLOUT::recentGames(T_OBJ_TEAM, $team->team_id, false, false, false, false, array('url' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . '&amp;subsec=games', 'n' => MAX_RECENT_GAMES, 'GET_SS' => 'gp'));
     echo "<br>";
     HTMLOUT::upcomingGames(T_OBJ_TEAM, $team->team_id, false, false, false, false, array('url' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . '&amp;subsec=games', 'n' => MAX_RECENT_GAMES, 'GET_SS' => 'ug'));
 }
Example #6
0
 private function _recentGames()
 {
     echo "<div id='cc_recentmatches' style='clear:both;'>\n";
     echo "<br>";
     $url = urlcompile(T_URL_PROFILE, T_OBJ_COACH, $this->coach_id, false, false) . '&amp;subsec=recentmatches';
     HTMLOUT::recentGames(T_OBJ_COACH, $this->coach_id, false, false, false, false, array('url' => $url, 'n' => MAX_RECENT_GAMES, 'GET_SS' => 'gp'));
     echo "</div>";
 }
Example #7
0
    public static function makeList()
    {
        global $lng, $coach, $settings;
        HTMLOUT::frame_begin();
        # Make page frame, banner and menu.
        title($lng->getTrn('name', __CLASS__));
        echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n";
        list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array());
        $ALLOW_EDIT = is_object($coach) && $coach->isNodeCommish($sel_node, $sel_node_id);
        /* A new entry was sent. Add it to system */
        if ($ALLOW_EDIT && isset($_POST['tid']) && isset($_POST['trid'])) {
            if (get_magic_quotes_gpc()) {
                $_POST['title'] = stripslashes($_POST['title']);
                $_POST['txt'] = stripslashes($_POST['txt']);
            }
            switch ($_GET['action']) {
                case 'new':
                    status(self::create($_POST['ptype'], $_POST['tid'], $_POST['trid'], $_POST['title'], $_POST['txt']));
                    break;
            }
        }
        /* Was a request for a new entry made? */
        if (isset($_GET['action']) && $ALLOW_EDIT) {
            switch ($_GET['action']) {
                case 'delete':
                    if (isset($_GET['prid']) && is_numeric($_GET['prid'])) {
                        $pr = new Prize($_GET['prid']);
                        status($pr->delete());
                        unset($pr);
                    } else {
                        fatal('Sorry. You did not specify which prize ID you wish to delete.');
                    }
                    break;
                case 'new':
                    echo "<a href='handler.php?type=prize'><-- " . $lng->getTrn('common/back') . "</a><br><br>";
                    $_DISABLED = !isset($_POST['trid']) ? 'DISABLED' : '';
                    ?>
                <form name="STS" method="POST" enctype="multipart/form-data">
                <b><?php 
                    echo $lng->getTrn('common/tournament');
                    ?>
</b><br>
                <?php 
                    echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid');
                    ?>
                <input type='submit' value='<?php 
                    echo $lng->getTrn('common/select');
                    ?>
'>
                </form>
                <br>
                <form method="POST" enctype="multipart/form-data">
                <b><?php 
                    echo $lng->getTrn('team', __CLASS__);
                    ?>
</b><br>
                <select name="tid" <?php 
                    echo $_DISABLED;
                    ?>
>
                    <?php 
                    $teams = isset($_POST['trid']) ? Team::getTeams(false, array(get_parent_id(T_NODE_TOURNAMENT, (int) $_POST['trid'], T_NODE_LEAGUE)), true) : array();
                    foreach ($teams as $tid => $name) {
                        echo "<option value='{$tid}'>{$name}</option>\n";
                    }
                    ?>
                </select>
                <br><br>
                <b><?php 
                    echo $lng->getTrn('kind', __CLASS__);
                    ?>
</b><br>
                <select name="ptype" <?php 
                    echo $_DISABLED;
                    ?>
>
                    <?php 
                    foreach (self::getTypes() as $ptype => $desc) {
                        echo "<option value='{$ptype}'>{$desc}</option>\n";
                    }
                    ?>
                </select>
                <br><br>
                <?php 
                    echo '<b>' . $lng->getTrn('g_title', __CLASS__) . '</b> &mdash; ' . $lng->getTrn('title', __CLASS__);
                    ?>
<br>
                <input type="text" name="title" size="60" maxlength="100" value="" <?php 
                    echo $_DISABLED;
                    ?>
>
                <br><br>
                <?php 
                    echo '<b>' . $lng->getTrn('g_about', __CLASS__) . '</b> &mdash; ' . $lng->getTrn('about', __CLASS__);
                    ?>
<br>
                <textarea name="txt" rows="15" cols="100" <?php 
                    echo $_DISABLED;
                    ?>
></textarea>
                <br><br><br>
                <input type='hidden' name='trid' value='<?php 
                    echo $_DISABLED ? 0 : $_POST['trid'];
                    ?>
'>
                <input type="submit" value="<?php 
                    echo $lng->getTrn('submit', __CLASS__);
                    ?>
" name="Submit" <?php 
                    echo $_DISABLED;
                    ?>
>
                </form>
                <br>
                <?php 
                    return;
                    break;
            }
        }
        if ($ALLOW_EDIT) {
            echo "<br><a href='handler.php?type=prize&amp;action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n";
        }
        /* Print the prizes */
        self::printList($sel_node, $sel_node_id, $ALLOW_EDIT);
        HTMLOUT::frame_end();
    }
Example #8
0
function setupGlobalVars($type, $opts = array())
{
    global $coach, $lng, $leagues, $divisions, $tours, $settings, $rules, $admin_menu;
    switch ($type) {
        case T_SETUP_GLOBAL_VARS__COMMON:
            $coach = isset($_SESSION['logged_in']) ? new Coach($_SESSION['coach_id']) : null;
            # Create global coach object.
            list($leagues, $divisions, $tours) = Coach::allowedNodeAccess(Coach::NODE_STRUCT__FLAT, is_object($coach) ? $coach->coach_id : false, $extraFields = array(T_NODE_TOURNAMENT => array('locked' => 'locked', 'type' => 'type', 'f_did' => 'f_did'), T_NODE_DIVISION => array('f_lid' => 'f_lid'), T_NODE_LEAGUE => array('tie_teams' => 'tie_teams')));
            setupGlobalVars(T_SETUP_GLOBAL_VARS__LOAD_LEAGUE_SETTINGS);
            $_LANGUAGE = is_object($coach) && isset($coach->settings['lang']) ? $coach->settings['lang'] : $settings['lang'];
            if (!is_object($lng)) {
                $lng = new Translations($_LANGUAGE);
            } else {
                $lng->setLanguage($_LANGUAGE);
            }
            break;
        case T_SETUP_GLOBAL_VARS__POST_LOAD_MODULES:
            $admin_menu = is_object($coach) ? $coach->getAdminMenu() : array();
            break;
        case T_SETUP_GLOBAL_VARS__LOAD_LEAGUE_SETTINGS:
            // Local league settings exist?
            $file = "localsettings/settings_ID.php";
            // Update selected node $_SESSION vars if node selector form submission made (will make HTMLOUT::getSelectedNodeLid(), below, catch the correct league straight as opposed to on second page reload).
            HTMLOUT::updateNodeSelectorLeagueVars();
            // Selected
            if (isset($opts['lid']) && is_numeric($opts['lid'])) {
                $id = $opts['lid'];
            } else {
                if ($_lid = HTMLOUT::getSelectedNodeLid()) {
                    $id = $_lid;
                } else {
                    if (is_object($coach) && isset($coach->settings['home_lid'])) {
                        $id = $coach->settings['home_lid'];
                    } else {
                        $id = isset($settings['default_visitor_league']) ? $settings['default_visitor_league'] : '';
                    }
                }
            }
            $settingsFile = str_replace("ID", $id, $file);
            if ($localsettings = file_exists($settingsFile) ? $settingsFile : false) {
                include $localsettings;
            } else {
                include str_replace("ID", 'none', $file);
                # Empty settings file.
            }
            break;
        case T_SETUP_GLOBAL_VARS__POST_COACH_LOGINOUT:
            setupGlobalVars(T_SETUP_GLOBAL_VARS__COMMON);
            setupGlobalVars(T_SETUP_GLOBAL_VARS__POST_LOAD_MODULES);
            break;
    }
}
Example #9
0
echo "<div id='OPTS_FFA_TOUR_SETS'>{$body}</div>\n";
// Round robin seed multiplier.
$body = '';
$body .= $lng->getTrn('admin/schedule/rrobin_rnds') . "<br><select name='rounds'>";
foreach (range(1, 10) as $i) {
    $body .= "<option value='{$i}'>{$i}</option>\n";
}
$body .= "</select>&nbsp;" . $lng->getTrn('admin/schedule/times') . "\n";
echo "<div id='OPTS_RR_TOUR_SETS'>{$body}</div>\n";
?>
        <div id='OPTS_FFA_SINGLE_SETS'>
            <br>
            <?php 
$body = '';
$body .= $lng->getTrn('admin/schedule/in_tour') . '<br>';
$body .= HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'existTour', array(T_NODE_TOURNAMENT => array('type' => TT_FFA), 'OTHER' => array('ring' => Coach::T_RING_LOCAL_ADMIN)), array('locked' => 1, 'DISSTR' => 'LOCKED &mdash; %name'), array('empty_str' => array(T_NODE_LEAGUE => strtoupper($lng->getTrn('common/empty')) . ' &mdash; %name', T_NODE_DIVISION => strtoupper($lng->getTrn('common/empty')) . ' &mdash; %name')));
echo $body;
?>
        </div>
    </div>
    </div>
    <div class='boxCommon' style='<?php 
echo $commonStyle;
?>
'>
    <h3 class='boxTitle<?php 
echo T_HTMLBOX_ADMIN;
?>
'><?php 
echo $lng->getTrn('admin/schedule/add_team');
?>
Example #10
0
 public static function handleActions()
 {
     global $lng, $coach;
     if (isset($_POST['action'])) {
         if (is_object($coach) && $coach->isNodeCommish(T_NODE_LEAGUE, $_POST['lid'])) {
             $l_pref = new LeaguePref($_POST['lid'], "", $_POST['p_tour'], $_POST['league_name'], $_POST['forum_url'], $_POST['welcome'], $_POST['rules'], $_POST['existing']);
             if ($l_pref->validate()) {
                 if ($l_pref->save()) {
                     echo "<div class='boxWide'>";
                     HTMLOUT::helpBox($lng->getTrn('saved', 'LeaguePref'), '');
                     echo "</div>";
                 } else {
                     echo "<div class='boxWide'>";
                     HTMLOUT::helpBox($lng->getTrn('failedSave', 'LeaguePref'), '', 'errorBox');
                     echo "</div>";
                 }
             } else {
                 echo "<div class='boxWide'>";
                 HTMLOUT::helpBox($lng->getTrn('failedValidate', 'LeaguePref'), '', 'errorBox');
                 echo "</div>";
             }
         } else {
             echo "<div class='boxWide'>";
             HTMLOUT::helpBox($lng->getTrn('failedSecurity', 'LeaguePref'), '', 'errorBox');
             echo "</div>";
         }
     }
 }
Example #11
0
            </div>
        </div>
        </td>
    </tr>
    <tr>
        <td valign='top' colspan='2'>
        <div class="boxCommon">
            <div class="boxTitle<?php 
    echo T_HTMLBOX_ADMIN;
    ?>
">Delete league</div>
            <div class="boxBody">
            <form method="POST">
            League<br>
            <?php 
    echo HTMLOUT::nodeList(T_NODE_LEAGUE, 'lid', array('OTHER' => array('ring' => Coach::T_RING_LOCAL_ADMIN)), array(), array('empty_str' => array(T_NODE_LEAGUE => '')));
    ?>
            <br><br>
            <?php 
    echo $ONLY_FOR_GLOBAL_ADMIN;
    ?>
<br><br>
            <input type='submit' value='Delete' <?php 
    echo empty($leagues) || !$IS_GLOBAL_ADMIN ? ' DISABLED ' : '';
    ?>
 onclick="if(!confirm('Warning: You should only delete leagues if empty, ie. no divisions/matches assigned to them.')){return false;}">
            <input type='hidden' name='type' value='del_league'>
            </form>
            </div>
        </div>
        </td>
Example #12
0
function sec_about()
{
    global $lng, $credits;
    title("About OBBLM");
    HTMLOUT::dnt();
    ?>
    <br>
    <p>
        <b>OBBLM version <?php 
    echo OBBLM_VERSION;
    ?>
</b><br><br>
        Online Blood Bowl League Manager is an online game management system for Game Workshop's board game Blood Bowl.<br>
        <br>
        The authors of this program are
        <ul>
            <li> <a href="mailto:nicholas.rathmann@gmail.com">Nicholas Mossor Rathmann</a>
            <li> <a href="http://www.mercuryvps.com">William Leonard</a>
            <li> Niels Orsleff Justesen</a>
        </ul>
        With special thanks to <?php 
    $lc = array_pop($credits);
    echo implode(', ', $credits) . " and {$lc}";
    ?>
.<br><br>
        Bugs reports and suggestions are welcome.
        <br>
        OBBLM consists of valid HTML 4.01 transitional document type pages.
        <br><br>
        <img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88">
        <br><br>
        <b>Modules loaded:</b><br>
        <?php 
    $mods = array();
    foreach (Module::getRegistered() as $modname) {
        list($author, $date, $moduleName) = Module::getInfo($modname);
        $mods[] = "<i>{$moduleName}</i> ({$author}, {$date})";
    }
    echo implode(', ', $mods);
    ?>
    </p>

    <?php 
    title("OBBLM Hosting");
    echo 'Please visit <a href="http://www.mercuryvps.com">Mercury VPS</a> and click on the OBBLM tab to get started.';
    title("Documentation");
    echo "See the <a TARGET='_blank' href='" . DOC_URL . "'>OBBLM documentation wiki</a>";
    ?>

    <?php 
    title("Disclaimer");
    ?>
    <p>
        By installing and using this software you hereby accept and understand the following disclaimer
        <br><br>
        <b>This web site is completely unofficial and in no way endorsed by Games Workshop Limited.</b>
        <br><br>
        Bloodquest, Blood Bowl, the Blood Bowl logo, The Blood Bowl Spike Device, Chaos, the Chaos device, the Chaos logo, Games Workshop, Games Workshop logo, Nurgle, the Nurgle device, Skaven, Tomb Kings, 
        and all associated marks, names, races, race insignia, characters, vehicles, locations, units, illustrations and images from the Blood Bowl game, the Warhammer world are either ®, TM and/or © Games Workshop Ltd 2000-2006, 
        variably registered in the UK and other countries around the world. Used without permission. No challenge to their status intended. All Rights Reserved to their respective owners.
    </p>

    <?php 
    title("License");
    ?>
    <p>
        Copyright (c) Niels Orsleff Justesen and Nicholas Mossor Rathmann 2007-2011. All Rights Reserved.
        <br><br>
        OBBLM is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 3 of the License, or
        (at your option) any later version.
        <br><br>
        OBBLM is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
        <br><br>
        You should have received a copy of the GNU General Public License
        along with this program.  If not, see http://www.gnu.org/licenses/.
    </p>
    <?php 
}
Example #13
0
 public static function standings()
 {
     global $lng;
     title($lng->getTrn('menu/statistics_menu/race_stn'));
     HTMLOUT::standings(STATS_RACE, false, false, array('url' => urlcompile(T_URL_STANDINGS, T_OBJ_RACE, false, false, false)));
 }
Example #14
0
 private function _games()
 {
     global $lng;
     $team = $this;
     // Copy. Used instead of $this for readability.
     title("<a name='anc'>" . $lng->getTrn('profile/team/games') . "</a>");
     HTMLOUT::recentGames(T_OBJ_TEAM, $team->team_id, false, false, false, false, array('url' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . '&amp;subsec=games', 'n' => MAX_RECENT_GAMES, 'GET_SS' => 'gp'));
     echo "<br>";
     HTMLOUT::upcomingGames(T_OBJ_TEAM, $team->team_id, false, false, false, false, array('url' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . '&amp;subsec=games', 'n' => MAX_RECENT_GAMES, 'GET_SS' => 'ug'));
     #    upcomingGames($obj, $obj_id, $node, $node_id, $opp_obj, $opp_obj_id, array $opts)
 }
 public static function starHireHistory($obj, $obj_id, $node, $node_id, $star_id = false, $opts = array())
 {
     global $lng;
     /* 
         If $star_id is false, then the HH from all stars of $obj = $obj_id will be displayed, instead of only the HH of star = $star_id 
     */
     if (!array_key_exists('GET_SS', $opts)) {
         $opts['GET_SS'] = '';
     } else {
         $extra['GETsuffix'] = $opts['GET_SS'];
     }
     # GET Sorting Suffix
     $extra['doNr'] = false;
     $extra['noHelp'] = true;
     if ($ANC = array_key_exists('anchor', $opts)) {
         $extra['anchor'] = $opts['anchor'];
     }
     $mdat = array();
     foreach ($star_id ? array(new Star($star_id)) : Star::getStars($obj, $obj_id, $node, $node_id) as $s) {
         foreach ($s->getHireHistory($obj, $obj_id, $node, $node_id) as $m) {
             $o = (object) array();
             foreach (array('match_id', 'date_played', 'hiredBy', 'hiredAgainst', 'hiredByName', 'hiredAgainstName') as $k) {
                 $o->{$k} = $m->{$k};
             }
             foreach ($s->getStats(T_NODE_MATCH, $m->match_id) as $k => $v) {
                 $o->{$k} = $v;
             }
             $o->match = $lng->getTrn('common/view');
             $o->tour = get_alt_col('tours', 'tour_id', $m->f_tour_id, 'name');
             $o->score = "{$m->team1_score} - {$m->team2_score}";
             $o->result = matchresult_icon($m->team1_id == $m->hiredBy && $m->team1_score > $m->team2_score || $m->team2_id == $m->hiredBy && $m->team1_score < $m->team2_score ? 'W' : ($m->team1_score == $m->team2_score ? 'D' : 'L'));
             $o->star_id = $s->star_id;
             $o->name = $s->name;
             array_push($mdat, $o);
         }
     }
     $fields = array('date_played' => array('desc' => $lng->getTrn('common/dateplayed')), 'name' => array('desc' => $lng->getTrn('common/star'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_STAR, false, false, false), 'field' => 'obj_id', 'value' => 'star_id')), 'tour' => array('desc' => $lng->getTrn('common/tournament')), 'hiredByName' => array('desc' => $lng->getTrn('profile/star/hiredby'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'hiredBy')), 'hiredAgainstName' => array('desc' => $lng->getTrn('common/opponent'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'hiredAgainst')), 'cp' => array('desc' => 'Cp'), 'td' => array('desc' => 'Td'), 'intcpt' => array('desc' => 'Int'), 'cas' => array('desc' => 'Cas'), 'bh' => array('desc' => 'BH'), 'si' => array('desc' => 'Si'), 'ki' => array('desc' => 'Ki'), 'mvp' => array('desc' => 'MVP'), 'score' => array('desc' => $lng->getTrn('common/score'), 'nosort' => true), 'result' => array('desc' => $lng->getTrn('common/result'), 'nosort' => true), 'match' => array('desc' => $lng->getTrn('common/match'), 'href' => array('link' => 'index.php?section=matches&amp;type=report', 'field' => 'mid', 'value' => 'match_id'), 'nosort' => true));
     if ($star_id) {
         unset($fields['name']);
     }
     if ($obj && $obj_id) {
         unset($fields['hiredByName']);
     }
     $title = $lng->getTrn('common/starhh');
     if ($ANC) {
         $title = "<a name='{$opts['anchor']}'>" . $title . '<a>';
     }
     HTMLOUT::sort_table($title, $opts['url'], $mdat, $fields, sort_rule('star_HH'), isset($_GET["sort{$opts['GET_SS']}"]) ? array(($_GET["dir{$opts['GET_SS']}"] == 'a' ? '+' : '-') . $_GET["sort{$opts['GET_SS']}"]) : array(), $extra);
 }
Example #16
0
    public static function main($argv)
    {
        global $lng;
        title($lng->getTrn('name', 'Gallery'));
        list($sel_lid, $HTML_LeagueSelector) = HTMLOUT::simpleLeagueSelector();
        if (isset($_POST['type'])) {
            echo "<center><a href='handler.php?type=gallery'>" . $lng->getTrn('common/back') . "</a></center>\n";
            switch ($_POST['type']) {
                case 'team':
                    $t = new Team((int) $_POST['tid']);
                    echo "<b>" . $lng->getTrn('playersof', 'Gallery') . " {$t->name}</b><br><hr><br>\n";
                    foreach ($t->getPlayers() as $p) {
                        $img = new ImageSubSys(IMGTYPE_PLAYER, $p->player_id);
                        $pic = $img->getPath();
                        echo "<div style='float:left; padding:10px;'>{$p->name} (#{$p->nr})<br><a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $p->player_id, false, false) . "'><img HEIGHT=150 src='{$pic}' alt='pic'></a></div>";
                    }
                    break;
                case 'stad':
                    echo "<b>" . $lng->getTrn('stads', 'Gallery') . "</b><br><hr><br>\n";
                    $teams = get_rows('teams', array('team_id', 'name'), array("f_lid = {$sel_lid}"));
                    objsort($teams, array('+name'));
                    foreach ($teams as $t) {
                        $img = new ImageSubSys(IMGTYPE_TEAMSTADIUM, $t->team_id);
                        $pic = $img->getPath();
                        echo "<div style='float:left; padding:10px;'>{$t->name}<br><a href='{$pic}'><img HEIGHT=150 src='{$pic}' alt='pic'></a></div>";
                    }
                    break;
                case 'coach':
                    echo "<b>" . $lng->getTrn('coaches', 'Gallery') . "</b><br><hr><br>\n";
                    $q = "SELECT coach_id, name FROM coaches,memberships WHERE cid = coach_id AND lid = {$sel_lid} GROUP BY cid, lid ORDER BY name ASC";
                    $result = mysql_query($q);
                    while ($c = mysql_fetch_object($result)) {
                        $img = new ImageSubSys(IMGTYPE_COACH, $c->coach_id);
                        $pic = $img->getPath();
                        echo "<div style='float:left; padding:10px;'>{$c->name}<br><a href='{$pic}'><img HEIGHT=150 src='{$pic}' alt='pic'></a></div>";
                    }
                    break;
            }
            return;
        }
        echo $HTML_LeagueSelector;
        echo "<br><br>\n";
        echo $lng->getTrn('note', 'Gallery');
        ?>
    <ul>
    <li>
        <?php 
        $teams = get_rows('teams', array('team_id', 'name'), array("f_lid = {$sel_lid}"));
        objsort($teams, array('+name'));
        echo $lng->getTrn('players', 'Gallery') . "\n        <form method='POST' style='display:inline; margin:0px;'><select name='tid' onChange='this.form.submit();'>\n        <option value='0'>&mdash; " . $lng->getTrn('none', 'Gallery') . " &mdash;</option>" . implode("\n", array_map(create_function('$o', 'return "<option value=\'$o->team_id\'>$o->name</option>";'), $teams)) . "</select><input type='hidden' name='type' value='team'></form>\n        ";
        ?>
    </li>
    <li><?php 
        echo inlineform(array('type' => 'stad'), 'stadForm', $lng->getTrn('stads', 'Gallery'));
        ?>
</li>
    <li><?php 
        echo inlineform(array('type' => 'coach'), 'coachesForm', $lng->getTrn('coaches', 'Gallery'));
        ?>
</li>
    </ul>
    <?php 
    }
Example #17
0
    public static function frame_begin($menu = true)
    {
        global $settings;
        Module::runTriggers(T_TRIGGER_BEFORE_PAGE_RENDER);
        ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title><?php 
        echo $settings['site_name'];
        ?>
</title>
        <link type="text/css" href="css/stylesheet_default.css" rel="stylesheet">
        <link type="text/css" href="css/stylesheet<?php 
        echo $settings['stylesheet'];
        ?>
.css" rel="stylesheet">
        <link type="text/css" href="css/league_override_<?php 
        echo self::getSelectedNodeLidOrDefault();
        ?>
.css" rel="stylesheet">
        <link rel="alternate" type="application/rss+xml" title="RSS Feed"href="rss.xml">
        <script type="text/javascript" src="lib/misc_functions.js"></script>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
        <script type="text/javascript" src="js/lib/underscore-1.8.3.min.js"></script>
        <script type="text/javascript" src="js/lib/knockout-3.3.0.min.js"></script>
        <script type="text/javascript" src="lib/jquery.autocomplete-min.js"></script>
        <script type="text/javascript" src="lib/jquery.expander.js"></script>
        <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
        <script>tinymce.init({ 
            selector:'.html_edit',
            menubar: false,
            width: 860,
            height: 150
        });</script>
        
        <script type="text/javascript" src="js/app/ViewModel/Common/RegistrationViewModel.js"></script>
        <script type="text/javascript" src="js/app/ViewModel/Common/PageViewModel.js"></script>
        <script type="text/javascript" src="js/app/CustomBinders/EditableCustomBinder.js"></script>
        
        <script type="text/javascript">
            $(document).ready(function() {
                var leaguesJson = <?php 
        echo json_encode(League::getLeaguesWithLocation());
        ?>
;
                ko.applyBindings(new PageViewModel(leaguesJson));
            });
        </script>
    </head>
    <body>
        <div class="everything">
            <div class="banner">
            <f0> </f0><br><br><br>
            <f1><?php 
        echo $settings['banner_title'];
        ?>
</f1><br>
            <f2><?php 
        echo $settings['banner_subtitle'];
        ?>
</f2></div>
            <div class="menu">
                <?php 
        if ($menu) {
            HTMLOUT::make_menu();
        }
        ?>
            </div> <!-- Menu div end -->
            <div class="section"> <!-- This container holds the section specific content -->
    <?php 
    }
Example #18
0
 public static function main($argv)
 {
     // Module registered main function.
     global $coach;
     global $settings;
     if (!$settings['leegmgr_enabled']) {
         die("LeegMgr is currently disabled.");
     }
     #Begin Replay Retrieval
     if (isset($_GET['replay'])) {
         #Retrieve the entire ZIP file that was previously uploaded.
         $mid = $_GET['replay'];
         if (is_numeric($mid)) {
             $zip = mysql_query("SELECT replay FROM `leegmgr_matches` WHERE mid = {$mid}");
             $zip = mysql_fetch_array($zip);
             $zip = $zip[0];
         }
         if (!isset($zip) || !$zip) {
             print "An upload could not be retrieved for the specified match id.";
             return false;
         }
         #Create a temporary file name that the ZIP file can be written to.
         $temp_path = sys_get_temp_dir();
         $tempname = tempnam($temp_path, "");
         #Open and write the retrieved ZIP file to the temporary file.
         $f_r = fopen($tempname, 'w+');
         fwrite($f_r, $zip);
         fseek($f_r, 0);
         fclose($f_r);
         #Open up the temp file for extracting the replay.rep file from the ZIP file.
         $zip_r = zip_open($tempname);
         while ($zip_entry = zip_read($zip_r)) {
             if (strpos(zip_entry_name($zip_entry), "replay.rep") !== false || strpos(zip_entry_name($zip_entry), "Replay_") !== false) {
                 $replay = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                 if (strpos(zip_entry_name($zip_entry), "replay.rep") !== false) {
                     $extension = ".rep";
                 } else {
                     if (strpos(zip_entry_name($zip_entry), "Replay_") !== false) {
                         $extension = ".db";
                     }
                 }
                 zip_entry_close($zip_entry);
             }
         }
         zip_close($zip_r);
         #Specify the header so that the browser is prompted to download the replay.rep file.
         header('Content-type: application/octec-stream');
         header('Content-Disposition: attachment; filename=match' . $mid . $extension);
         #Whatever is printed to the screen will be in the file.
         print $replay;
         return true;
     }
     #End Replay Retrieval
     if (!isset($argv[0])) {
         HTMLOUT::frame_begin();
     }
     if (isset($_FILES['userfile']) && isset($_SESSION['coach_id'])) {
         $userfile = $_FILES['userfile'];
         $tour_id = isset($_POST['ffatours']) ? $_POST['ffatours'] : -1;
         $coach_id = $_SESSION['coach_id'];
         $reroll = isset($_POST['reroll']) ? $_POST['reroll'] : 2;
         self::submitForm($userfile, $tour_id, $coach_id, $reroll);
     } else {
         print "<html><body>";
         print UPLOAD_BOTOCS::form();
         print "</body></html>";
     }
     HTMLOUT::frame_end();
 }
Example #19
0
 public static function run($class, array $argv)
 {
     if (!array_key_exists($class, self::$modules)) {
         return null;
     }
     foreach (self::$modules[$class]['filesRunTime'] as $file) {
         require_once self::MOD_RPATH . $file;
     }
     # Load module files.
     $module = array_merge(self::$modules[$class], call_user_func(array($class, 'getModuleAttributes')));
     # Shortcut.
     global $coach;
     # Used for fetching stylesheet.
     if ($module['setCanvas']) {
         HTMLOUT::frame_begin();
     }
     // Test if module implements the required interface.
     $reflection = new ReflectionClass($class);
     if (!$reflection->implementsInterface($modIntf = 'ModuleInterface')) {
         fatal("Module registered by class name '{$class}' does not implement the interface '{$modIntf}'");
     }
     $return = call_user_func(array($class, 'main'), $argv);
     if ($module['setCanvas']) {
         HTMLOUT::frame_end();
     }
     return $return;
 }
Example #20
0
    public static function makeList($ALLOW_EDIT)
    {
        global $lng, $coach, $settings;
        HTMLOUT::frame_begin(is_object($coach) ? $coach->settings['theme'] : $settings['stylesheet']);
        # Make page frame, banner and menu.
        /* A new entry was sent. Add it to system */
        if (isset($_POST['tid']) && $ALLOW_EDIT) {
            if (get_magic_quotes_gpc()) {
                $_POST['title'] = stripslashes($_POST['title']);
                $_POST['about'] = stripslashes($_POST['about']);
            }
            switch ($_GET['action']) {
                case 'edit':
                    $e = new self($_GET['ft_id']);
                    status($e->edit($_POST['title'], $_POST['about']));
                    break;
                case 'new':
                    status(self::create($_POST['tid'], $_POST['title'], $_POST['about']));
                    break;
            }
        }
        title($lng->getTrn('name', __CLASS__));
        /* Was a request for a new entry made? */
        if (isset($_GET['action']) && $ALLOW_EDIT) {
            // Default schema values. These are empty unless "edit" is chosen.
            $tid = false;
            $title = '';
            $about = '';
            switch ($_GET['action']) {
                case 'delete':
                    if (isset($_GET['ft_id']) && is_numeric($_GET['ft_id'])) {
                        $e = new self($_GET['ft_id']);
                        status($e->delete());
                        unset($e);
                    } else {
                        fatal('Sorry. You did not specify which FT-id you wish to delete.');
                    }
                    break;
                case 'edit':
                    if (isset($_GET['ft_id']) && is_numeric($_GET['ft_id'])) {
                        $e = new self($_GET['ft_id']);
                        $tid = $e->tid;
                        $title = $e->title;
                        $about = $e->about;
                        $_POST['lid'] = get_alt_col('mv_teams', 'f_tid', $tid, 'f_lid');
                    } else {
                        fatal('Sorry. You did not specify which FT-id you wish to edit.');
                    }
                    // Fall-through to "new" !!!
                // Fall-through to "new" !!!
                case 'new':
                    echo "<a href='handler.php?type=famousteams'><-- " . $lng->getTrn('common/back') . "</a><br><br>";
                    $_DISABLED = !isset($_POST['lid']) ? 'DISABLED' : '';
                    $node_id = isset($_POST['lid']) ? $_POST['lid'] : null;
                    ?>
                <form name="STS" method="POST" enctype="multipart/form-data">
                <b><?php 
                    echo $lng->getTrn('common/league');
                    ?>
</b><br>
                <?php 
                    echo HTMLOUT::nodeList(T_NODE_LEAGUE, 'lid', array(), array(), array('sel_id' => $node_id));
                    ?>
                <input type='submit' value='<?php 
                    echo $lng->getTrn('common/select');
                    ?>
'>
                </form>
                <br>
                <form method="POST">
                <b><?php 
                    echo $lng->getTrn('team', __CLASS__) . '</b>';
                    ?>
<br>
                <?php 
                    $query = "SELECT team_id, name FROM teams WHERE f_lid = {$node_id} ORDER by name ASC";
                    $result = mysql_query($query);
                    if ($result && mysql_num_rows($result) == 0) {
                        $_DISABLED = 'DISABLED';
                    }
                    ?>
                <select name="tid" id="teams" <?php 
                    echo $_DISABLED;
                    ?>
>
                    <?php 
                    while ($row = mysql_fetch_assoc($result)) {
                        echo "<option value='{$row['team_id']}' " . ($tid == $row['team_id'] ? 'SELECTED' : '') . ">{$row['name']}</option>\n";
                    }
                    ?>
                </select>
                <br><br>
                <b><?php 
                    echo $lng->getTrn('g_title', __CLASS__) . '</b>&nbsp;&mdash;&nbsp;' . $lng->getTrn('title', __CLASS__);
                    ?>
<br>
                <input type="text" name="title" size="60" maxlength="100" value="<?php 
                    echo $title;
                    ?>
" <?php 
                    echo $_DISABLED;
                    ?>
>
                <br><br>
                <b><?php 
                    echo $lng->getTrn('g_about', __CLASS__) . '</b>&nbsp;&mdash;&nbsp;' . $lng->getTrn('about', __CLASS__);
                    ?>
<br>
                <textarea name="about" rows="15" cols="100" <?php 
                    echo $_DISABLED;
                    ?>
><?php 
                    echo $about;
                    ?>
</textarea>
                <br><br>
                <input type="submit" value="<?php 
                    echo $lng->getTrn('submit', __CLASS__);
                    ?>
" name="Submit" <?php 
                    echo $_DISABLED;
                    ?>
>
                </form>
                <?php 
                    return;
                    break;
            }
        }
        /* Print the hall of fame */
        echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n";
        list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array());
        if ($ALLOW_EDIT) {
            echo "<br><a href='handler.php?type=famousteams&amp;action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n";
        }
        self::printList($sel_node, $sel_node_id, $ALLOW_EDIT);
        HTMLOUT::frame_end();
    }
Example #21
0
    public static function userSched()
    {
        global $lng, $coach, $settings, $leagues, $divisions, $tours;
        if (!is_object($coach)) {
            status(false, "You must be logged in to schedule games");
            return;
        }
        if (isset($_POST['creategame'])) {
            // Test input
            $trid = (int) $_POST['trid'];
            $round = (int) $_POST['round'];
            $own_team = (int) $_POST['own_team'];
            $errmsg = '';
            // Logged in coach has access to the tour?
            if (!in_array($trid, array_keys($tours))) {
                $errmsg = 'You do not have access to the tournament ' . $tours[$trid]['tname'];
            }
            // Is the team is really owned by the logged in coach?
            if ($coach->coach_id != get_alt_col('teams', 'team_id', $own_team, 'owned_by_coach_id')) {
                $errmsg = 'The team ' . get_alt_col('teams', 'team_id', $own_team, 'name') . ' is not owned by you';
            }
            // Create match
            if (!$errmsg) {
                list($exitStatus, $mid) = Match::create(array('team1_id' => $own_team, 'team2_id' => get_alt_col('teams', 'name', $_POST['opposing_team_autocomplete'], 'team_id'), 'round' => $round, 'f_tour_id' => $trid));
                $backFromMatchLink = Mobile::isMobile() ? "index.php?mobile=1" : "index.php?section=matches&amp;type=report&amp;mid={$mid}";
                status(!$exitStatus, $exitStatus ? Match::$T_CREATE_ERROR_MSGS[$exitStatus] : "<a href='{$backFromMatchLink}'>Click here</a> to open the match report");
                if (!$exitStatus) {
                    echo "<br>";
                }
            } else {
                status(false, $errmsg);
            }
        }
        $trid = isset($_GET['trid']) && is_numeric($_GET['trid']) ? (int) $_GET['trid'] : 0;
        $lid = $trid ? get_parent_id(T_NODE_TOURNAMENT, $trid, T_NODE_LEAGUE) : false;
        $lname = $lid ? get_parent_name(T_NODE_TOURNAMENT, $trid, T_NODE_LEAGUE) : '- N/A -';
        $did = $trid && get_alt_col('leagues', 'lid', $lid, 'tie_teams') == 1 ? get_parent_id(T_NODE_TOURNAMENT, $trid, T_NODE_DIVISION) : false;
        $dname = $did ? get_parent_name(T_NODE_TOURNAMENT, $trid, T_NODE_DIVISION) : false;
        $_DISABLED = !$trid ? 'DISABLED' : '';
        #print_r(array($trid, $lid, $lname, $did));
        title($lng->getTrn('menu/matches_menu/usersched'));
        $LOCK_FORMS = false;
        ?>
    <div class='boxCommon'>
        <h3 class='boxTitle<?php 
        echo T_HTMLBOX_MATCH;
        ?>
'><?php 
        echo $lng->getTrn('menu/matches_menu/usersched');
        ?>
</h3>
        <div class='boxBody'>
            <form method="POST" id="usersched">
                <?php 
        echo "In tournament ";
        echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid', array(T_NODE_TOURNAMENT => array('locked' => 0, 'type' => TT_FFA, 'allow_sched' => 1)), array(), array('sel_id' => $trid, 'extra_tags' => array('onChange="document.location.href = \'' . getFormAction('?section=matches&type=usersched') . '&trid=\' + $(this).val();"'), 'init_option' => '<option value="0">- ' . $lng->getTrn('matches/usersched/selecttour') . " -</option>\n"));
        echo ' as ';
        echo '<select name="round" id="round" ' . $_DISABLED . '>';
        $T_ROUNDS = Match::getRounds();
        foreach ($T_ROUNDS as $r => $d) {
            echo "<option value='{$r}' " . ($r == 1 ? 'SELECTED' : '') . ">" . $d . "</option>\n";
        }
        ?>
                </select>
                <br><br>
                Your team
                <?php 
        $teams = array();
        foreach ($coach->getTeams($lid, $did, array('sortby' => 'team_id DESC')) as $t) {
            if (!$t->rdy || $t->is_retired) {
                continue;
            }
            $teams[] = $t;
        }
        ?>
                <select name='own_team' id='own_team' <?php 
        echo $_DISABLED;
        ?>
>
                    <?php 
        echo "<optgroup class='leagues' label='{$lname}'>\n";
        if ($dname) {
            echo "<optgroup class='divisions' label='&nbsp;&nbsp;{$dname}'>\n";
        }
        foreach ($teams as $t) {
            echo "<option style='background-color: white; margin-left: -1em;' value='{$t->team_id}'>&nbsp;&nbsp;&nbsp;{$t->name}</option>\n";
        }
        ?>
                </select>
                &nbsp;
                VS.
                <input type="text" id='opposing_team_autoselect' name="opposing_team_autocomplete" size="30" maxlength="50" <?php 
        echo $_DISABLED;
        ?>
>
                <script>
                    $(document).ready(function(){
                        var options, b;

                        options = {
                            minChars:2,
                            serviceUrl:'handler.php?type=autocomplete&obj=<?php 
        echo T_OBJ_TEAM;
        ?>
&trid=<?php 
        echo $trid;
        ?>
',
                        };
                        b = $('#opposing_team_autoselect').autocomplete(options);
                    });
                </script>
                <br><br><br>
                <input type="submit" name="creategame" value="<?php 
        echo $lng->getTrn('menu/matches_menu/usersched');
        ?>
" <?php 
        if (empty($teams) || $_DISABLED) {
            echo 'DISABLED';
        }
        ?>
>
                
                <?php 
        if (Mobile::isMobile()) {
            echo '<a href="' . getFormAction('') . '">' . $lng->getTrn('common/back') . '</a>';
        }
        ?>
            </form>
        </div>
    </div>
    <?php 
    }
Example #22
0
        sec_admin();
        break;
    case 'teamlist':
        sec_teamlist();
        break;
    case 'coachlist':
        sec_coachlist();
        break;
    case 'rules':
        sec_rules();
        break;
    case 'about':
        sec_about();
        break;
    case 'matches':
        sec_matcheshandler();
        break;
        // Tournaments, matches, match reports, recent matches, upcoming matches etc.
    // Tournaments, matches, match reports, recent matches, upcoming matches etc.
    case 'objhandler':
        sec_objhandler();
        break;
        // Object profiles, object standings.
    // Object profiles, object standings.
    default:
        sec_main();
}
HTMLOUT::frame_end();
// Spit out all the end-tags.
mysql_close($conn);
MTS('END OF SCRIPT');
Example #23
0
    public static function main($argv)
    {
        global $lng;
        title($lng->getTrn('name', __CLASS__));
        echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n";
        list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array());
        echo "<br>";
        $_rows = 0;
        foreach (self::getMemMatches($sel_node, $sel_node_id) as $d => $matches) {
            $_container_style = 'float:left; width:50%;';
            if ($_rows == 0) {
                echo "<div style='{$_container_style}'>";
            }
            ?>
        <div class="boxWide">
            <div class="boxTitle<?php 
            echo T_HTMLBOX_INFO;
            ?>
"><?php 
            echo $lng->getTrn($d, __CLASS__);
            ?>
</div>
            <div class="boxBody">
                <table class="common">
                <?php 
            if (empty($matches)) {
                ?>
<tr><td align="center"><br><br><?php 
                echo preg_replace('/\\sX\\s/', ' ' . MAX_MEM_MATCHES . ' ', $lng->getTrn('filled', __CLASS__));
                ?>
<br><br></td></tr><?php 
            } else {
                $i = count($matches);
                foreach ($matches as $m) {
                    $t1 = new Team($m->team1_id);
                    $t2 = new Team($m->team2_id);
                    $img1 = new ImageSubSys(IMGTYPE_TEAMLOGO, $t1->team_id);
                    $img2 = new ImageSubSys(IMGTYPE_TEAMLOGO, $t2->team_id);
                    ?>
                    <tr>
                        <td align="left" style="width:40%;"><img border='0px' height='30' width='30' alt='team picture' src='<?php 
                    echo $img1->getPath();
                    ?>
'><?php 
                    echo $t1->name;
                    ?>
</td>
                        <td align="center">
                        <?php 
                    switch ($d) {
                        case 'td':
                        case 'cp':
                        case 'intcpt':
                        case 'ki':
                        case 'cas':
                            $v = array();
                            $s = $d == 'cas' ? 'bh+ki+si' : $d;
                            foreach (array(1, 2) as $j) {
                                $query = "SELECT SUM({$s}) as '{$s}' FROM matches, match_data WHERE f_match_id = match_id AND match_id = {$m->match_id} AND f_team_id = team{$j}_id";
                                $result = mysql_query($query);
                                $row = mysql_fetch_assoc($result);
                                $v[$j] = $row[$s] ? $row[$s] : 0;
                            }
                            echo "<b>{$v['1']} &nbsp;-&nbsp; {$v['2']}</b>";
                            break;
                        case 'svic':
                            echo "<b>{$m->team1_score} &nbsp;-&nbsp; {$m->team2_score}</b>";
                            break;
                        case 'inc':
                            echo '<b>' . $m->income1 / 1000 . 'k - ' . $m->income2 / 1000 . 'k</b>';
                            break;
                        case 'gate':
                            echo '<b>' . $m->gate / 1000 . 'k</b>';
                            break;
                        case 'mfans':
                            echo "<b>{$m->fans}</b>";
                            break;
                        case 'tvdiff':
                            echo '<b>' . $m->tv1 / 1000 . 'k - ' . $m->tv2 / 1000 . 'k</b>';
                            break;
                    }
                    ?>
                        </td>
                        <td align="right" style="width:40%;"><?php 
                    echo $t2->name;
                    ?>
<img border='0px' height='30' width='30' alt='team picture' src='<?php 
                    echo $img2->getPath();
                    ?>
'></td>
                    </tr>
                    <tr>
                        <td align="right" colspan="3">
                        <small>
                        <i><?php 
                    echo get_alt_col('tours', 'tour_id', $m->f_tour_id, 'name');
                    ?>
, <?php 
                    echo textdate($m->date_played, true);
                    ?>
</i>,
                        <a href="index.php?section=matches&amp;type=report&amp;mid=<?php 
                    echo $m->match_id;
                    ?>
"><?php 
                    echo $lng->getTrn('common/view');
                    ?>
</a>
                        </small>
                        </td>
                    </tr>
                    <?php 
                    if (--$i > 0) {
                        echo '<tr><td colspan="3"><hr></td></tr>';
                    }
                }
            }
            ?>
                </table>
            </div>
        </div>
        <?php 
            if (is_int(($_rows + 1) / MMATCHES_BREAK)) {
                echo "</div>";
                echo "<div style='{$_container_style}'>";
            }
            $_rows++;
        }
        echo "</div>";
    }