Skip to content

Commit

Permalink
1.31
Browse files Browse the repository at this point in the history
  • Loading branch information
kestasjk committed Mar 30, 2013
1 parent 5391fd4 commit 6a8dbad
Show file tree
Hide file tree
Showing 146 changed files with 1,672 additions and 1,643 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ pointlog.txt
/.project
/datc/maps/
!.htaccess
variants/*/cache/

173 changes: 83 additions & 90 deletions admin/adminActions.php

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions admin/adminActionsForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

defined('IN_CODE') or die('This script can not be run by itself.');

require_once('admin/adminActions.php');
require_once('admin/adminActionsForum.php');
require_once('admin/adminActionsRestricted.php');
require_once(l_r('admin/adminActions.php'));
require_once(l_r('admin/adminActionsForum.php'));
require_once(l_r('admin/adminActionsRestricted.php'));

/**
* This class uses data about admin tasks, provided by child classes, to
Expand Down Expand Up @@ -66,7 +66,7 @@ private static function form($actionName, array $params, $description="")
print '<input type="hidden" name="globalPostID" value="'.intval($_REQUEST['globalPostID']).'" />';

if ($description)
print '<li class="formlistdesc" style="margin-bottom:10px">'.$description.'</li>';
print '<li class="formlistdesc" style="margin-bottom:10px">'.l_t($description).'</li>';

foreach( $params as $paramCode=>$paramName )
{
Expand All @@ -83,14 +83,14 @@ private static function form($actionName, array $params, $description="")
$defaultValue = '';

print '<li class="formlistfield">
<label for="'.$paramCode.'">'.$paramName.'</label>:
<label for="'.$paramCode.'">'.l_t($paramName).'</label>:
<input type="text" name="'.$paramCode.'" value="'.$defaultValue.'" length="50" />
</li>';
}

print '<li class="formlistfield" style="margin-bottom:20px">
<input class="form-submit" type="submit" name="Submit" value="Submit" /> '.
( self::isActionDangerous($actionName) ? '<em>(Careful; not confirmed!)</em>' : '').'
<input class="form-submit" type="submit" name="Submit" value="'.l_t('Submit').'" /> '.
( self::isActionDangerous($actionName) ? '<em>('.l_t('Careful; not confirmed!').')</em>' : '').'
</li>';

print '</form>';
Expand Down Expand Up @@ -137,7 +137,7 @@ public function process($actionName)
extract(adminActions::$actions[$actionName]);

print '<li class="formlisttitle">
<a name="'.$actionName.'"></a>'.$name.'</li>';
<a name="'.$actionName.'"></a>'.l_t($name).'</li>';

try
{
Expand All @@ -154,21 +154,21 @@ public function process($actionName)

if ( isset($paramValues['gameID']) )
{
require_once('objects/game.php');
require_once(l_r('objects/game.php'));
$Variant=libVariant::loadFromGameID((int)$paramValues['gameID']);
$Game = $Variant->Game((int)$paramValues['gameID']);
print '<p>Game link: <a href="board.php?gameID='.$Game->id.'">'.$Game->name.'</a></p>';
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>User link: '.$User->profile_link().'</p>';
print '<p>'.l_t('User link').': '.$User->profile_link().'</p>';
}

if( isset($paramValues['postID']) )
{
print '<p>Post link: '.libHTML::threadLink($paramValues['postID']).'</p>';
print '<p>'.l_t('Post link').': '.libHTML::threadLink($paramValues['postID']).'</p>';
}

// If it needs confirming but ( hasn't been confirmed or is being resubmitted ):
Expand Down Expand Up @@ -196,7 +196,7 @@ public function process($actionName)
self::save($name, $paramValues, $details);

$description = '<p class="notice">'.$details.'</p>
<p>'.$description.'</p>';
<p>'.l_t($description).'</p>';

$Misc->LastModAction = time();
}
Expand All @@ -206,8 +206,8 @@ public function process($actionName)
}
catch(Exception $e)
{
$description = '<p><strong>Error:</strong> '.$e->getMessage().'</p>
<p>'.$description.'</p>';
$description = '<p><strong>'.l_t('Error').':</strong> '.$e->getMessage().'</p>
<p>'.l_t($description).'</p>';
}

self::form($actionName, $params, $description);
Expand All @@ -221,18 +221,18 @@ public static function printActionShortcuts()
global $User;

$modActions=array();
$modActions[] = '<a href="gamemaster.php" class="light">Run gamemaster</a><br />';
$modActions[] = libHTML::admincp('panic', null, 'Toggle panic-mode');
$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, 'Toggle the site-wide notice');
$modActions[] = libHTML::admincp('maintenance', null, 'Toggle maintenance-mode').'<br />';
$modActions[] = libHTML::admincp('clearErrorLogs', null, 'Clear error-logs');
$modActions[] = libHTML::admincp('clearOrderLogs', null, 'Clear order-logs');
$modActions[] = libHTML::admincp('clearAccessLogs', null, 'Clear access-logs');
$modActions[] = libHTML::admincp('clearAdminLogs', null, 'Clear admin-logs').'<br />';
$modActions[] = libHTML::admincp('unCrashGames', array('excludeGameIDs'=>''), 'Un-crash any crashed games');
$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)
Expand Down Expand Up @@ -292,14 +292,14 @@ public static function printActionLinks( array $actionCodes )
print '<div style="float:right; width:50%; text-align:left">';
for($i=$actionMidPoint; $i<$actionCount; $i++)
{
print '<a href="#'.$actionCodes[$i].'">'.adminActions::$actions[$actionCodes[$i]]['name'].'</a><br />';
print '<a href="#'.$actionCodes[$i].'">'.l_t(adminActions::$actions[$actionCodes[$i]]['name']).'</a><br />';
}
print '</div>';

print '<div style="width:45%">';
for($i=0; $i<$actionMidPoint; $i++)
{
print '<a href="#'.$actionCodes[$i].'">'.adminActions::$actions[$actionCodes[$i]]['name'].'</a><br />';
print '<a href="#'.$actionCodes[$i].'">'.l_t(adminActions::$actions[$actionCodes[$i]]['name']).'</a><br />';
}
print '</div>';
print '<div style="clear:both"></div>';
Expand All @@ -320,7 +320,7 @@ public static function printActionLinks( array $actionCodes )
// A shortcut command area
adminActionsLayout::printActionShortcuts();

require_once('lib/gamemessage.php');
require_once(l_r('lib/gamemessage.php'));

// Include the admin-only tasks?
if ( $User->type['Admin'] )
Expand All @@ -335,21 +335,21 @@ public static function printActionLinks( array $actionCodes )

$actionCodesByType = adminActionsLayout::actionCodesByType();

print '<h3>Admin actions</h3>';
print '<h3>'.l_t('Admin actions').'</h3>';
foreach($actionCodesByType as $type=>$actionCodes)
{
print '<a name="'.strtolower($type).'Actions"></a><h4>'.$type.' actions</h4>';
print '<a name="'.strtolower($type).'Actions"></a><h4>'.l_t($type.' actions').'</h4>';
adminActionsLayout::printActionLinks($actionCodes);
}

print '<div class="hr"></div>';

print '<h3>Forms</h3>';
print '<h3>'.l_t('Forms').'</h3>';
// For each task display the form, and run the task if data entered from the corresponding form
print '<ul class="formlist">';
foreach($actionCodesByType as $type=>$actionCodes)
{
print '<h4>'.$type.' actions</h4>';
print '<h4>'.l_t($type.' actions').'</h4>';

foreach($actionCodes as $actionCode)
$adminActions->process($actionCode);
Expand Down
44 changes: 19 additions & 25 deletions admin/adminActionsForum.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ public function disableSilence(array $params) {
self::setNextActiveUserSilence($silence->id);
self::setNextActivePostSilence($silence->id);

return $silence->toString().' disabled.';
return l_t('%s disabled.',$silence->toString());
}
public function disableSilenceConfirm(array $params) {

$silence = new Silence($params['silenceID']);

return 'Are you sure you want to disable this silence: <b>'.$silence->toString().'</b>?';
return l_t('Are you sure you want to disable this silence:').' <b>'.$silence->toString().'</b>?';
}

public function changeSilenceLength(array $params) {
Expand All @@ -164,40 +164,37 @@ public function changeSilenceLength(array $params) {
self::setNextActiveUserSilence($silence->id);
}

return $silence->toString().' changed from <i>'.
Silence::printLength($previousLength).'</i> to <i>'.
Silence::printLength($silence->length).'</i>.';
return l_t('%s changed from <i>%s</i> to <i>%s</i>.',$silence->toString(),Silence::printLength($previousLength),Silence::printLength($silence->length));
}
public function changeSilenceLengthConfirm(array $params) {

$silence = new Silence($params['silenceID']);

if( $params['length'] < 0 )
throw new Exception("Silence length must be non-negative.");
throw new Exception(l_t("Silence length must be non-negative."));

return 'Are you sure you want to change the silence length from <i>'.
Silence::printLength($silence->length).'</i> to <i>'.
Silence::printLength($params['length']).'</i>,
for <b>'.$silence->toString().'</b>?';
return l_t('Are you sure you want to change the silence length from <i>%s</i> to <i>%s</i>, for <b>%s</b>?',
Silence::printLength($silence->length),
Silence::printLength($params['length']),$silence->toString());
}

private static function checkSilenceParams(array $params) {
global $DB;

if( strlen($params['reason']) < 10 )
throw new Exception("Please give a reason.");
throw new Exception(l_t("Please give a reason."));

if( isset($params['userID']) ) {
$SilencedUser = new User((int)$params['userID']);

if( $params['length'] < 0 )
throw new Exception("Length in days must be greater than 0.");
throw new Exception(l_t("Length in days must be greater than 0."));
}

if( isset($params['postID']) ) {
list($threadsFound) = $DB->sql_row("SELECT COUNT(*) FROM wD_ForumMessages WHERE id = ".$params['postID']);
if( $threadsFound == 0 )
throw new Exception("Thread ID # ".$params['postID']." does not exist.");
throw new Exception(l_t("Thread ID # %s does not exist.",$params['postID']));
}
}

Expand All @@ -216,17 +213,17 @@ public function createUserSilence(array $params)
);

$silence = new Silence($silenceID);
return 'User silenced: <br/>' .$silence->toString();
return l_t('User silenced:').' <br/>' .$silence->toString();
}
public function createUserSilenceConfirm(array $params)
{
self::checkSilenceParams($params);

$UserSilence = new User($params['userID']);

return 'Are you sure you want to silence this user '.
Silence::printLength($params['length']).' because <i>'.
$params['reason'].'</i> ?';
return l_t('Are you sure you want to silence this user %s because <i>%s</i> ?',
Silence::printLength($params['length']),
$params['reason']);
}

public function createThreadSilence(array $params)
Expand All @@ -242,15 +239,13 @@ public function createThreadSilence(array $params)
);

$silence = new Silence($silenceID);
return 'Thread silenced: <br/>' .$silence->toString();
return l_t('Thread silenced:').' <br/>' .$silence->toString();
}
public function createThreadSilenceConfirm(array $params)
{
self::checkSilenceParams($params);

return 'Are you sure you want to silence the thread containing post ID # '.
$params['postID'].' indefinitely because <i>'.
$params['reason'].'</i> ?';
return l_t('Are you sure you want to silence the thread containing post ID # %s indefinitely because <i>%s</i> ?',$params['postID'],$params['reason']);
}

public function createUserThreadSilence(array $params)
Expand All @@ -268,15 +263,14 @@ public function createUserThreadSilence(array $params)
);

$silence = new Silence($silenceID);
return 'User and thread silenced: <br/>' .$silence->toString();
return l_t('User and thread silenced:').' <br/>' .$silence->toString();
}
public function createUserThreadSilenceConfirm(array $params)
{
self::checkSilenceParams($params);

return 'Are you sure you want to silence this user '.
Silence::printLength($params['length']).', and silence the thread they were posting in,
because <i>'.$params['reason'].'</i> ?';
return l_t('Are you sure you want to silence this user %s, and silence the thread they were posting in, because <i>%s</i> ?',
Silence::printLength($params['length']),$params['reason']);
}
}

Expand Down
Loading

0 comments on commit 6a8dbad

Please sign in to comment.