Пример #1
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>";
     }
 }
Пример #2
0
    echo T_HTMLBOX_ADMIN;
    ?>
">
            Activate Users
        </div>
        <div class="boxBody">
            <?php 
    $retiredCoaches = Coach::getCoaches('retired = 2');
    if (empty($retiredCoaches)) {
        echo 'No coaches to activate!';
    } else {
        ?>
                    <table>
                        <?php 
        foreach ($retiredCoaches as $retiredCoach) {
            if ($coach->mayManageObj(T_OBJ_COACH, $retiredCoach->coach_id)) {
                ?>
                                    <tr>
                                        <td><?php 
                echo $retiredCoach->name;
                ?>
</td>
                                        <td><?php 
                echo join(', ', $retiredCoach->getLeagues());
                ?>
</td>
                                        <td>
                                            <form method="POST" action="handler.php?type=registration&form=activate">
                                                <input type="hidden" name="activate_name" value="<?php 
                echo $retiredCoach->name;
                ?>