Skip to content

Commit

Permalink
mnet: Removed hardcoded English strings from some MNET files: MDL-8069
Browse files Browse the repository at this point in the history
  • Loading branch information
donal72 committed Jan 5, 2007
1 parent 820aff1 commit cd60764
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 101 deletions.
6 changes: 3 additions & 3 deletions admin/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
case 'enable':
// check auth plugin is valid first
if (!exists_auth_plugin($params->auth)) {
error("Authentication plugin '{$params->auth}' is not installed.", $url);
error(get_string('pluginnotinstalled', 'auth', $params->auth), $url);
}
// add to enabled list
if (!array_search($params->auth, $authsenabled)) {
Expand All @@ -86,7 +86,7 @@
$key = array_search($params->auth, $authsenabled);
// check auth plugin is valid
if ($key === false) {
error("Authentication plugin '{$params->auth}' is not enabled.", $url);
error(get_string('pluginnotenabled', 'auth', $params->auth), $url);
}
// move down the list
if ($key < (count($authsenabled) - 1)) {
Expand All @@ -101,7 +101,7 @@
$key = array_search($params->auth, $authsenabled);
// check auth is valid
if ($key === false) {
error("Authentication plugin '{$params->auth}' is not enabled.", $url);
error(get_string('pluginnotenabled', 'auth', $params->auth), $url);
}
// move up the list
if ($key >= 1) {
Expand Down
22 changes: 11 additions & 11 deletions admin/mnet/access_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,37 @@

// boot if insufficient permission
if (!has_capability('moodle/user:delete', $sitecontext)) {
error('You are not permitted to modify the MNET access control list.');
error(get_string('nomodifyacl','mnet'));
}

// fetch the record in question
$id = required_param('id', PARAM_INT);
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
error('Record does not exist.', '/admin/mnet/access_control.php');
error(get_string('recordnoexists','mnet'), '/admin/mnet/access_control.php');
}

switch ($action) {

case "delete":
delete_records('mnet_sso_access_control', 'id', $id);
notify("SSO ACL: delete record for user '{$idrec->username}' from {$mnethosts[$idrec->mnet_host_id]}.");
notify(get_string('deleteuserrecord', 'mnet', array($idrec->username, $mnethosts[$idrec->mnet_host_id])));
break;

case "acl":

// require the access parameter, and it must be 'allow' or 'deny'
$access = trim(strtolower(required_param('access', PARAM_ALPHA)));
if ($access != 'allow' and $access != 'deny') {
error('Invalid access parameter.', '/admin/mnet/access_control.php');
error(get_string('invalidaccessparam', 'mnet') , '/admin/mnet/access_control.php');
}

if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $access)) {
notify("SSO ACL: $access user '{$idrec->username}' from {$mnethosts[$idrec->mnet_host_id]}");
notify(get_string('ssoacl', 'mnet', array($access, $idrec->username, $mnethosts[$idrec->mnet_host_id])));
}
break;

default:
error('Invalid action parameter.', '/admin/mnet/access_control.php');
error(get_string('invalidactionparam', 'mnet'), '/admin/mnet/access_control.php');
}
redirect('access_control.php', get_string('changessaved'));
}
Expand All @@ -81,16 +81,16 @@

// check permissions and verify form input
if (!has_capability('moodle/user:delete', $sitecontext)) {
error('You are not permitted to modify the MNET access control list.', '/admin/mnet/access_control.php');
error(get_string('nomodifyacl','mnet'), '/admin/mnet/access_control.php');
}
if (empty($form->username)) {
$formerror['username'] = 'Please enter a username, or a list of usernames separated by commas.';
$formerror['username'] = get_string('enterausername','mnet');
}
if (empty($form->mnet_host_id)) {
$formerror['mnet_host_id'] = 'Please select a remote Moodle host.';
$formerror['mnet_host_id'] = get_string('selectahost','mnet');
}
if (empty($form->access)) {
$formerror['access'] = 'Please select an access level from the list.';
$formerror['access'] = get_string('selectaccesslevel','mnet'); ;
}

// process if there are no errors
Expand Down Expand Up @@ -136,7 +136,7 @@
$aclcount = count_records('mnet_sso_access_control');

if (!$acl) {
print_heading('No entries in the SSO access control list');
print_heading(get_string('noaclentries','mnet'));
$table = NULL;
} else {
$table->head = $headings;
Expand Down
6 changes: 3 additions & 3 deletions admin/mnet/delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
<td class="generalboxcontent">
<table cellpadding="9" cellspacing="0" >
<tr valign="top">
<td colspan="2" class="header" cellpadding="0"><span>Deleting a Server</span></td>
<td colspan="2" class="header" cellpadding="0"><span><?php print_string('deleteaserver', 'mnet'); ?>Deleting a Server</span></td>
</tr>
<?php
if (count($warn) > 0):
?>
<tr valign="top">
<td align="right" colspan="2">The following warnings were received:<br />
<td align="right" colspan="2"><?php print_string('receivedwarnings','mnet'); ?>:<br />
<?php foreach($warn as $warning) echo $warning .'<br />'; ?>
</td>
</tr>
<?php
endif;
?>
<tr valign="top">
<td colspan="2">Are you sure you want to delete the server: "<?php echo $mnet_peer->name; ?>"?</td>
<td colspan="2"><?php print_string('reallydeleteserver','mnet'); ?>: "<?php echo $mnet_peer->name; ?>"?</td>
</tr>
<tr valign="top">
<td width="80">
Expand Down
10 changes: 3 additions & 7 deletions admin/mnet/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
require_login();

if (!isadmin()) {
error('Only administrators can use this page!');
}

$context = get_context_instance(CONTEXT_SYSTEM, SITEID);

require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");

if (!$site = get_site()) {
error('Site isn\'t defined!');
error(get_string('nosite','mnet'));
}

/// Initialize variables.
Expand All @@ -32,7 +28,7 @@
$warn = array();

if ($_SERVER['REQUEST_METHOD'] != 'POST') {
redirect('index.php', "The delete function requires a POST request.",7);
redirect('index.php', get_string('postrequired','mnet') ,7);
}

if ('verify' == $step) {
Expand All @@ -47,6 +43,6 @@
$mnet_peer = new mnet_peer();
$mnet_peer->set_id($hostid);
$mnet_peer->delete();
redirect('peers.php', 'Ok - host deleted', 5);
redirect('peers.php', get_string('hostdeleted', 'mnet'), 5);
}
?>
8 changes: 4 additions & 4 deletions admin/mnet/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");

if (!$site = get_site()) {
error('Site isn\'t defined!');
error(get_string('nosite','mnet'));
}

if (!function_exists('curl_init') ) {
error('PHP Curl library is not installed');
error(get_string('nocurl','mnet'));
}

if (!extension_loaded('openssl')) {
Expand Down Expand Up @@ -93,11 +93,11 @@
<td colspan="2" class="header" cellpadding="0"><?php print_string('aboutyourhost', 'mnet'); ?></td>
</tr>
<tr valign="top">
<td align="right">Public Key:</td>
<td align="right"><?php print_string('publickey', 'mnet'); ?>:</td>
<td><pre><?php echo $MNET->public_key; ?></pre></td>
</tr>
<tr valign="top">
<td align="right">Networking:</td>
<td align="right"><?php print_string('net', 'mnet'); ?>:</td>
<td><input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="radio" name="mode" value="off" <?php echo ("off" == $CFG->mnet_dispatcher_mode)? 'checked="true"' : '' ?> /> <?php print_string('off', 'mnet'); ?> <br />
<input type="radio" name="mode" value="strict" <?php echo ("strict" == $CFG->mnet_dispatcher_mode)? 'checked="true"' : '' ?> /> <?php print_string('on', 'mnet'); ?><br />
Expand Down
63 changes: 0 additions & 63 deletions admin/mnet/mnet_log.php

This file was deleted.

4 changes: 2 additions & 2 deletions admin/mnet/mnet_review.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
<tr>
<td align="right" valign="top" nowrap><?php print_string('deleted'); ?>:</td>
<td valign="top">
<input type="radio" name="deleted" value="0" <?php echo ("off" == $CFG->mnet_dispatcher_mode)? 'checked="true"' : '' ?> /> No - select this option to re-enable this server. <br />
<input type="radio" name="deleted" value="1" <?php echo ("strict" == $CFG->mnet_dispatcher_mode)? 'checked="true"' : '' ?> /> Yes<br />
<input type="radio" name="deleted" value="0" checked="true" /> <?php print_string('reenableserver','mnet'); ?><br />
<input type="radio" name="deleted" value="1" /> <?php print_string('yes'); ?><br />
</td>
</tr>
<?php
Expand Down
4 changes: 2 additions & 2 deletions admin/mnet/mnet_services.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ <h3><?php echo get_string($name.'_name', $version['parent_type'].'_'.$version['p
echo $breakstring;
?>
<input type="hidden" name="exists[<?php echo $version['serviceid']; ?>]" value="1" />
<input type="checkbox" name="publish[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_publish']))? 'checked ': '' ; ?>/> Publish <?php echo $versionstring; if (!empty($version['hostsubscribes'])) echo '<a href="#" title="'.get_string('issubscribed','mnet', $mnet_peer->name).'">&radic;</a> '; if (!empty($version['allhosts_publish'])) print_string("enabled_for_all",'mnet',!empty($version['I_publish'])); ?><br />
<input type="checkbox" name="subscribe[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_subscribe']))? 'checked ': '' ; ?>/> Subscribe <?php echo $versionstring; if (!empty($version['hostpublishes'])) echo '<a href="#" title="'.get_string('ispublished','mnet', $mnet_peer->name).'">&radic;</a> '; if (!empty($version['allhosts_subscribe'])) print_string("enabled_for_all",'mnet',!empty($version['I_subscribe'])); ?><br />
<input type="checkbox" name="publish[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_publish']))? 'checked ': '' ; ?>/><?php print_string('publish','mnet'); ?><?php echo $versionstring; if (!empty($version['hostsubscribes'])) echo '<a href="#" title="'.get_string('issubscribed','mnet', $mnet_peer->name).'">&radic;</a> '; if (!empty($version['allhosts_publish'])) print_string("enabled_for_all",'mnet',!empty($version['I_publish'])); ?><br />
<input type="checkbox" name="subscribe[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_subscribe']))? 'checked ': '' ; ?>/><?php print_string('subscribe','mnet'); ?><?php echo $versionstring; if (!empty($version['hostpublishes'])) echo '<a href="#" title="'.get_string('ispublished','mnet', $mnet_peer->name).'">&radic;</a> '; if (!empty($version['allhosts_subscribe'])) print_string("enabled_for_all",'mnet',!empty($version['I_subscribe'])); ?><br />
<?php
$breakstring = '. . . . . . . . . . . . . . . . . . . . . . . . <br>';
endforeach;
Expand Down
2 changes: 1 addition & 1 deletion admin/mnet/mnet_services.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");

if (!$site = get_site()) {
error('Site isn\'t defined!');
error(get_string('nosite','mnet'));
}

/// Initialize variables.
Expand Down
4 changes: 2 additions & 2 deletions admin/mnet/peers.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");

if (!$site = get_site()) {
error('Site isn\'t defined!');
error(get_string('nosite','mnet'));
}

if (!function_exists('curl_init') ) {
error('PHP Curl library is not installed');
error(get_string('nocurl','mnet'));
}

if (!extension_loaded('openssl')) {
Expand Down
2 changes: 1 addition & 1 deletion admin/mnet/trustedhosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");

if (!$site = get_site()) {
error('Site isn\'t defined!');
error(get_string('nosite','mnet'));
}

if (!extension_loaded('openssl')) {
Expand Down
3 changes: 3 additions & 0 deletions lang/en_utf8/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
$string['alternatelogin'] = 'If you enter a URL here, it will be used as the login page for this site. The page should contain a form which has the action property set to <strong>\'$a\'</strong> and return fields <strong>username</strong> and <strong>password</strong>.<br />Be careful not to enter an incorrect URL as you may lock yourself out of this site.<br />Leave this setting blank to use the default login page.';
$string['alternateloginurl'] = 'Alternate Login URL';

$string['pluginnotenabled'] = 'Authentication plugin \'$a\' is not enabled.';
$string['pluginnotinstalled'] = 'Authentication plugin \'$a\' is not installed.';

// CAS plugin
$string['auth_cas_logincas'] = 'Secure connection access';
$string['auth_cas_invalidcaslogin'] = 'Sorry, your login has failed - you could not be authorised';
Expand Down
23 changes: 23 additions & 0 deletions lang/en_utf8/mnet.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@
'192.168.0.0/0<br />'.
'Obviously the last example is not a recommended configuration.';

$string['nomodifyacl'] = 'You are not permitted to modify the MNET access control list.';
$string['recordnoexists'] = 'Record does not exist.';
$string['enterausername'] = 'Please enter a username, or a list of usernames separated by commas.';
$string['selectahost'] = 'Please select a remote Moodle host.';
$string['selectaccesslevel'] = 'Please select an access level from the list.';
$string['noaclentries'] = 'No entries in the SSO access control list';
$string['deleteaserver'] = 'Deleting a Server';
$string['nosite'] = 'Could not find site-level course';
$string['postrequired'] = 'The delete function requires a POST request.';
$string['hostdeleted'] = 'Ok - host deleted';
$string['reenableserver'] = 'No - select this option to re-enable this server.';
$string['nocurl'] = 'PHP Curl library is not installed';
$string['publish'] = 'Publish';
$string['subscribe'] = 'Subscribe';
$string['failedaclwrite'] = 'Failed to write to the MNET access control list for user \'$a\'.';

$string['receivedwarnings'] = 'The following warnings were received';
$string['reallydeleteserver'] = 'Are you sure you want to delete the server';

$string['deleteuserrecord'] = 'SSO ACL: delete record for user \'$a[0]\' from $a[1].';
$string['invalidaccessparam'] = 'Invalid access parameter.';
$string['invalidactionparam'] = 'Invalid action parameter.';
$string['ssoacl'] = 'SSO ACL: $a[0] user \'$a[1]\' from $a[2]';
$string['currentkey'] = 'Current Public Key';
$string['keymismatch'] = 'The public key you are holding for this host is different from the public key it is currently publishing.';
$string['invalidurl'] = 'Invalid URL parameter.';
Expand Down
4 changes: 2 additions & 2 deletions mnet/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function mnet_update_sso_access_control($username, $mnet_host_id, $access) {
add_to_log(SITEID, 'admin/mnet', 'update', 'admin/mnet/access_control.php',
"SSO ACL: $access user '$username' from {$mnethost->name}");
} else {
error("Failed to write to the MNET access control list for user '$username'.");
error(get_string('failedaclwrite','mnet', $username));
return false;
}
} else {
Expand All @@ -481,7 +481,7 @@ function mnet_update_sso_access_control($username, $mnet_host_id, $access) {
add_to_log(SITEID, 'admin/mnet', 'add', 'admin/mnet/access_control.php',
"SSO ACL: $access user '$username' from {$mnethost->name}");
} else {
error("Failed to write to the MNET access control list for user '$username'.");
error(get_string('failedaclwrite','mnet', $username));
return false;
}
}
Expand Down

0 comments on commit cd60764

Please sign in to comment.