public static function saveCoach(Coach $coach)
 {
     $conn = connection::getConnectionObject();
     $con = $conn->getConnection();
     $sql = $con->prepare("INSERT INTO coach VALUES (?,?)");
     $sportid = $coach->getSportId();
     $sportname = $coach->getName();
     $sql->bind_param("ss", $sportid, $sportname);
     if ($sql->execute() == TRUE) {
         echo "New record created successfully (coach added)";
     } else {
         echo "Error in adding sport: " . $sql . "<br>";
     }
 }
예제 #2
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;
    }
}
예제 #3
0
 public static function getLeagueCommissionerEmails($leagueID)
 {
     $email = '';
     $sep_comma = "";
     $coaches = Coach::getCoaches();
     foreach ($coaches as $c) {
         if ($c->isNodeCommish(T_NODE_LEAGUE, $leagueID) && Email::checkEmail($c->mail)) {
             $email = $email . $sep_comma . $c->mail;
             if ($email) {
                 $sep_comma = ", ";
             }
         }
     }
     return $email;
 }
 protected function statsFromCoach($list, $id)
 {
     foreach ($list as $key => $entry) {
         switch ($entry) {
             case 'Head Coach':
             case 'Name:':
             case 'Alma Mater':
             case 'Date Of Birth':
             case 'Yrs Coaching':
             case 'Record':
                 unset($list[$key]);
                 break;
             default:
                 break;
         }
     }
     $temp = $list;
     unset($list);
     $list = array();
     foreach ($temp as $key => $value) {
         if ($value != '') {
             $list[] = $value;
         }
     }
     $name = $list[0];
     $slug = $this->CI->slugify->simple($name);
     $name = explode(' ', $name);
     $this->CI->load->model('coachRepository', '_coach');
     $coach = $this->CI->_coach->findOneByNcaaId($id);
     if (!$coach) {
         $coach = new Coach();
         $coach->setFirstName($name[0]);
         $coach->setLastName($name[1]);
         $coach->setSlug($slug);
         $coach->setNcaaId($id);
         $coach->save();
     }
     return $coach;
 }
예제 #5
0
 private static function form()
 {
     /**
      * Creates an upload form.
      *
      * 
      **/
     global $coach;
     if (is_object($coach)) {
         # Tours the logged in coach can "see".
         list(, , $tours) = Coach::allowedNodeAccess(Coach::NODE_STRUCT__FLAT, $coach->coach_id, array(T_NODE_TOURNAMENT => array('type' => 'type', 'locked' => 'locked', 'f_did' => 'f_did')));
         $tourlist = "";
         $coach_lid = isset($_SESSION['NS_node_id']) && $_SESSION['NS_node_id'] > 0 ? $_SESSION['NS_node_id'] : 1;
         foreach ($tours as $trid => $t) {
             $lid = get_alt_col('divisions', 'did', $t['f_did'], 'f_lid');
             if ($t['type'] == TT_FFA && !$t['locked'] && $coach_lid == $lid && $t['tname'] != "Pandora's Box") {
                 $tourlist .= "<option value='{$trid}'>{$t['tname']}</option>\n";
             }
         }
         #            $tourlist = HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'ffatours', array(T_NODE_TOURNAMENT => array('type' => TT_FFA, 'locked' => 0)), array(), array('hide_empty'=>array(T_NODE_DIVISION,T_NODE_LEAGUE)));
         global $settings;
         $cy_reroll = "";
         if ($settings['leegmgr_cyanide']) {
             $cy_reroll = "\r\n                    Reroll winnings if roll is less than: \r\n                    <select name='reroll'>\r\n                        <option value='2'>2</option>\r\n                        <option value='3'>3</option>\r\n                        <option value='4'>4</option>\r\n                        <option value='5'>5</option>\r\n                        <option value='6'>6</option>\r\n                    </select><br>";
         }
         $form = "\r\n                <!-- The data encoding type, enctype, MUST be specified as below -->\r\n                <form enctype='multipart/form-data' action='handler.php?type=leegmgr' method='POST'>\r\n                    <!-- MAX_FILE_SIZE must precede the file input field -->\r\n                    <input type='hidden' name='MAX_FILE_SIZE' value='256000' />\r\n                    <!-- Name of input element determines name in {$_FILES} array -->\r\n                    Send this file <input name='userfile' type='file' /><br>\r\n                    Save in tournament\r\n                    <select name='ffatours'>\r\n                        <optgroup label='Existing FFA'>\r\n\r\n                            {$tourlist}\r\n\r\n                        </optgroup>\r\n                    </select>\r\n\r\n                    <br>{$cy_reroll}<br>\r\n                    <input type='submit' value='Send File' />\r\n                </form>\r\n            ";
         return "\r\n            <div class='boxCommon'>\r\n            <h3 class='boxTitle" . T_HTMLBOX_MATCH . "'>Upload match</h3>\r\n            <div class='boxBody'>\r\n            " . $form . "\r\n            </div>\r\n            </div>\r\n            ";
     } else {
         return 'You must login in order to upload a match report.';
     }
 }
예제 #6
0
 public static function main($argv)
 {
     // Module registered main function.
     global $settings;
     if (!$settings['allow_registration']) {
         die("Registration is currently disabled.");
     }
     $form = "";
     if (isset($_GET['form'])) {
         $form = $_GET['form'];
     }
     if (isset($_POST['new_name']) && isset($_POST['new_mail']) && isset($_POST['new_passwd'])) {
         $username = $_POST['new_name'];
         $password = $_POST['new_passwd'];
         $email = $_POST['new_mail'];
         $isCommissioner = isset($_POST['is_commissioner']);
         $league = $_POST['new_league'];
         self::submitForm($username, $password, $email, $isCommissioner, $league);
         return true;
     }
     if ($form == "forgot") {
         if (isset($_POST['new_name'])) {
             $username = $_POST['new_name'];
             self::forgotsubmitForm($username);
         } else {
             print "<html><body>";
             print Registration::forgotform();
             print "</body></html>";
         }
     }
     if ($form == "activate") {
         if (!isset($_SESSION['coach_id'])) {
             print "You must be logged in to use this page.";
             return false;
         }
         if (!isset($_POST['activate_name'])) {
             print "<html><body>";
             print Registration::activateform();
             print "</body></html>";
         } else {
             $coachToActivate = Coach::getByName($_POST['activate_name']);
             $myCoach = new Coach($_SESSION['coach_id']);
             if (!$myCoach->mayManageObj(T_OBJ_COACH, $coachToActivate->coach_id)) {
                 print "You must be an administrator to access this page.";
                 return;
             }
             $username = $_POST['activate_name'];
             self::activatesubmitForm($username);
         }
     } else {
         print "<html><body>";
         print Registration::form();
         print "</body></html>";
     }
 }
예제 #7
0
 public static function nodeList($node, $nameid, $filter = array(), $disCond = array(), $opts = array())
 {
     global $coach, $lng;
     // Inputs
     $selected_id = isset($opts['sel_id']) ? $opts['sel_id'] : null;
     $extra_tags = isset($opts['extra_tags']) ? $opts['extra_tags'] : array();
     $allow_all = isset($opts['allow_all']) && $opts['allow_all'];
     $hide_empty = isset($opts['hide_empty']) ? $opts['hide_empty'] : array();
     $empty_str = isset($opts['empty_str']) ? $opts['empty_str'] : array();
     # e.g. "%name (EMPTY)" where %name will be substituted like $DISSTR
     $init_option = isset($opts['init_option']) ? $opts['init_option'] : false;
     # Default empty strings
     foreach ($empty_str as $idx => $str) {
         if (empty($str)) {
             # If $emprty_str = array(T_NODE_* => ''); then we convert it to the below.
             $empty_str[$idx] = strtoupper($lng->getTrn('common/empty')) . ' &mdash; %name';
         }
     }
     // Preprocessing
     $additionalFields = array();
     # Init filters to empty if not set
     foreach (array(T_NODE_LEAGUE, T_NODE_DIVISION, T_NODE_TOURNAMENT) as $n) {
         if (!isset($filter[$n])) {
             $filter[$n] = array();
         }
     }
     # "OTHER" filters may contain non-node field (ie. membership fields): ring
     $OTHER_FILTER = isset($filter['OTHER']) ? $filter['OTHER'] : array();
     unset($filter['OTHER']);
     # Don't pass to allowedNodeAccess() - add to $filter again later...
     foreach ($filter as $n => $filters) {
         $_filter_keys = array_keys($filters);
         # Recombine for allowedNodeAccess() => the returned fields from allowedNodeAccess() the same names as the keys from $filters.
         $additionalFields[$n] = empty($_filter_keys) ? array() : array_combine($_filter_keys, $_filter_keys);
         # Don't rereference the field names, make them the same.
     }
     $DISSTR = isset($disCond['DISSTR']) ? $disCond['DISSTR'] : '';
     unset($disCond['DISSTR']);
     $_filter_keys = array_keys($disCond);
     $disCond2 = empty($_filter_keys) ? array() : array_combine($_filter_keys, $_filter_keys);
     # Don't rereference the field names, make them the same.
     $additionalFields[$node] = array_merge($additionalFields[$node], $disCond2);
     $leagues = Coach::allowedNodeAccess(Coach::NODE_STRUCT__TREE, is_object($coach) ? $coach->coach_id : false, $additionalFields);
     # This needs only to be added to the league node filter, since it's always evaluated independant of the $node value.
     $filter[T_NODE_LEAGUE] = array_merge($filter[T_NODE_LEAGUE], $OTHER_FILTER);
     #    print_r($leagues);'
     # Mark nodse to hide in their desc element
     foreach ($leagues as $lid => $divs) {
         # I.e. only the 'desc' element exists => no divs in league
         $leagues[$lid]['desc']['_empty'] = $empty = count($divs) == 1;
         $leagues[$lid]['desc']['_hide'] = $empty && in_array(T_NODE_LEAGUE, $hide_empty);
         foreach ($divs as $did => $tours) {
             if ($did == 'desc') {
                 continue;
             }
             # I.e. only the 'desc' element exists => no tours in division
             $leagues[$lid][$did]['desc']['_empty'] = $empty = count($tours) == 1;
             $leagues[$lid][$did]['desc']['_hide'] = $empty && in_array(T_NODE_DIVISION, $hide_empty);
         }
     }
     // Done preprocessing...
     $NL = '';
     $NL .= "<select name='{$nameid}' id='{$nameid}' " . implode(' ', $extra_tags) . ">\n";
     if ($init_option) {
         $NL .= $init_option;
     }
     switch ($node) {
         case T_NODE_TOURNAMENT:
             foreach ($leagues as $lid => $divs) {
                 if (!self::_nodeList_filter($filter[T_NODE_LEAGUE], $divs['desc']) || $divs['desc']['_hide']) {
                     continue;
                 }
                 $optname = self::quoteEsc($divs['desc']['lname']);
                 if ($divs['desc']['_empty'] && isset($empty_str[T_NODE_LEAGUE])) {
                     $optname = str_replace('%name', $optname, $empty_str[T_NODE_LEAGUE]);
                 }
                 $NL .= "<optgroup class='leagues' label='{$optname}'>\n";
                 foreach ($divs as $did => $tours) {
                     if (!is_numeric($did)) {
                         continue;
                     }
                     # skip "desc" entry for division
                     if (!self::_nodeList_filter($filter[T_NODE_DIVISION], $tours['desc']) || $tours['desc']['_hide']) {
                         continue;
                     }
                     $optname = self::quoteEsc($tours['desc']['dname']);
                     if ($tours['desc']['_empty'] && isset($empty_str[T_NODE_DIVISION])) {
                         $optname = str_replace('%name', $optname, $empty_str[T_NODE_DIVISION]);
                     }
                     $NL .= "<optgroup class='divisions' style='padding-left: 1em;' label='{$optname}'>\n";
                     foreach ($tours as $trid => $desc) {
                         if (!is_numeric($trid)) {
                             continue;
                         }
                         # skip "desc" entry for division
                         if (!self::_nodeList_filter($filter[T_NODE_TOURNAMENT], $desc['desc'])) {
                             continue;
                         }
                         $dis = false;
                         foreach ($disCond as $key => $val) {
                             if ($desc['desc'][$key] == $val) {
                                 $dis = true;
                                 break;
                             }
                         }
                         $name = self::quoteEsc($desc['desc']['tname']);
                         $NL .= "<option " . ($dis ? 'DISABLED' : '') . " style='background-color: white; margin-left: -1em;' value='{$trid}' " . ($selected_id == $trid ? 'SELECTED' : '') . ">" . ($dis ? str_replace('%name', $name, $DISSTR) : $name) . "</option>\n";
                     }
                     $NL .= "</optgroup>\n";
                 }
                 $NL .= "</optgroup>\n";
             }
             break;
         case T_NODE_DIVISION:
             foreach ($leagues as $lid => $divs) {
                 if (!self::_nodeList_filter($filter[T_NODE_LEAGUE], $divs['desc']) || $divs['desc']['_hide']) {
                     continue;
                 }
                 $optname = self::quoteEsc($divs['desc']['lname']);
                 if ($divs['desc']['_empty'] && isset($empty_str[T_NODE_LEAGUE])) {
                     $optname = str_replace('%name', $optname, $empty_str[T_NODE_LEAGUE]);
                 }
                 $NL .= "<optgroup class='leagues' label='{$optname}'>\n";
                 foreach ($divs as $did => $tours) {
                     if (!is_numeric($did)) {
                         continue;
                     }
                     # skip "desc" entry for division
                     if (!self::_nodeList_filter($filter[T_NODE_DIVISION], $tours['desc'])) {
                         continue;
                     }
                     $dis = false;
                     foreach ($disCond as $key => $val) {
                         if ($tours['desc'][$key] == $val) {
                             $dis = true;
                             break;
                         }
                     }
                     $name = self::quoteEsc($tours['desc']['dname']);
                     if ($dis) {
                         $name = str_replace('%name', $name, $DISSTR);
                     }
                     if ($tours['desc']['_empty'] && isset($empty_str[T_NODE_DIVISION])) {
                         $name = str_replace('%name', $name, $empty_str[T_NODE_DIVISION]);
                     }
                     $NL .= "<option " . ($dis ? 'DISABLED' : '') . " style='background-color: white;' value='{$did}' " . ($selected_id == $did ? 'SELECTED' : '') . ">{$name}</option>\n";
                 }
                 $NL .= "</optgroup>\n";
             }
             break;
         case T_NODE_LEAGUE:
             if ($allow_all) {
                 $NL .= "<option style='font-weight: bold;' value='" . T_NODE_ALL . "'>-" . $lng->getTrn('common/all') . "-</option>\n";
             }
             foreach ($leagues as $lid => $divs) {
                 if (!self::_nodeList_filter($filter[T_NODE_LEAGUE], $divs['desc'])) {
                     continue;
                 }
                 $dis = false;
                 foreach ($disCond as $key => $val) {
                     if ($divs['desc'][$key] == $val) {
                         $dis = true;
                         break;
                     }
                 }
                 $name = self::quoteEsc($divs['desc']['lname']);
                 if ($dis) {
                     $name = str_replace('%name', $name, $DISSTR);
                 }
                 if ($divs['desc']['_empty'] && isset($empty_str[T_NODE_LEAGUE])) {
                     $name = str_replace('%name', $name, $empty_str[T_NODE_LEAGUE]);
                 }
                 $NL .= "<option " . ($dis ? 'DISABLED' : '') . " value='{$lid}' " . ($selected_id == $lid ? 'SELECTED' : '') . ">{$name}</option>\n";
             }
             break;
     }
     $NL .= "</select>\n";
     return $NL;
 }
예제 #8
0
 public static function create(array $input)
 {
     /**
      * Creates a new coach.
      *
      * Input: name, realname, passwd, mail, phone, ring, settings, def_leagues (array of LIDs)
      **/
     global $settings;
     if (empty($input['name']) || empty($input['passwd']) || get_alt_col('coaches', 'name', $input['name'], 'coach_id') || !in_array($input['ring'], self::$RINGS[self::T_RING_GROUP_GLOBAL])) {
         return false;
     }
     $query = "INSERT INTO coaches (name, realname, passwd, mail, phone, ring, settings) \r\n                    VALUES ('" . mysql_real_escape_string($input['name']) . "',\r\n                            '" . mysql_real_escape_string($input['realname']) . "', \r\n                            '" . md5($input['passwd']) . "', \r\n                            '" . mysql_real_escape_string($input['mail']) . "', \r\n                            '" . mysql_real_escape_string($input['phone']) . "', \r\n                            " . $input['ring'] . ",\r\n                            '" . array_strpack_assoc('%k=%v', $input['settings'], ',') . "')";
     if (($status = mysql_query($query)) && is_numeric($cid = mysql_insert_id())) {
         // Set default memberships
         $newCoach = new Coach($cid);
         foreach (array_merge($settings['default_leagues'], $input['def_leagues']) as $lid) {
             $status &= $newCoach->setRing(self::T_RING_GROUP_LOCAL, self::T_RING_LOCAL_REGULAR, $lid);
         }
     }
     return $status ? $cid : false;
 }
예제 #9
0
<?php

require "header.php";
if (!Coach::isLoggedIn()) {
    die("You must be logged into OBBLM to use this webservice.");
}
$action = $_REQUEST["action"];
if ($action == "update") {
    $match = new Match($_POST["match_id"]);
    $match->update(array('submitter_id' => (int) $_SESSION['coach_id'], 'stadium' => (int) $_POST['stadium'], 'gate' => (int) $_POST['gate'] * 1000, 'fans' => (int) $_POST['fans'], 'ffactor1' => (int) $_POST['ff1'], 'ffactor2' => (int) $_POST['ff2'], 'income1' => (int) $_POST['inc1'] * 1000, 'income2' => (int) $_POST['inc2'] * 1000, 'team1_score' => (int) $_POST['result1'], 'team2_score' => (int) $_POST['result2'], 'smp1' => (int) $_POST['smp1'], 'smp2' => (int) $_POST['smp2'], 'tcas1' => (int) $_POST['tcas1'], 'tcas2' => (int) $_POST['tcas2'], 'fame1' => (int) $_POST['fame1'], 'fame2' => (int) $_POST['fame2'], 'tv1' => (int) $_POST['tv1'] * 1000, 'tv2' => (int) $_POST['tv2'] * 1000));
    $team = new Team($_POST["team_id"]);
    foreach ($team->getPlayers() as $player) {
        if (!Match::player_validation($player, $match)) {
            continue;
        }
        // We create zero entries for MNG player(s). This is required!
        $pid = $player->player_id;
        if ($player->getStatus($match->match_id) == MNG) {
            $_POST["mvp_{$pid}"] = 0;
            $_POST["cp_{$pid}"] = 0;
            $_POST["td_{$pid}"] = 0;
            $_POST["intcpt_{$pid}"] = 0;
            $_POST["bh_{$pid}"] = 0;
            $_POST["si_{$pid}"] = 0;
            $_POST["ki_{$pid}"] = 0;
            $_POST["ir1_d1_{$pid}"] = 0;
            $_POST["ir1_d2_{$pid}"] = 0;
            $_POST["ir2_d1_{$pid}"] = 0;
            $_POST["ir2_d2_{$pid}"] = 0;
            $_POST["ir3_d1_{$pid}"] = 0;
            $_POST["ir3_d2_{$pid}"] = 0;
예제 #10
0
파일: mysql.php 프로젝트: rythos42/naflm
function setup_database()
{
    global $core_tables;
    $conn = mysql_up();
    require_once 'lib/class_sqlcore.php';
    // Create core tables.
    echo "<b>Creating core tables...</b><br>\n";
    foreach ($core_tables as $tblName => $def) {
        echo Table::createTable($tblName, $def) ? "<font color='green'>OK &mdash; {$tblName}</font><br>\n" : "<font color='red'>FAILED &mdash; {$tblName}</font><br>\n";
    }
    // Create tables used by modules.
    echo "<b>Creating module tables...</b><br>\n";
    foreach (Module::createAllRequiredTables() as $module => $tables) {
        foreach ($tables as $name => $tblStat) {
            echo $tblStat ? "<font color='green'>OK &mdash; {$name}</font><br>\n" : "<font color='red'>FAILED &mdash; {$name}</font><br>\n";
        }
    }
    echo "<b>Other tasks...</b><br>\n";
    echo SQLCore::syncGameData() ? "<font color='green'>OK &mdash; Synchronize game data with database</font><br>\n" : "<font color='red'>FAILED &mdash; Error whilst synchronizing game data with database</font><br>\n";
    echo SQLCore::installTableIndexes() ? "<font color='green'>OK &mdash; applied table indexes</font><br>\n" : "<font color='red'>FAILED &mdash; could not apply one more more table indexes</font><br>\n";
    echo SQLCore::installProcsAndFuncs(true) ? "<font color='green'>OK &mdash; created MySQL functions/procedures</font><br>\n" : "<font color='red'>FAILED &mdash; could not create MySQL functions/procedures</font><br>\n";
    // Create root user and leave welcome message on messageboard
    global $rootpass;
    $rootpass = isset($rootpass) ? $rootpass : '******';
    echo Coach::create(array('name' => 'root', 'realname' => 'root', 'passwd' => $rootpass, 'ring' => Coach::T_RING_GLOBAL_ADMIN, 'mail' => '', 'phone' => '', 'settings' => array(), 'def_leagues' => array())) ? "<font color=green>OK &mdash; root user created.</font><br>\n" : "<font color=red>FAILED &mdash; root user was not created.</font><br>\n";
    Message::create(array('f_coach_id' => 1, 'f_lid' => Message::T_BROADCAST, 'title' => 'OBBLM installed!', 'msg' => 'Congratulations! You have successfully installed Online Blood Bowl League Manager. See "about" and "introduction" for more information.'));
    // Done!
    mysql_close($conn);
    return true;
}
예제 #11
0
                for (var i=0; i<rs.length; i++){
                     if (rs.options[i].value == tdata[trid]["rs"]){
                        rs.selectedIndex = i;
                        break;
                     }
                }
                var types = document.getElementById("tourtype").parentNode; // Must access radio objects in the way
                var TT_FFA = ' . TT_FFA . ';
                var is_FFA = (TT_FFA == tdata[trid]["type"]);
                types.tourtype[0].checked = is_FFA;
                types.tourtype[1].checked = !is_FFA;
                document.getElementById("locked").checked = tdata[trid]["locked"] == 0 ? false : true;
                document.getElementById("allow_sched").checked = tdata[trid]["allow_sched"] == 0 ? false : true;
            }
            </script>';
    list(, , $tdata) = Coach::allowedNodeAccess(Coach::NODE_STRUCT__FLAT, null, array(T_NODE_TOURNAMENT => array('rs' => 'rs', 'type' => 'type', 'locked' => 'locked', 'allow_sched' => 'allow_sched')));
    $easyconvert = new array_to_js();
    @$easyconvert->add_array($tdata, 'tdata');
    echo $easyconvert->output_all();
    echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid', array('OTHER' => array('ring' => Coach::T_RING_LOCAL_ADMIN)), array(), array('extra_tags' => array('onChange="adminModTour(this.options[this.selectedIndex].value);"'), 'empty_str' => array(T_NODE_DIVISION => '')));
    ?>
            <br><br>
            Name<br>
            <input type="text" id='name' name="name"><br><br>
            Ranking system &mdash; <?php 
    echo $lng->getTrn('admin/prefixes');
    ?>
<br>
            <select id='rs' name='rs'>
            <?php 
    global $hrs;
예제 #12
0
파일: sections.php 프로젝트: rythos42/naflm
function sec_login()
{
    global $lng, $settings;
    $_URL_forgotpass = "******";
    if (isset($_GET['forgotpass'])) {
        if (!isset($_POST['_retry'])) {
            title($lng->getTrn('login/forgotpass'));
        }
        if (isset($_GET['cid']) && isset($_GET['activation_code'])) {
            $c = new Coach((int) $_GET['cid']);
            status($new_passwd = $c->confirmActivation($_GET['activation_code']));
            echo "<br><br>";
            echo $lng->getTrn('login/temppasswd') . " <b>{$new_passwd}</b><br>\n";
            echo '<a href="' . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $_GET['cid'], false, false) . '&amp;subsec=profile">' . $lng->getTrn('login/setnewpasswd') . '.</a>';
        } else {
            if (isset($_POST['coach_AC']) && isset($_POST['email'])) {
                $cid = get_alt_col('coaches', 'name', $_POST['coach_AC'], 'coach_id');
                $c = new Coach($cid);
                $correct_user = $c->mail == $_POST['email'];
                status($correct_user, $correct_user ? '' : $lng->getTrn('login/mismatch'));
                if ($correct_user) {
                    $c->requestPasswdReset();
                    echo "<br><br>";
                    echo $lng->getTrn('login/resetpasswdmail') . '.';
                } else {
                    // Return to same page.
                    unset($_POST['coach']);
                    unset($_POST['email']);
                    $_POST['_retry'] = true;
                    sec_login();
                }
            } else {
                ?>
            <div class='boxCommon'>
                <h3 class='boxTitle<?php 
                echo T_HTMLBOX_COACH;
                ?>
'><?php 
                echo $lng->getTrn('login/forgotpass');
                ?>
</h3>
                <div class='boxBody'>
                <form method="POST" action="<?php 
                echo $_URL_forgotpass;
                ?>
">
                    <?php 
                echo $lng->getTrn('login/loginname');
                ?>
<br>
                    <input type="text" name="coach_AC" size="20" maxlength="50">
                    <br><br>
                    Email<br>
                    <input type="text" name="email" size="20" maxlength="50">
                    <br><br>
                    <input type="submit" name="reqAC" value="<?php 
                echo $lng->getTrn('common/submit');
                ?>
">
                </form>
                </div>
            </div>
            <?php 
            }
        }
    } else {
        title($lng->getTrn('menu/login'));
        ?>
        <div class='boxCommon'>
            <h3 class='boxTitle<?php 
        echo T_HTMLBOX_COACH;
        ?>
'><?php 
        echo $lng->getTrn('menu/login');
        ?>
</h3>
            <div class='boxBody'>
            <form method="POST" action="<?php 
        echo getFormAction('');
        ?>
">
                <?php 
        echo $lng->getTrn('login/loginname');
        ?>
<br>
                <input type="text" name="coach" size="20" maxlength="50"><br><br>
                <?php 
        echo $lng->getTrn('login/passwd');
        ?>
<br>
                <input type="password" name="passwd" size="20" maxlength="50">
                <div style='display: none;'><input type='text' name='hackForHittingEnterToLogin' size='1'></div>
                <br><br>
                <?php 
        echo $lng->getTrn('login/remember');
        ?>
                <input type='checkbox' name='remember' value='1'>
                <br><br>
                <input type="submit" name="login" value="<?php 
        echo $lng->getTrn('login/loginbutton');
        ?>
">
            </form>
            <br><br>
            <?php 
        if (!Mobile::isMobile()) {
            if (Module::isRegistered('Registration') && $settings['allow_registration']) {
                echo "<a href='handler.php?type=registration'><b>Register</b></a>";
            }
            echo "<br><br>";
            echo "<a href='{$_URL_forgotpass}'><b>" . $lng->getTrn('login/forgotpass') . '</b></a>';
        }
        ?>
            </div>
        </div>
        <?php 
    }
}
예제 #13
0
            foreach ($errors as $msg => $halt) {
                if ($halt) {
                    status(false, $msg);
                    break 2;
                }
            }
            status($c->setPasswd($_POST['passwd']));
            break;
        case 'disp_access_levels':
            status(true);
            # Display the access levels in box below.
            $_SHOW_ACCESS_LEVELS = true;
            break;
    }
    // Reload manage state.
    $coach = new Coach($coach->coach_id);
    # Re-load in case of we changed our OWN (logged on coach) settings.
}
title($lng->getTrn('menu/admin_menu/usr_man'));
$T_GLOBAL_RINGS = array(Coach::T_RING_GLOBAL_ADMIN => 'Global commissioner (site admin)', Coach::T_RING_GLOBAL_NONE => 'No global rights (regular coach)');
$T_LOCAL_RINGS = array(Coach::T_RING_LOCAL_ADMIN => 'Local commissioner', Coach::T_RING_LOCAL_REGULAR => 'Regular coach');
?>
<script>
    $(document).ready(function(){
        var options, a1,a2,a3,a4;
        options = { minChars:2, serviceUrl:'handler.php?type=autocomplete&obj=<?php 
echo T_OBJ_COACH;
?>
' };
        a1 = $('#coach1').autocomplete(options);
        a2 = $('#coach2').autocomplete(options);
예제 #14
0
 public function AdminEmails()
 {
     $email = $this->email_admin;
     $sep_comma = "";
     if ($email) {
         $sep_comma = ", ";
     }
     $coaches = Coach::getCoaches();
     foreach ($coaches as $c) {
         if ($c->ring === Coach::T_RING_GLOBAL_ADMIN && $this->chk_email_Admin($c->mail)) {
             $email = $email . $sep_comma . $c->mail;
             if ($email) {
                 $sep_comma = ", ";
             }
         }
     }
     return $email;
 }
예제 #15
0
파일: index.php 프로젝트: rythos42/naflm
        $_POST['coach'] = stripslashes($_POST['coach']);
        $_POST['passwd'] = stripslashes($_POST['passwd']);
    }
    if (!Coach::login($_POST['coach'], $_POST['passwd'], isset($_POST['remember']))) {
        $_GET['section'] = 'login';
    }
}
$isMobile = isset($_GET['mobile']) ? $_GET['mobile'] == '1' : false;
// Logout?
if ($_VISSTATE['POST_OUT'] = isset($_GET['logout'])) {
    $_GET['section'] = 'main';
    # Redirect logged out users to the main page.
    Coach::logout();
}
Mobile::setIsMobile($isMobile);
if ($isMobile && !Coach::isLoggedIn()) {
    // Redirect logged out mobile users to login
    $_GET['section'] = 'login';
}
if ($_VISSTATE['COOCKIE'] || $_VISSTATE['POST_IN'] || $_VISSTATE['POST_OUT']) {
    setupGlobalVars(T_SETUP_GLOBAL_VARS__POST_COACH_LOGINOUT);
}
if (Mobile::isMobile()) {
    HTMLOUT::mobile_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;
예제 #16
0
    public static function newTeam($cid)
    {
        global $lng, $coach, $raceididx, $leagues, $rules, $divisions;
        self::handlePost($cid);
        // Show new team form.
        $easyconvert = new array_to_js();
        $races = self::getRaceArray();
        @$easyconvert->add_array($races, 'races');
        echo $easyconvert->output_all();
        // txt constants to show later
        $txtNoInduce = $lng->getTrn('noInduce', 'TeamCreator');
        $txtNoTeamName = $lng->getTrn('noTeamName', 'TeamCreator');
        $txtTooFewPlayers = $lng->getTrn('tooFewPlayers', 'TeamCreator');
        $txtRaceSelectTitle = $lng->getTrn('race', 'TeamCreator');
        $txtRaceSelectOption = $lng->getTrn('raceDefaultOption', 'TeamCreator');
        $txtTeamName = $lng->getTrn('teamName', 'TeamCreator');
        $txtNoRaceSelected = $lng->getTrn('noRaceSelected', 'TeamCreator');
        $txtCreateBtn = $lng->getTrn('createBtn', 'TeamCreator');
        // The page builds itself dynamically based on the selected race
        echo <<<EOQ
   <script type="text/javascript">

   function setIndex(elem, value) {
      document.getElementById(elem).selectedIndex = value;
   }

   function getValue(elemId) {
      try {
         var elem = document.getElementById(elemId);
         return elem.options[elem.selectedIndex].value;
      } catch (err) {
         return "";
      }
   }

   function getText(elemId) {
      try {
         if(document.all){
            return document.getElementById(elemId).innerText;
         } else {
            return document.getElementById(elemId).textContent;
         }
      } catch (err) {
         return "";
      }
   }

   function addCellToRow(rowObj, cellValue, colspan) {
      var cell = rowObj.insertCell(rowObj.cells.length);
      if (colspan > 1) {
         cell.colSpan=colspan;
         cell.align="right";
         cell.innerHTML = cellValue + "&nbsp;&nbsp;";;
        } else {
         cell.innerHTML = cellValue;
        }
      return cell;
   }

   function makeInput(type, id, value) {
      return "<input type=\\"" + type + "\\" id=\\"" + id + "\\" name=\\"" + id + "\\" value=\\"" + value+ "\\" />";
   }

   function setText(element, text) {
      if(document.all){
           document.getElementById(element).innerText = text;
      } else{
          document.getElementById(element).textContent = text;
      }
   }


   function updateQty(id, type, newQty) {
      var race = races[document.getElementById("rid").value];
      if (type == 'p') {
         var players = race['players'];
      } else {
         var players = race['others'];
      }
      var player = players[id];
      var divS = 'sub' + type + id;
      var newCost = player['cost'] * newQty;
      setText(divS, newCost);
      updateTotal();
   }

   function makeSelect(id, type, max) {
      var str = "<select id=\\"qty" + type + id + "\\" name=\\"qty" + type + id + "\\" onchange=\\"updateQty(" + id + ", '" + type + "', this.options[this.selectedIndex].value)\\">";
      for (var i = 0; i <= max; i++) {
         str += "<option value=\\"" + i + "\\">" + i + "</option>";
      }
      str += "</select>";
      return str;
   }

   function changeInduce(check) {
      var oldInduce = document.getElementById('oldInduce');
      if (check != new Boolean(oldInduce.checked)) {
         oldInduce.checked = check;
         var race = races[document.getElementById("rid").value];
         var pCounts = new Array();
         var oCounts = new Array();
         for (var i=0; i < race["player_count"]; i++) {
            pCounts[i] = getValue('qtyp' + i);
         }
         for (i=0; i < race["other_count"]; i++) {
            oCounts[i] = getValue('qtyo' + i);
         }
         changeRace(getValue("rid"));
         for (var i=0; i < race["player_count"]; i++) {
            if (pCounts[i] > 0) {
               try {
                  setIndex('qtyp' + i, pCounts[i]);
                  updateQty(i, 'p', pCounts[i]);
               } catch (err) {
               }
            }
         }
         for (i=0; i < race["other_count"]; i++) {
            if (oCounts[i] > 0) {
               try {
                  setIndex('qtyo' + i, oCounts[i]);
                  updateQty(i, 'o', oCounts[i]);
               } catch (err) {
               }
            }
         }
      }
   }

   function changeRace(raceId) {
      if (raceId < 0) return;
      var oFormObject = document.forms['form_team'];
      var race = races[raceId];
      var players = race["players"];
      var others = race["others"];
      var i;
      var rowIdx;
      var table = document.getElementById('teamTable');
      var induce = document.getElementById('induce').checked;
      while (table.rows.length > 1) {
         table.deleteRow(1);
      }
      setText("pcnt", "0");
      setText("total", "0");
      document.getElementById("raceid").value = race.rid;

      rowIdx = 0;
      for (i = 0; i < race["player_count"]; i++) {
         var player = players[i];
         if (!induce && player['ind']) {
            continue;
         }
         rowIdx++;
         var row = table.insertRow(rowIdx);
         addCellToRow(row, player["position"], 1);
         addCellToRow(row, player["ma"], 1);
         addCellToRow(row, player["st"], 1);
         addCellToRow(row, player["ag"], 1);
         addCellToRow(row, player["av"], 1);
         addCellToRow(row, player["skills"], 1);
         addCellToRow(row, player["N"], 1);
         addCellToRow(row, player["D"], 1);
         addCellToRow(row, player["cost"], 1);
         addCellToRow(row, makeInput('hidden', 'pid' + i, player["id"]) + makeSelect(i, 'p', player["max"]), 1);
         addCellToRow(row, "<div id=\\"subp" + i + "\\"></div>", 1);
      }
      for (i = 0; i < race["other_count"]; i++) {
         var other = others[i];
         if (!induce && other['ind']) {
            continue;
         }
         rowIdx++;
         var row = table.insertRow(rowIdx);
         addCellToRow(row, other["name"], 8);
         addCellToRow(row, other["cost"], 1);
         addCellToRow(row, makeInput('hidden', 'oid' + i, other["name"]) + makeSelect(i, 'o', other["max"]), 1);
         addCellToRow(row, "<div id=\\"subo" + i + "\\"></div>", 1);
      }
      try {
         if(induce) {
            document.getElementById("createBtnTxt").title="{$txtNoInduce}";
            document.getElementById("createBtn").disabled="disabled";
         } else {
            document.getElementById("createBtnTxt").title="";
            document.getElementById("createBtn").disabled="";
         }
      } catch (err) {
         // ignore - probably not logged in
      }
   }

   function updateTotal() {
      var race = races[getValue("rid")];
      var playerCount = race['player_count'];

      var pCount = 0;
      var total = 0;
      var subTot = 0;

      for (var i=0; i < playerCount; i++) {
         pCount += new Number(getValue('qtyp' + i));
         subTot = getText('subp' + i);
         if (!isNaN(subTot)) {
            total +=  new Number(subTot);
         }
      }
      setText("pcnt", pCount);
      for (var i=0; i < race['other_count']; i++) {
         subTot = getText('subo' + i);
         if (!isNaN(subTot)) {
            total +=  new Number(subTot);
         }
      }
      setText("total",total);
   }

   function createTeam() {
      var oForm = document.forms['form_team'];
      var spend = new Number(getText("total"));
      var pCount = new Number(getText("pcnt"));
      var tName = document.getElementById("tname").value;
      var submit = true;

      if (submit && tName.length == 0) {
         alert('{$txtNoTeamName}');
         submit = false;
      }

      if (submit && pCount < 11) {
         alert('{$txtTooFewPlayers}');
         submit = false;
      }

      if (submit) {
         oForm.submit();
      }

   }

   </script>
   <form method="POST" id="form_team">
   <input type="hidden" id="action" name="action" value="create" />
   <input type="hidden" id="raceid" name="raceid" value="" />
   <div class='boxWide'>
      <table class="common"><tr><td>
      <b>{$txtRaceSelectTitle}</b>: <select id="rid" name="rid" onchange="changeRace(this.options[this.selectedIndex].value)">
EOQ;
        echo "<option value='-1'>{$txtRaceSelectOption}</option>";
        $i = 0;
        foreach ($raceididx as $rname) {
            $translatedRaceName = $lng->getTrn('race/' . strtolower(str_replace(' ', '', $rname)));
            echo "<option value='{$i}'>{$translatedRaceName}</option>";
            $i++;
        }
        echo <<<EOQ
       </select></td>
EOQ;
        if (isset($coach)) {
            $lgeDiv = $lng->getTrn('common/league') . '/' . $lng->getTrn('common/division');
            echo <<<EOQ
      <td align="right"><b>{$txtTeamName}</b>:</td><td><input type="text" id="tname" name="tname" size="20" maxlength="50"></td>
      <td align="right"><b>{$lgeDiv}</b>:</td><td><select name="lid_did" id="lid_did">
EOQ;
            foreach ($leagues = Coach::allowedNodeAccess(Coach::NODE_STRUCT__TREE, $coach->coach_id, array(T_NODE_LEAGUE => array('tie_teams' => 'tie_teams'))) as $lid => $lstruct) {
                if ($lstruct['desc']['tie_teams']) {
                    echo "<OPTGROUP LABEL='" . $lng->getTrn('common/league') . ": " . $lstruct['desc']['lname'] . "'>\n";
                    foreach ($lstruct as $did => $dstruct) {
                        if ($did != 'desc') {
                            echo "<option value='{$lid},{$did}'>" . $lstruct['desc']['lname'] . ": " . $dstruct['desc']['dname'] . "</option>";
                        }
                    }
                    echo "</OPTGROUP>\n";
                } else {
                    echo "<option value='{$lid}'>" . $lstruct['desc']['lname'] . "</option>";
                }
            }
            echo <<<EOQ
      </select></td>
      <td><span id="createBtnTxt" title="{$txtNoRaceSelected}"><button id="createBtn" onclick="createTeam(); return false;" DISABLED>{$txtCreateBtn}</button></td>
EOQ;
        }
        $txtInducements = $lng->getTrn('inducementsCheck', 'TeamCreator');
        $txtPlayerCount = $lng->getTrn('playerCount', 'TeamCreator');
        $txtTotal = $lng->getTrn('total', 'TeamCreator');
        $txtPos = $lng->getTrn('common/pos');
        $txtSkills = $lng->getTrn('common/skills');
        $txtNorm = $lng->getTrn('normal', 'TeamCreator');
        $txtDoub = $lng->getTrn('double', 'TeamCreator');
        $txtDollar = $lng->getTrn('dollar', 'TeamCreator');
        $txtQuantity = $lng->getTrn('quantity', 'TeamCreator');
        $txtSubtotal = $lng->getTrn('subtotal', 'TeamCreator');
        echo <<<EOQ
       <td align="right" id="indTxt">{$txtInducements}:</td>
       <td><input type="checkbox" id="induce" onChange="changeInduce(this.checked)" /><input type="hidden" id="oldInduce" value="false" /></td>
       <td align="right"><b>{$txtPlayerCount}</b>:</td><td><div id="pcnt"></div></td>
       <td align="right"><b>{$txtTotal}</b>:</td><td><div id="total"></div></td>
       </tr></table>
   </div>
   <div class="boxWide">
   <table class="common" id="teamTable">
      <tr class="commonhead">
         <th>{$txtPos}</th>
         <th>MA</th>
         <th>ST</th>
         <th>AG</th>
         <th>Av</th>
         <th>{$txtSkills}</th>
         <th>{$txtNorm}</th>
         <th>{$txtDoub}</th>
         <th>{$txtDollar}</th>
         <th>{$txtQuantity}</th>
         <th>{$txtSubtotal}</th>
      </tr>
   </table>
   </div>
   </form>
EOQ;
    }
예제 #17
0
    private function _CCprofile($ALLOW_EDIT)
    {
        global $lng, $coach, $leagues;
        // Was new password/email request made?
        if (isset($_POST['type']) && $ALLOW_EDIT) {
            if (get_magic_quotes_gpc()) {
                $_POST['new_passwd'] = isset($_POST['new_passwd']) ? stripslashes($_POST['new_passwd']) : '';
                $_POST['new_phone'] = isset($_POST['new_phone']) ? stripslashes($_POST['new_phone']) : '';
                $_POST['new_email'] = isset($_POST['new_email']) ? stripslashes($_POST['new_email']) : '';
                $_POST['new_name'] = isset($_POST['new_name']) ? stripslashes($_POST['new_name']) : '';
                $_POST['new_realname'] = isset($_POST['new_realname']) ? stripslashes($_POST['new_realname']) : '';
            }
            switch ($_POST['type']) {
                case 'chpasswd':
                    status(Coach::checkPasswd($this->coach_id, $_POST['old_passwd']) && $this->setPasswd($_POST['new_passwd']));
                    break;
                case 'chphone':
                    status($this->setPhone($_POST['new_phone']));
                    break;
                case 'chmail':
                    status($this->setMail($_POST['new_email']));
                    break;
                case 'chlogin':
                    status($this->setName($_POST['new_name']));
                    break;
                case 'chname':
                    status($this->setRealName($_POST['new_realname']));
                    break;
                case 'chlang':
                    status($this->setSetting('lang', $_POST['new_lang']));
                    break;
                case 'chhomelid':
                    status(isset($_POST['new_homelid']) && get_alt_col('leagues', 'lid', (int) $_POST['new_homelid'], 'lid') && $this->setSetting('home_lid', $_POST['new_homelid']));
                    break;
                case 'pic':
                    status($_POST['add_del'] == 'add' ? $this->savePic(false) : $this->deletePic());
                    break;
                case 'coachtext':
                    if (get_magic_quotes_gpc()) {
                        $_POST['coachtext'] = stripslashes($_POST['coachtext']);
                    }
                    status($this->saveText($_POST['coachtext']));
                    break;
            }
        }
        // New team and change coach settings.
        echo "<br><br>";
        ?>
    <table class="common"><tr class="commonhead"><td><b><?php 
        echo $lng->getTrn('cc/coach_info');
        ?>
</b></td></tr></table>
    <br>
    <?php 
        echo $lng->getTrn('cc/note_persinfo');
        echo "<br><br>";
        if (is_object($coach) && !$ALLOW_EDIT) {
            # Logged in but not viewing own coach page.
            ?>
        <table>
            <tr>
                <td>ID:</td>
                <td><?php 
            echo $this->coach_id;
            ?>
</td>
            </tr>
            <tr>
                <td>Name (login):</td>
                <td><?php 
            echo $this->name;
            ?>
</td>
            </tr>
            <tr>
                <td>Full name:</td>
                <td><?php 
            echo empty($this->realname) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->realname;
            ?>
</td>
            </tr>
            <tr>
                <td>Phone:</td>
                <td><?php 
            echo empty($this->phone) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->phone;
            ?>
</td>
            </tr>
            <tr>
                <td>Mail:</td>
                <td><?php 
            echo empty($this->mail) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $this->mail;
            ?>
</td>
            </tr>
        </table>
        <br>
        <?php 
        }
        if ($ALLOW_EDIT) {
            ?>
        <table class="common" style="border-spacing:5px; padding:20px;">
            <tr><td colspan='4'>ID: <?php 
            echo $this->coach_id;
            ?>
</td></tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chpasswd');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='password' name='old_passwd' size="20" maxlength="50"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='password' name='new_passwd' size="20" maxlength="50"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chpasswd');
            ?>
"></td>
                <input type='hidden' name='type' value='chpasswd'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chphone');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='text' name='old_phone' readonly value="<?php 
            echo $this->phone;
            ?>
" size="20" maxlength="129"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='text' name='new_phone' size="20" maxlength="25"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chphone');
            ?>
"></td>
                <input type='hidden' name='type' value='chphone'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chmail');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='text' name='old_email' readonly value="<?php 
            echo $this->mail;
            ?>
" size="20" maxlength="129"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='text' name='new_email' size="20" maxlength="129"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chmail');
            ?>
"></td>
                <input type='hidden' name='type' value='chmail'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chlogin');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='text' name='old_name' readonly value="<?php 
            echo $this->name;
            ?>
" size="20" maxlength="50"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='text' name='new_name' size="20" maxlength="50"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chlogin');
            ?>
"></td>
                <input type='hidden' name='type' value='chlogin'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chname');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/old');
            ?>
:<input type='text' name='old_realname' readonly value="<?php 
            echo $this->realname;
            ?>
" size="20" maxlength="50"></td>
                <td><?php 
            echo $lng->getTrn('cc/new');
            ?>
:<input type='text' name='new_realname' size="20" maxlength="50"></td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chname');
            ?>
"></td>
                <input type='hidden' name='type' value='chname'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chlang');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/current');
            ?>
: <?php 
            echo $this->settings['lang'];
            ?>
</td>
                <td>
                    <?php 
            echo $lng->getTrn('cc/new');
            ?>
:
                    <select name='new_lang'>
                        <?php 
            foreach (Translations::$registeredLanguages as $lang) {
                echo "<option value='{$lang}'>{$lang}</option>\n";
            }
            ?>
                    </select>
                </td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chlang');
            ?>
"></td>
                <input type='hidden' name='type' value='chlang'>
                </form>
            </tr>
            <tr>
                <form method="POST">
                <td><?php 
            echo $lng->getTrn('cc/chhomelid');
            ?>
:</td>
                <td><?php 
            echo $lng->getTrn('cc/current');
            ?>
: <?php 
            echo isset($leagues[$this->settings['home_lid']]) ? $leagues[$this->settings['home_lid']]['lname'] : '<i>' . $lng->getTrn('common/none') . '</i>';
            ?>
</td>
                <td>
                    <?php 
            echo $lng->getTrn('cc/new');
            ?>
:
                    <select name='new_homelid'>
                        <?php 
            foreach ($leagues as $lid => $desc) {
                echo "<option value='{$lid}'>{$desc['lname']}</option>\n";
            }
            ?>
                    </select>
                </td>
                <td><input type="submit" name="button" value="<?php 
            echo $lng->getTrn('cc/chhomelid');
            ?>
" <?php 
            echo count($leagues) == 0 ? 'DISABLED' : '';
            ?>
></td>
                <input type='hidden' name='type' value='chhomelid'>
                </form>
            </tr>
        </table>
        <?php 
        }
        ?>

    <table class='common'>
        <tr class='commonhead'>
            <td><b><?php 
        echo $lng->getTrn('cc/photo');
        ?>
</b></td>
            <td><b><?php 
        echo $lng->getTrn('common/about');
        ?>
</b></td>
        </tr>
        <tr>
            <td>
                <?php 
        ImageSubSys::makeBox(IMGTYPE_COACH, $this->coach_id, $ALLOW_EDIT, false);
        ?>
            </td>
            <td valign='top'>
                <?php 
        $txt = $this->getText();
        if (empty($txt)) {
            $txt = $lng->getTrn('common/nobody');
        }
        if ($ALLOW_EDIT) {
            ?>
                    <form method='POST'>
                        <textarea name='coachtext' rows='15' cols='70'><?php 
            echo $txt;
            ?>
</textarea>
                        <br><br>
                        <input type="hidden" name="type" value="coachtext">
                        <input type="submit" name='Save' value="<?php 
            echo $lng->getTrn('common/save');
            ?>
">
                    </form>
                    <?php 
        } else {
            echo '<p>' . fmtprint($txt) . "</p>\n";
        }
        ?>
            </td>
        </tr>
    </table>
    <?php 
    }
예제 #18
0
    public static function tours()
    {
        global $rules, $settings, $lng, $coach;
        title($lng->getTrn('menu/matches_menu/tours'));
        $flist = Coach::allowedNodeAccess(Coach::NODE_STRUCT__TREE, is_object($coach) ? $coach->coach_id : false);
        $tourObjs = array();
        $flist_JShides = array();
        $divsToFoldUp = array();
        // Run through the tours to see which nodes should be hidden.
        $ENABLE_LEAG_HIDING = in_array('league', $settings['tourlist_hide_nodes']);
        $ENABLE_DIV_HIDING = in_array('division', $settings['tourlist_hide_nodes']);
        $ENABLE_TOUR_HIDING = in_array('tournament', $settings['tourlist_hide_nodes']);
        foreach ($flist as $lid => $divs) {
            $HIDE_LEAG = $ENABLE_LEAG_HIDING;
            foreach ($divs as $did => $tours) {
                if ($did == 'desc') {
                    continue;
                }
                $HIDE_DIV = $ENABLE_DIV_HIDING;
                $FOLDUP_DIV = $settings['tourlist_foldup_fin_divs'];
                foreach ($tours as $trid => $desc) {
                    if ($trid == 'desc') {
                        continue;
                    }
                    $tourObjs[$trid] = new Tour($trid);
                    if ($ENABLE_TOUR_HIDING && $tourObjs[$trid]->is_finished) {
                        $flist_JShides[] = "trid_{$trid}";
                    }
                    $HIDE_DIV &= $tourObjs[$trid]->is_finished;
                    $FOLDUP_DIV &= $tourObjs[$trid]->is_finished;
                }
                if ($HIDE_DIV) {
                    $flist_JShides[] = "did_{$did}";
                }
                if ($FOLDUP_DIV) {
                    $divsToFoldUp[] = $did;
                }
                $HIDE_LEAG &= $HIDE_DIV;
            }
            if ($HIDE_LEAG) {
                $flist_JShides[] = "lid_{$lid}";
            }
        }
        // Print show hidden button.
        ?>
    <script language="JavaScript" type="text/javascript">
        function showFullTourList()
        {
            var hidden=[<?php 
        echo array_strpack("'%s'", $flist_JShides, ',');
        ?>
];
            for (var h in hidden) {
                slideToggleFast(hidden[h]+'_head');
                slideToggleFast(hidden[h]+'_cont');
            }
            return;
        }
    </script>
    <?php 
        echo "<a href='javascript:void(0)' onClick='showFullTourList();'>" . $lng->getTrn('matches/tours/showhidden') . "</a><br>";
        // Print fixture list.
        foreach ($flist as $lid => $divs) {
            # Container
            echo "<div id='lid_{$lid}_cont' class='leaguesNCont' style='" . (in_array("lid_{$lid}", $flist_JShides) ? "display:none;" : '') . "'>";
            # Title
            echo "<div class='leagues'><b><a href='javascript:void(0);' onClick=\"slideToggleFast('lid_{$lid}');\">[+/-]</a>&nbsp;" . $flist[$lid]['desc']['lname'] . "</b></div>\n";
            # Body
            echo "<div id='lid_{$lid}'>";
            foreach ($divs as $did => $tours) {
                if ($did == 'desc') {
                    continue;
                }
                # Container
                echo "<div id='did_{$did}_cont' class='divisionsNCont' style='" . (in_array("did_{$did}", $flist_JShides) ? "display:none;" : '') . "'>";
                # Title
                echo "<div class='divisions'><b><a href='javascript:void(0);' onClick=\"slideToggleFast('did_{$did}');\">[+/-]</a>&nbsp;" . $flist[$lid][$did]['desc']['dname'] . "</b></div>";
                # Body
                echo "<div id='did_{$did}' " . (in_array($did, $divsToFoldUp) ? 'style="display:none;"' : '') . ">";
                foreach ($tours as $trid => $desc) {
                    if ($trid == 'desc') {
                        continue;
                    }
                    # Container
                    echo "<div id='trid_{$trid}_cont' class='toursNCont' style='" . (in_array("trid_{$trid}", $flist_JShides) ? "display:none;" : '') . "'>";
                    # Title
                    echo "<div class='tours'><a href='index.php?section=matches&amp;type=tourmatches&amp;trid={$trid}'>" . $flist[$lid][$did][$trid]['desc']['tname'] . "</a>";
                    $tr = $tourObjs[$trid];
                    # We already have loaded these - reuse them!
                    $suffix = '';
                    if ($tr->is_finished) {
                        $suffix .= '-&nbsp;&nbsp;<i>' . $lng->getTrn('common/finished') . '</i>&nbsp;&nbsp;';
                    }
                    if ($tr->locked) {
                        $suffix .= '-&nbsp;&nbsp;<i>' . $lng->getTrn('common/locked') . '</i>&nbsp;&nbsp;';
                    }
                    if (!empty($suffix)) {
                        echo '&nbsp;&nbsp;' . $suffix;
                    }
                    echo "</div>\n";
                    # tour title container
                    echo "</div>\n";
                    # tour container
                }
                echo "</div>\n";
                # div body container
                echo "</div>\n";
                # div container
            }
            echo "</div>\n";
            # league body container
            echo "</div>\n";
            # league container
        }
    }
예제 #19
0
<div class="boxCommon">
    <div class="boxTitle<?php 
echo T_HTMLBOX_ADMIN;
?>
">
        Display coach access levels
    </div>
    <div class="boxBody">
        <form method="POST">
        Coach name<br> <input type="text" name="cname" id="coach3" size="20" maxlength="50"><br><br>
        <?php 
if (is_object($c)) {
    echo "Access levels of '{$c->name}' are<br><br>\n";
    echo "<b>Global</b><br>" . $T_GLOBAL_RINGS[$c->ring] . "<br><br>";
    echo "<b>Local</b><br>";
    list($_leagues) = Coach::allowedNodeAccess(Coach::NODE_STRUCT__FLAT, $c->coach_id);
    if (empty($_leagues)) {
        echo "<i>None</i>";
    } else {
        echo "<table><tr style='font-style:italic;'><td>League</td><td>Access level</td></tr>\n";
        foreach ($_leagues as $lid => $desc) {
            echo "<tr><td>{$desc['lname']}</td><td>" . $T_LOCAL_RINGS[$desc['ring']] . "</td></tr>\n";
        }
        echo "</table>";
    }
}
?>
        <br><br>
        <input type="hidden" name="type" value="disp_access_levels">
        <input type="submit" name="button" value="Display coach's access levels">
        </form>
 public function delete($team, $id)
 {
     $user = Auth::user();
     $coach = Coach::find($id);
     $club = $coach->team->club;
     $team = Team::Find($team);
     $title = 'League Together - ' . $team->club->name . ' Teams';
     return View::make('app.club.coach.delete')->with('page_title', $title)->with('coach', $coach)->with('club', $team->club)->withUser($user);
 }
예제 #21
0
파일: index.php 프로젝트: nicholasmr/obblm
$_VISSTATE['COOCKIE'] = Coach::cookieLogin();
# If not already logged in then check for login-cookie and try to log in using the stored credentials.
if ($_VISSTATE['POST_IN'] = isset($_POST['login'])) {
    if (get_magic_quotes_gpc()) {
        $_POST['coach'] = stripslashes($_POST['coach']);
        $_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;
예제 #22
0
/*include("small_menu_start.php");*/
$mySql = new MySql();
if (isset($_SESSION[Session::C_SESSION_USER])) {
    $session = new Session($_SESSION[Session::C_SESSION_USER], $_SESSION[Session::C_SESSION_PASS], $mySql);
}
if (!isset($session) or !$session->IsConnected()) {
    header('Location: index.php');
    exit;
}
?>
            <!-- MAIN SECTION -->
            <section class="main-section">
                <div class="small-12 columns">
                    <div class="row">
                        <h4>entraîneur - <?php 
$coach = new Coach();
if (isset($_POST["id"])) {
    $coach->initProperty($_POST["id"], $_POST["firstName"], $_POST["lastName"], $_POST["teamId"]);
    $coach->PageMode = $_POST["pageMode"];
    $coach->validate($mySql);
    if (!$coach->getHasError()) {
        if ($coach->PageMode == Constants::PAGE_MODE_EDIT) {
            $coach->update($mySql);
        } else {
            $coach->addNew($mySql);
        }
        header('Location: coach.php');
        exit;
    }
    echo $coach->getFullName();
} else {