示例#1
0
function counterblame($target)
{
    global $countFile;
    // I'M ALLOWED TO USE THEM, ALRIGHT?! YOU'RE NOT MY REAL DAD, YOU CAN'T MAKE ME BE RESTRAINED WHEN IT COMES TO VARIABLE SCOPE
    // Magic random prize draw giver awayer. Every blamer has a one-in-100 chance of winning!
    if (rand(0, 100) < 5) {
        $num = file_get_contents($countFile);
        echo "Congratulations " . $target . "! You are the " . $num . num_suffix($num) . " person to blame! Click here to redeem your prize!";
        return;
    }
    $lolOtherNumber = rand(0, 9);
    switch ($lolOtherNumber) {
        case 1:
            echo $target . " will be bashed at LAN.";
            break;
        case 2:
            echo "/me sets mode [+blame *" . $target . "*@*]";
            break;
        case 3:
            echo "/me sets mode [+b *" . $target . "*@*]";
            break;
        case 4:
            echo $target . " has been counterblamed!";
            break;
        case 5:
            echo "It's all " . $target . "'s fault.";
            break;
        case 6:
            echo "!blame " . $target;
            break;
        default:
            echo do_blame($target);
            break;
    }
}
function create_right_rap($stick)
{
    global $op;
    $name = "--";
    $hrap_link_open = "";
    $hrap_link_close = "";
    $genie = "--";
    $rope = "--";
    $rope_end = "--";
    $knot = "--";
    $eto = "--";
    $comments = "";
    $confirmable = false;
    $confirmed_by = 'blank';
    $headshot_filename = 'images/hrap_headshots/nobody.jpg';
    try {
        $rap = new rappel();
        $rap = $op->get_rappel($stick, 'right');
        $confirmable = $rap->is_confirmable();
        $name = $rap->get('hrap')->get('name');
        $hrap_link_open = "<a href=\"" . $_SERVER['PHP_SELF'] . "?hrap=" . $rap->get('hrap')->id . "\">";
        $hrap_link_close = "</a>";
        $genie = "<a href=\"view_equipment.php?crew=" . $rap->get('genie')->get('crew_affiliation_id') . "&eq_type=genie&eq_id=" . $rap->get('genie')->get('id') . "\">" . strtoupper($rap->get('genie')->get('serial_num')) . "</a>";
        $rope = "<a href=\"view_equipment.php?crew=" . $rap->get('rope')->get('crew_affiliation_id') . "&eq_type=rope&eq_id=" . $rap->get('rope')->get('id') . "\">" . strtoupper($rap->get('rope')->get('serial_num')) . "</a>";
        $rope_end = strtoupper($rap->get('rope_end'));
        $knot = $rap->get('knot') ? 'Yes' : 'No';
        $eto = $rap->get('eto') ? 'Yes' : 'No';
        $comments = $rap->get('comments');
        $headshot_filename = $rap->get('hrap')->get('headshot_filename');
        if ($rap->get('confirmed_by') != false) {
            $confirmed_by = $rap->get('confirmed_by')->get('firstname') . " " . $rap->get('confirmed_by')->get('lastname');
        } else {
            $confirmed_by = 'unconfirmed';
        }
    } catch (Exception $e) {
    }
    //The input string 'stick' should be one of the following: '1', '2' or '3'
    $suffix = "stick" . $stick . "_right";
    if ($confirmed_by == 'blank') {
        $text = "<div class=\"unconfirmed\"></div>\n";
    } elseif ($confirmed_by == 'unconfirmed') {
        if ($confirmable) {
            $text = "<div class=\"unconfirmed\">This rappel is unconfirmed " . "<a href=\"update_rappels.php?op=" . $_GET['op'] . "&function=confirm_rappel&rap_id=" . $rap->get('id') . "\")\"><img src=\"images/check_mark.png\" title=\"Confirm\"></a> | " . "<a href=\"update_rappels.php?op=" . $_GET['op'] . "&function=delete_rappel&rap_id=" . $rap->get('id') . "\")\"><img src=\"images/trash.png\" title=\"Delete\"></a></div>\n";
        } else {
            $text = "<div class=\"unconfirmed\">This rappel is unconfirmed</div>\n";
        }
    } else {
        $text = "<div class=\"confirmed\">Confirmed by <div class=\"name\">" . $confirmed_by . "</div></div>\n";
    }
    $text .= "<table style=\"margin:0 auto 0 0; border:2px dashed #555555; width:200px;\">\n" . "<tr><td style=\"text-align:left;vertical-align:top;\">" . "<h3>" . num_suffix($stick) . " Stick</h3><br>" . $hrap_link_open . "<img src=\"" . $headshot_filename . "\" style=\"border:2px solid #555555; width:75px; height:75px;\">" . $hrap_link_close . "</td>\n" . "<td style=\"text-align:left; vertical-align:top; color:#557799;width:125px;\">\n" . "Name:<div style=\"font-weight:normal; color:#444444;margin:1px 0px 3px 0px;\">" . $hrap_link_open . $name . $hrap_link_close . "</div>\n" . "Genie:<div style=\"font-weight:normal; color:#444444;margin:1px 0px 3px 0px;\">" . $genie . "</div>\n" . "Rope (End):<div style=\"font-weight:normal; color:#444444;margin:1px 0px 3px 0px;\">" . $rope . " (" . $rope_end . ")</div>\n" . "</td></tr>\n\n" . "<tr><td colspan=\"2\" style=\"text-align:left; color:#557799;\">\n" . "<div style=\"float:right; text-align:right; margin-left:5px;\">\n" . "Knot: <span style=\"font-weight:normal; color:#444444;margin:1px 0px 3px 0px;\">" . $knot . "</span><br>\n" . "ETO: <span style=\"font-weight:normal; color:#444444;margin:1px 0px 3px 0px;\">" . $eto . "</span>\n" . "</div>\n" . "Comments:\n" . "<div style=\"font-weight:normal; color:#444444;margin:1px 0px 3px 0px;\">" . $comments . "</div></td></tr>\n" . "</table>\n";
    return $text;
}
function create_right_rap($stick)
{
    global $which_form;
    //The input string 'stick' should be one of the following: '1', '2' or '3'
    $suffix = "stick" . $stick . "_right";
    if ($_SESSION['form_memory'][$which_form][$suffix . '_headshot_filename'] == '') {
        $_SESSION['form_memory'][$which_form][$suffix . '_headshot_filename'] = 'images/hrap_headshots/nobody.jpg';
    }
    $text = "<table style=\"margin:0 auto 0 0; border:2px dashed #555555; width:200px;\">\n" . "<tr><td style=\"text-align:left;vertical-align:top;\">" . "<h3>" . num_suffix($stick) . " Stick</h3><br>" . "<img src=\"" . $_SESSION['form_memory'][$which_form][$suffix . '_headshot_filename'] . "\" id=\"" . $suffix . "_headshot\" name=\"" . $suffix . "_headshot\" style=\"border:2px solid #555555; width:75px; height:75px;\">\n" . "<input type=\"hidden\" id=\"" . $suffix . "_headshot_filename\" name=\"" . $suffix . "_headshot_filename\" value=\"" . $_SESSION['form_memory'][$which_form][$suffix . '_headshot_filename'] . "\"></td>\n" . "<td rowspan=\"2\" style=\"text-align:left; vertical-align:top;\">\n";
    if ($stick > 1) {
        // Add a javascript to the hidden field that will copy the Rope info from the 1st stick into this
        // stick after a rappeller is selected for this stick.
        $text .= "Name:<br><input type=\"text\" name=\"name_" . $suffix . "_text\" id=\"name_" . $suffix . "_text\" value=\"" . $_SESSION['form_memory'][$which_form]['name_' . $suffix . '_text'] . "\" style=\"width:100px;margin-bottom:5px;\" " . "onkeyup=\"javascript:autosuggest('name_" . $suffix . "','hrap_for_rappel');\" onFocus=\"this.select()\" " . "onChange=\"copyRopeFrom1stStick(" . $stick . ",'right');\"><br>\n";
    } else {
        // If this is the 1st stick, omit the javascript to copy rope data.
        $text .= "Name:<br><input type=\"text\" name=\"name_" . $suffix . "_text\" id=\"name_" . $suffix . "_text\" value=\"" . $_SESSION['form_memory'][$which_form]['name_' . $suffix . '_text'] . "\" style=\"width:100px;margin-bottom:5px;\" " . "onkeyup=\"javascript:autosuggest('name_" . $suffix . "','hrap_for_rappel');\" onFocus=\"this.select()\"><br>\n";
    }
    $text .= "<input type=\"hidden\" name=\"name_" . $suffix . "_id\" id=\"name_" . $suffix . "_id\" value=\"" . $_SESSION['form_memory'][$which_form]['name_' . $suffix . '_id'] . "\">\n" . "<div id=\"name_" . $suffix . "_results\" class=\"results\"></div>\n\n" . "Genie:<br><input type=\"text\" name=\"genie_" . $suffix . "_text\" id=\"genie_" . $suffix . "_text\" value=\"" . $_SESSION['form_memory'][$which_form]['genie_' . $suffix . '_text'] . "\" style=\"width:75px;\" " . "onkeyup=\"javascript:autosuggest('genie_" . $suffix . "','genie');\"  onFocus=\"this.select()\" >" . "<input type=\"hidden\" name=\"genie_" . $suffix . "_id\" id=\"genie_" . $suffix . "_id\" value=\"" . $_SESSION['form_memory'][$which_form]['genie_' . $suffix . '_id'] . "\">\n" . "<div id=\"genie_" . $suffix . "_results\" class=\"results\"></div>\n\n" . "Rope:<br><input type=\"text\" name=\"rope_" . $suffix . "_text\" id=\"rope_" . $suffix . "_text\" value=\"" . $_SESSION['form_memory'][$which_form]['rope_' . $suffix . '_text'] . "\" style=\"width:75px;margin-bottom:5px;\" " . "onkeyup=\"javascript:autosuggest('rope_" . $suffix . "','rope');\"  onFocus=\"this.select()\" ><br>\n" . "<input type=\"hidden\" name=\"rope_" . $suffix . "_id\" id=\"rope_" . $suffix . "_id\" value=\"" . $_SESSION['form_memory'][$which_form]['rope_' . $suffix . '_id'] . "\">\n" . "<div id=\"rope_" . $suffix . "_results\" class=\"results\"></div>\n\n" . "Rope End:<br>" . "A<input type=\"radio\" name=\"rope_" . $suffix . "_end\" id=\"rope_" . $suffix . "_end_a\" value=\"a\" ";
    if ($_SESSION['form_memory'][$which_form]['rope_' . $suffix . '_end'] == "a") {
        $text .= "checked";
    }
    $text .= "> &nbsp;" . "B<input type=\"radio\" name=\"rope_" . $suffix . "_end\" id=\"rope_" . $suffix . "_end_b\" value=\"b\" ";
    if ($_SESSION['form_memory'][$which_form]['rope_' . $suffix . '_end'] == "b") {
        $text .= "checked";
    }
    $text .= "></td></tr>\n\n" . "<tr><td style=\"text-align:right;\">\n" . "Knot:<input type=\"checkbox\" name=\"knot_" . $suffix . "\" id=\"knot_" . $suffix . "\" value=\"1\" tabindex=\"-1\" ";
    if ($_SESSION['form_memory'][$which_form]['knot_' . $suffix] == "1") {
        $text .= "checked";
    }
    $text .= "><br>\n" . "ETO:<input type=\"checkbox\" name=\"eto_" . $suffix . "\" id=\"eto_" . $suffix . "\" value=\"1\" tabindex=\"-1\" ";
    if ($_SESSION['form_memory'][$which_form]['eto_' . $suffix] == "1") {
        $text .= "checked";
    }
    $text .= "></td></tr>\n" . "<tr><td colspan=\"2\" style=\"text-align:left;\">\n" . "Comments: <input type=\"text\" name=\"comments_" . $suffix . "\" id=\"comments_" . $suffix . "\" value=\"" . $_SESSION['form_memory'][$which_form]['comments_' . $suffix] . "\" tabindex=\"-1\" style=\"width:99%\"></td></tr>\n" . "</table>\n";
    return $text;
}