$onlineUsers = array(); while (list($userID) = $DB->tabl_row($tabl)) { $onlineUsers[] = $userID; } file_put_contents($onlineFile, 'onlineUsers=$A([' . implode(',', $onlineUsers) . ']);'); //- Update misc values (if running as admin/mod) if (!$User->type['System'] || time() % (15 * 60) <= 5 * 60) { print l_t('Updating Misc values') . '<br />'; miscUpdate::errorLog(); miscUpdate::forum(); miscUpdate::game(); miscUpdate::user(); } //- Check last process time, pause processing/save current process time if (time() - $Misc->LastProcessTime > Config::$downtimeTriggerMinutes * 60) { libHTML::notice(l_t('Games not processing'), libHTML::admincp('resetLastProcessTime', null, l_t('Continue processing now'))); } $Misc->LastProcessTime = time(); $Misc->write(); $startTime = time(); // Only do ~30 sec of processing per cycle $tabl = $DB->sql_tabl("SELECT * FROM wD_Games\r\n\tWHERE processStatus='Not-processing' AND processTime <= " . time() . " AND NOT phase='Finished'"); while (time() - $startTime < 30 && ($gameRow = $DB->tabl_hash($tabl))) { $Variant = libVariant::loadFromVariantID($gameRow['variantID']); $Game = $Variant->Game($gameRow); print '<a href="board.php?gameID=' . $Game->id . '">gameID=' . $Game->id . ': ' . $Game->name . '</a>: '; try { if ($Game->processStatus != 'Crashed' && $Game->attempts > count($Game->Members->ByID) * 2) { $Game = $Variant->processGame($Game->id); $Game->crashed(); $DB->sql_put("COMMIT");
print $Game->summary(true); if ($User->type['Moderator']) { $modActions = array(); if ($Game->gameOver == 'No') { $modActions[] = libHTML::admincpType('Game', $Game->id); $modActions[] = libHTML::admincp('drawGame', array('gameID' => $Game->id), l_t('Draw game')); $modActions[] = libHTML::admincp('togglePause', array('gameID' => $Game->id), l_t('Toggle pause')); if ($Game->processStatus == 'Not-processing') { $modActions[] = libHTML::admincp('setProcessTimeToNow', array('gameID' => $Game->id), l_t('Process now')); $modActions[] = libHTML::admincp('setProcessTimeToPhase', array('gameID' => $Game->id), l_t('Process one phase length from now')); } if ($User->type['Admin']) { if ($Game->processStatus == 'Crashed') { $modActions[] = libHTML::admincp('unCrashGames', array('excludeGameIDs' => ''), l_t('Un-crash all crashed games')); } $modActions[] = libHTML::admincp('reprocessGame', array('gameID' => $Game->id), l_t('Reprocess game')); } if ($Game->phase != 'Pre-game' && !$Game->isMemberInfoHidden()) { $userIDs = implode('%2C', array_keys($Game->Members->ByUserID)); $modActions[] = '<br />' . l_t('Multi-check:'); foreach ($Game->Members->ByCountryID as $countryID => $Member) { $modActions[] = '<a href="admincp.php?tab=Multi-accounts&aUserID=' . $Member->userID . '&bUserIDs=' . $userIDs . '" class="light">' . $Member->memberCountryName() . '</a>'; } } } if ($modActions) { print '<div class="hr"></div>'; print '<p class="notice">'; print implode(' - ', $modActions); print '</p>'; print '<div class="hr"></div>';
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Affero General Public License along with webDiplomacy. If not, see <http://www.gnu.org/licenses/>. */ defined('IN_CODE') or die('This script can not be run by itself.'); /** * Display the error logs and other lists useful for admins * * @package Admin */ if ($User->type['Admin']) { //There may be sensitive info that would allow privilege escalation in these error logs print '<p><strong>' . l_t('Error logs:') . '</strong> ' . libError::stats() . ' (' . libHTML::admincp('clearErrorLogs', null, 'Clear') . ')</p>'; $dir = libError::directory(); $errorlogs = libError::errorTimes(); $alternate = false; print '<TABLE class="credits">'; foreach ($errorlogs as $errorlog) { $alternate = !$alternate; print '<tr class="replyalternate' . ($alternate ? '1' : '2') . '">'; print '<td class="left time">' . libTime::text($errorlog) . '</td>'; print '<td class="right message"><a class="light" href="admincp.php?viewErrorLog=' . $errorlog . '">Open</a></td>'; print '</tr>'; } print '</TABLE>'; } /** * Fill a named table from a single column query
public static function printActionShortcuts() { global $User; $modActions = array(); $modActions[] = '<a href="gamemaster.php" class="light">' . l_t('Run gamemaster') . '</a><br />'; $modActions[] = libHTML::admincp('panic', null, l_t('Toggle panic-mode')); if ($User->type['Admin']) { $modActions[] = libHTML::admincp('notice', null, l_t('Toggle the site-wide notice')); $modActions[] = libHTML::admincp('maintenance', null, l_t('Toggle maintenance-mode')) . '<br />'; $modActions[] = libHTML::admincp('clearErrorLogs', null, l_t('Clear error-logs')); $modActions[] = libHTML::admincp('clearOrderLogs', null, l_t('Clear order-logs')); $modActions[] = libHTML::admincp('clearAccessLogs', null, l_t('Clear access-logs')); $modActions[] = libHTML::admincp('clearAdminLogs', null, l_t('Clear admin-logs')) . '<br />'; $modActions[] = libHTML::admincp('unCrashGames', array('excludeGameIDs' => ''), l_t('Un-crash any crashed games')); } if ($modActions) { print '<p class="notice">'; print implode(' - ', $modActions); print '</p>'; print '<div class="hr"></div>'; } }
$silences = $UserProfile->getSilences(); print '<p><ul class="formlist"><li><strong>' . l_t('Silences:') . '</strong></li><li>'; if (count($silences) == 0) { print l_t('No silences against this user.') . '</p>'; } else { print '<ul class="formlist">'; foreach ($silences as $silence) { // There should only be one active silence displayed; other active silences could be misleading 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>'; }