Beispiel #1
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 
    }