Ejemplo n.º 1
0
function mcm_web_print_table($args)
{
    global $mcm;
    extract($args, EXTR_PREFIX_ALL, 'arg');
    /* 
     * required:
     *
     * $arg_action      - {prev,next} order
     * $arg_start       - query start offset
     * $arg_item_status - {accepted,rejected,undefined}
     * $arg_item_type   - user-defined item type
     *
     */
    $limit = 6;
    /* TODO: set this as a config option */
    $table_cols = 3;
    $start = $arg_start;
    $start = $arg_action == 'next' ? $start + $limit : $start;
    $start = $arg_action == 'prev' ? $start - $limit : $start;
    /* determine number of items available */
    $params = array('user_id' => $mcm['user_id'], 'item_status' => $arg_item_status, 'item_type' => $arg_item_type, 'order' => 'artist_name, album_name, item_quality', 'limit' => "{$start}, {$limit}");
    $items_list = mcm_action('lookup_itemlist', $params);
    $num_items = mcm_action('lookup_itemlist_count', $params);
    if ($num_items == 0) {
        mcm_web_nothing_to_review();
        return;
    }
    ?>
<form method="post" action="<?php 
    echo $mcm['self'];
    ?>
">
<table id="list-and-nav" class="center">
    <tr>
        <td id="nav-left" class="nav">
            <?php 
    print_navigation($start, $limit, $num_items, 'left');
    ?>
        </td>
        
        <td>
            <table id="list">
            <input type="hidden" name="start" value="<?php 
    echo $start;
    ?>
">
            <input type="hidden" name="item_status" value="<?php 
    echo $arg_item_status;
    ?>
">
            <input type="hidden" name="item_type" value="<?php 
    echo $arg_item_type;
    ?>
">
<?php 
    $row_number = 0;
    foreach ($items_list as $id => $row) {
        /* load current item status from db into session */
        if (!isset($_SESSION['status'][$id])) {
            $_SESSION['status'][$id] = $arg_item_status;
        }
        $row_number++;
        $album_dirname = "[{$row['artist_name']}] [{$row['album_name']}] [{$row['item_quality']}]";
        $cover_url = mcm_action('create_cover_url', $album_dirname);
        $playlist_url = create_player($album_dirname);
        echo ($row_number - 1) % $table_cols == 0 ? "       <tr>\n" : "";
        ?>
                    <td class="item" id="id<?php 
        echo $id;
        ?>
-item">
                        <div id="id<?php 
        echo $id;
        ?>
-artist" class="artist"><?php 
        echo $row['artist_name'];
        ?>
</div>
                        <div id="id<?php 
        echo $id;
        ?>
-album" class="album"><?php 
        echo $row['album_name'];
        ?>
</div>
                        <div class="cover-container" onmouseover="if (isMouseLeaveOrEnter(event, this)) showOverlay('id<?php 
        echo $id;
        ?>
')" onmouseout="if (isMouseLeaveOrEnter(event, this)) hideOverlay('id<?php 
        echo $id;
        ?>
')">
                            <a href="#" onmousedown="loadPlaylist('<?php 
        echo $playlist_url;
        ?>
', '<?php 
        echo $cover_url;
        ?>
'); return false;">
                                <img id="id<?php 
        echo $id;
        ?>
-overlay" src="images/overlay.png" class="overlay" alt="">
                                <img id="id<?php 
        echo $id;
        ?>
-cover" src="<?php 
        echo $cover_url;
        ?>
" class="cover<?php 
        print_cover_class($id, $_SESSION['status'][$id]);
        ?>
" alt="album cover" width="150" height="150">
                            </a>
                        </div>
                        <div class="choices">
                            <a href="#" onmousedown="clickRadio('id<?php 
        echo $id;
        ?>
', 'add'); return false;"><img id="id<?php 
        echo $id;
        ?>
-img-add" src="images/add<?php 
        print_button($id, 'accepted');
        ?>
.png" alt="Add" title="Add"></a>
                            <input type="radio" id="id<?php 
        echo $id;
        ?>
-add" name="id<?php 
        echo $id;
        ?>
" value="accepted"<?php 
        print_checkbox($id, 'accepted');
        ?>
>
                            <a href="#" onmousedown="clickRadio('id<?php 
        echo $id;
        ?>
', 'rem'); return false;"><img id="id<?php 
        echo $id;
        ?>
-img-rem" src="images/remove<?php 
        print_button($id, 'rejected');
        ?>
.png" alt="Remove" title="Remove"></a>
                            <input type="radio" id="id<?php 
        echo $id;
        ?>
-rem" name="id<?php 
        echo $id;
        ?>
" value="rejected"<?php 
        print_checkbox($id, 'rejected');
        ?>
>
                            <a href="#" onmousedown="clickRadio('id<?php 
        echo $id;
        ?>
', 'und'); return false;"><img id="id<?php 
        echo $id;
        ?>
-img-und" src="images/undecided<?php 
        print_button($id, 'undefined');
        ?>
.png" alt="Undecided" title="Undecided"></a>
                            <input type="radio" id="id<?php 
        echo $id;
        ?>
-und" name="id<?php 
        echo $id;
        ?>
" value="undefined"<?php 
        print_checkbox($id, 'undefined');
        ?>
>
                        </div>
                    </td>
<?php 
        echo $row_number % $table_cols == 0 ? "       </tr>\n" : "";
    }
    echo $row_number % $table_cols != 0 ? "     </tr>\n" : "";
    ?>
                </tr>
            </table>
        </td>
    
        <td id="nav-right" class="nav">
            <?php 
    print_navigation($start, $limit, $num_items, 'right');
    ?>
        </td>
    </tr>
</table>

<div id="selected-artist"></div>
<div id="selected-album"></div>

<table id="player-table" class="center">
    <tr>
        <td id="player-cover-container">
            <img id="player-cover" src="images/player-cover.png" alt="Album Cover" width="100" height="100">
        </td>
        <td rowspan="2" id="player-meta">
        <div id="player-artist"></div>
        <div id="player-album"></div>
        <div id="player-title"></div>
        <div id="player-next">
            <span id="player-next-label"></span><span id="player-next-title"></span>
        </div>
        </td>
    </tr>
    <tr>
        <td id="player-controls">
            <a href="#" onmousedown="player.sendEvent('PREV'); return false;"><img src="images/rew.png" alt="Rewind" title="Previous Track"></a>
            <a href="#" onmousedown="player.sendEvent('PLAY'); return false;"><img src="images/play-pause.png" alt="Play/Pause" title="Play/Pause"></a>
            <a href="#" onmousedown="player.sendEvent('NEXT'); return false;"><img src="images/fwd.png" alt="Forward" title="Next Track"></a>
        </td>
    </tr>
</table>

<div id="toolbar">
    <a href="#" onclick="alert('Help not implemented. Yet.'); return false;"><img src="images/help.png" title="Help" alt="Help"></a> | 
    <input type="image" src="images/save-exit.png" name="submit" value="finish" title="Save and Exit"> |
    <input type="image" src="images/exit.png" name="submit" value="exit" title="Exit Without Saving" onclick="return confirm('You will lose all current selections!\n\nAre you sure you want to exit without saving?');">
</div>
<p id="player" style="text-align: center;">Media player requires Adobe Flash Player to be installed. <a href="http://www.adobe.com/go/getflashplayer">Download now</a>.</p>

</form>
<?php 
}
Ejemplo n.º 2
0
before_action("check_entry", array("show", "skip", "turn", "daybook", "revert"), array("model_name" => "game"));
before_action("create_form", array("new", "create"), "new_game");
before_action("check_form", array("create"), "new_game");
before_action("create_form", array("show", "turn"), "turn");
before_action("check_form", array("turn"), "turn");
switch ($_GET["action"]) {
    case "index":
        break;
    case "new":
        break;
    case "create":
        define("game", create_game($_POST["identity"]));
        define("turn", -1);
        foreach ($_POST["cards_suspect"] as $suspect => $cards) {
            create_player($suspect, $cards);
        }
        foreach ($_POST["known_cards"] as $card) {
            add_card_owner_status($card, $_POST["identity"], owned);
        }
        foreach (select_suspects() as $player) {
            if (select_cards_player($player["id"]) == 0) {
                foreach (select_cards() as $card) {
                    add_card_owner_status($card["id"], $player["id"], not_owned);
                }
            }
        }
        $game["id"] = game;
        redirect_to_action("show");
        break;
    case "turn":
Ejemplo n.º 3
0
function validate_signup($enteredName, $enteredEmail, $enteredClass, $enteredReferral, $enteredPass)
{
    $successful = false;
    $sql = $GLOBALS['sql'];
    assert($sql);
    $send_name = $enteredName;
    $send_pass = $enteredPass;
    $send_class = $enteredClass;
    $send_email = $enteredEmail;
    $referred_by = $enteredReferral;
    echo "Your responses:<br> Name - {$send_name},<br>\n\t\t Password - " . (isset($send_pass) ? "***yourpassword***" : "NO PASSWORD") . ",<br>\n\t\t Class - {$send_class},<br>\n\t\t Email - {$send_email},<br>\n\t\t Site Referred By - {$referred_by}<br><br>\n";
    //  *** Requirement checking Section  ***
    if ($send_name != "" && $send_pass != "" && $send_email != "" && $send_class != "") {
        //When everything is non-blank.
        $check_name = 0;
        $check_email = 0;
        $sql->QueryItem("SELECT uname FROM players WHERE uname = '{$send_name}'");
        $check_name = $sql->getRowCount();
        $sql->QueryItem("SELECT email FROM players WHERE email = '{$send_email}'");
        $check_email = $sql->getRowCount();
        // Validate the username symbols!
        $username_error = validate_username($send_name);
        if ($username_error) {
            echo $username_error;
        } else {
            //when all the name requirement errors didn't trigger.
            $send_name = trim($send_name);
            // Just cuts off any white space at the end.
            $filter = new Filter();
            $send_name = $filter->toUsername($send_name);
            // Filter any un-whitelisted characters.
            echo "Phase 1 Complete: Name passes requirements.<hr>\n";
            // Validate the password!
            $password_error = validate_password($send_pass);
            if ($password_error) {
                echo $password_error;
            } else {
                $send_pass = trim($send_pass);
                // *** Trims any extra space off of the password.
                $send_pass = $filter->toPassword($send_pass);
                // Filter any un-whitelisted characters.
                echo "Phase 2 Complete: Password passes requirements.<hr>\n";
                if (FALSE) {
                    // CURRENTLY NO BLOCKED EMAIL SERVICES strstr($send_email, "@") == "@aol.com" || strstr($send_email, "@") == "@netscape.com" || strstr($send_email, "@") == "@aim.com"
                    //Throws error if email from blocked domain.
                    echo "Phase 3 Incomplete: We cannot currently accept @aol.com, @netscape.com, or @aim.com email addresses.";
                } elseif (!eregi("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\\.[a-z]{2,4}\$", trim($send_email))) {
                    echo "Phase 3 Incomplete: The email address (" . htmlentities($send_email) . ") \n\t\t\t\t\t    must contain an @ symbol and a domain name to be valid.";
                } else {
                    if ($check_name == 0 && $check_email == 0 && $send_name != "SysMsg" && $send_name != "NewUserList") {
                        //Uses previous query to make sure name and email aren't duplicates.
                        echo "Phase 3 Complete: Username and Email are unique.<br><hr>\n";
                        if ($send_class != 'Red' && $send_class != 'Blue' && $send_class != 'White' && $send_class != 'Black') {
                            echo "Phase 4 Incomplete: No proper class was specified.<br>";
                        } else {
                            echo "Phase 4 Complete: Class was specified.<br><hr>";
                            // *** Signup is successful at this point  ***
                            $preconfirm = 0;
                            $preconfirm = preconfirm_some_emails($send_email);
                            if (!$preconfirm) {
                                /* not blacklisted by, so require a normal email confirmation */
                                echo "Phase 5: When you receive an email from SysMsg,\n\t\t\t\t\t\t\t it will describe how to activate your account.<br><br>\n";
                            }
                            // The preconfirmation message occurs later.
                            $confirm = rand(1000, 9999);
                            //generate confirmation code
                            // Use the function from lib_player
                            $player_params = array('send_email' => $send_email, 'send_pass' => $send_pass, 'send_class' => $send_class, 'preconfirm' => $preconfirm, 'confirm' => $confirm, 'referred_by' => $referred_by);
                            $successful = create_player($send_name, $player_params);
                            // Create the player.
                            if (!$successful) {
                                echo "There was a problem with creating a player account.  Please contact us as below: ";
                            } else {
                                if (!$preconfirm) {
                                    //  *** Continues the page display ***
                                    echo "Confirmation email has been sent to <b>" . $send_email . "</b>.  <br>\n    \t\t\t\t  \t\t\t\t\tBe sure to also check for the email in any \"Junk Mail\" or \"Spam\" folders.\n    \t\t\t\t  \t\t\t\t\tDelivery typically takes less than 15 minutes.";
                                } else {
                                    // Use the confirm function from lib_player.
                                    confirm_player($send_name, false, true);
                                    // name, no confirm #, just autoconfirm.
                                    echo "<p>Account with the login name \"" . $send_name . "\" is now confirmed!  Please login on the login bar of the ninjawars.net page.</p>";
                                }
                                echo "<p>Only one account per person is allowed.</p>";
                            }
                            echo "If you require help use the forums at <a href='" . WEB_ROOT . "forum/'>" . WEB_ROOT . "forum/</a> or email: " . SUPPORT_EMAIL;
                        }
                        // *** End of class checking.
                    } else {
                        // Default, displays when the username or email are not unique.
                        $what = $check_email != 0 ? "Email" : "Username";
                        echo "Phase 3 Incomplete: That {$what} is already in use. Please choose a different one.\n";
                    }
                }
            }
        }
    } else {
        //  ***  Response for when nothing was submitted.  ***
        echo "Phase 1 Incomplete: You did not correctly fill out all the necessary information.\n";
    }
    //This is the final signup return section, which only shows if a successful
    //insert and confirmation number has -not- been acheived.
    echo "<br><br>";
    return $successful;
}