/** * For the given task display the form, and run the task if data entered from the corresponding form * * @param string $actionName The code-name for the desired task */ public function process($actionName) { global $Misc; // TODO: Use late static binding for this instead of INBOARD detection extract($this->actionsList[$actionName]); print '<li class="formlisttitle"> <a name="' . $actionName . '"></a>' . l_t($name) . '</li>'; try { if (isset($_REQUEST['actionName']) and $_REQUEST['actionName'] == $actionName) { print '<li class="formlistfield">'; $paramValues = array(); foreach ($params as $paramName => $paramFullName) { if (isset($_REQUEST[$paramName])) { $paramValues[$paramName] = $_REQUEST[$paramName]; } } if (isset($paramValues['gameID'])) { require_once l_r('objects/game.php'); $Variant = libVariant::loadFromGameID((int) $paramValues['gameID']); $Game = $Variant->Game((int) $paramValues['gameID']); print '<p>' . l_t('Game link') . ': <a href="board.php?gameID=' . $Game->id . '">' . $Game->name . '</a></p>'; } if (isset($paramValues['userID'])) { $User = new User((int) $paramValues['userID']); print '<p>' . l_t('User link') . ': ' . $User->profile_link() . '</p>'; } if (isset($paramValues['postID'])) { print '<p>' . l_t('Post link') . ': ' . libHTML::threadLink($paramValues['postID']) . '</p>'; } // If it needs confirming but ( hasn't been confirmed or is being resubmitted ): if (!self::isActionDangerous($actionName) && (!isset($_REQUEST['actionConfirm']) || !libHTML::checkTicket())) { print '<strong>' . $this->{$actionName . 'Confirm'}($paramValues) . '</strong>'; print '<form action="' . self::$target . '#' . $actionName . '" method="post"> <input type="hidden" name="actionName" value="' . $actionName . '" /> <input type="hidden" name="actionConfirm" value="on" /> <input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" />'; foreach ($paramValues as $name => $value) { print '<input type="hidden" name="' . $name . '" value="' . $value . '" />'; } print '</li><li class="formlistfield" style="margin-bottom:20px"> <input type="submit" class="form-submit" value="Confirm" /> </form>'; } else { $details = $this->{$actionName}($paramValues); self::save($name, $paramValues, $details); $description = '<p class="notice">' . $details . '</p> <p>' . l_t($description) . '</p>'; $Misc->LastModAction = time(); } print '</li>'; } } catch (Exception $e) { $description = '<p><strong>' . l_t('Error') . ':</strong> ' . $e->getMessage() . '</p> <p>' . l_t($description) . '</p>'; } self::form($actionName, $params, $description); }
print '</div>'; libHTML::footer(); } if (!$Game->Members->isJoined() && $Game->watched() && isset($_REQUEST['unwatch'])) { print '<div class="content-notice gameTimeRemaining">' . '<form method="post" action="redirect.php">' . 'Are you sure you wish to remove this game from your spectated games list? ' . '<input type="hidden" name="gameID" value="' . $Game->id . '">' . '<input type="submit" class="form-submit" name="unwatch" value="Confirm"> </form></div>'; } // Before HTML pre-generate everything and check input, so game summary header will be accurate if (isset($Member) && $Member->status == 'Playing' && $Game->phase != 'Finished') { if ($Game->phase != 'Pre-game') { if (isset($_REQUEST['Unpause'])) { $_REQUEST['Pause'] = 'on'; } // Hack because Unpause = toggle Pause foreach (Members::$votes as $possibleVoteType) { if (isset($_REQUEST[$possibleVoteType]) && isset($Member) && libHTML::checkTicket()) { $Member->toggleVote($possibleVoteType); } } } $DB->sql_put("COMMIT"); if ($Game->processStatus != 'Crashed' && $Game->processStatus != 'Paused' && $Game->attempts > count($Game->Members->ByID) / 2 + 4) { require_once l_r('gamemaster/game.php'); $Game = $Game->Variant->processGame($Game->id); $Game->crashed(); $DB->sql_put("COMMIT"); } else { if ($Game->Members->votesPassed() && $Game->phase != 'Finished') { $DB->sql_put("UPDATE wD_Games SET attempts=attempts+1 WHERE id=" . $Game->id); $DB->sql_put("COMMIT"); require_once l_r('gamemaster/game.php');
if (!$silence->isEnabled() || $silence->id == $UserProfile->silenceID) { print '<li>' . $silence->toString() . '</li>'; } } print '</ul>'; } print '</li><li>'; print libHTML::admincp('createUserSilence', array('userID' => $UserProfile->id, 'reason' => ''), l_t('Silence user')); print '</li></ul></p>'; } } if ($User->type['User'] && $User->id != $UserProfile->id) { print '<div class="hr"></div>'; print '<a name="messagebox"></a>'; if (isset($_REQUEST['message']) && $_REQUEST['message']) { if (!libHTML::checkTicket()) { print '<p class="notice">' . l_t('You seem to be sending the same message again, this may happen if you refresh ' . 'the page after sending a message.') . '</p>'; } else { if ($UserProfile->sendPM($User, $_REQUEST['message'])) { print '<p class="notice">' . l_t('Private message sent successfully.') . '</p>'; } else { print '<p class="notice">' . l_t('Private message could not be sent. You may be silenced or muted.') . '</p>'; } } } print '<div style="margin-left:20px"><ul class="formlist">'; print '<li class="formlisttitle">' . l_t('Send private-message:') . '</li> <li class="formlistdesc">' . l_t('Send a message to this user.') . '</li>'; print '<form action="profile.php?userID=' . $UserProfile->id . '#messagebox" method="post"> <input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" /> <textarea name="message" style="width:80%" rows="4"></textarea></li>