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; }
$_POST['passwd'] = stripslashes($_POST['passwd']); } if (!Coach::login($_POST['coach'], $_POST['passwd'], isset($_POST['remember']))) { $_GET['section'] = 'login'; } } // Logout? if ($_VISSTATE['POST_OUT'] = isset($_GET['logout'])) { $_GET['section'] = 'main'; # Redirect logged out users to the main page. Coach::logout(); } if ($_VISSTATE['COOCKIE'] || $_VISSTATE['POST_IN'] || $_VISSTATE['POST_OUT']) { setupGlobalVars(T_SETUP_GLOBAL_VARS__POST_COACH_LOGINOUT); } HTMLOUT::frame_begin(isset($_SESSION['logged_in']) ? $coach->settings['theme'] : $settings['stylesheet']); # Make page frame, banner and menu. MTS('Header loaded, login auth, html frame generated'); // Check if a menu-link was picked, and execute section code from sections.php accordingly. switch ($_GET['section']) { case 'login': sec_login(); break; case 'admin': sec_admin(); break; case 'teamlist': sec_teamlist(); break; case 'coachlist': sec_coachlist();
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> — ' . $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> — ' . $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&action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n"; } self::printList($sel_node, $sel_node_id, $ALLOW_EDIT); HTMLOUT::frame_end(); }
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> — ' . $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> — ' . $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&action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n"; } /* Print the prizes */ self::printList($sel_node, $sel_node_id, $ALLOW_EDIT); HTMLOUT::frame_end(); }
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(); }
* 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. * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ require 'header.php'; HTMLOUT::frame_begin(false); title("OBBLM Troubleshooting"); ?> <h1>Leagues</h1> <table> <thead> <th>League ID</th> <th>Tie Teams to Divisions</th> <th>Name</th> <th>Date Created</th> <th>Location</th> <th>Divisions</th> </thead> <tbody style="text-align: center"> <?php foreach (League::getLeagues() as $league) {
switch ($_GET['section']) { case 'login': sec_login(); break; case 'matches': Match_HTMLOUT::userSched(); break; case 'management': $teamId = Mobile_HTMLOUT::getSelectedTeamId(); Team_HTMLOUT::teamManagementBox($teamId); break; default: Mobile_HTMLOUT::sec_mobile_main(); } } else { HTMLOUT::frame_begin(); # Make page frame, banner and menu. MTS('Header loaded, login auth, html frame generated'); // Check if a menu-link was picked, and execute section code from sections.php accordingly. switch ($_GET['section']) { case 'login': sec_login(); break; case 'admin': sec_admin(); break; case 'teamlist': sec_teamlist(); break; case 'coachlist': sec_coachlist();