Commit 71556b3a authored by Robert Lyon's avatar Robert Lyon

Properly concat lang strings in webservices (Bug #1399446)

Change-Id: Ib728376b9262bc0bcd45c3f72abba4903dede902
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 6901d16a
......@@ -91,7 +91,7 @@ $string['invalidretdesc'] = 'Invalid return description';
$string['invalidparamdesc'] = 'Invalid parameters description';
$string['missingretvaldesc'] = 'Missing returned values description';
$string['missingparamdesc'] = 'Missing parameters description';
$string['missingimplofmeth'] = 'Missing implementation method of ';
$string['missingimplofmeth'] = 'Missing implementation method of "%s"';
$string['cannotfindimplfile'] = 'Cannot find file with external function implementation';
$string['apptokens'] = 'Application Connections';
......@@ -105,6 +105,7 @@ $string['servicename'] = 'Service';
$string['generate'] = 'Generate token';
$string['invalidtoken'] = 'Invalid token selected';
$string['token'] = 'Token';
$string['tokenid'] = 'Token "%s"';
$string['invaliduserselected'] = 'Invalid user selected';
$string['invaliduserselectedinstitution'] = 'Invalid user for token institution selected from user search';
$string['noservices'] = 'No services configured';
......@@ -125,6 +126,7 @@ $string['errors'] = 'Only Errors';
$string['manageserviceusers'] = 'Manage Service Users';
$string['sudescription'] = 'Allocate users to Service Groups and Institutions. User must only be configured once. All users must have the "webservice" authentication method. The instance of the "webservice" authentication method of the user must be from an institution that they are a member of.';
$string['serviceuser'] = 'Service owner';
$string['serviceusername'] = 'Service owner "%s"';
$string['invalidserviceuser'] = 'Invalid Service User selected';
$string['nouser'] = 'Please select a user';
$string['duplicateuser'] = 'User account is already configured for Web Services';
......@@ -144,8 +146,9 @@ $string['webservices_title'] = 'Web Services Configuration';
$string['headingusersearchtoken'] = 'WebServices: Token user search';
$string['headingusersearchuser'] = 'WebServices: Service User search';
$string['usersearchinstructions'] = 'Select a user to associate with a webservice by clicking on the avatar. You can search for users by clicking on the initials of their first and last names, or by entering a name in the search box. You can also enter an email address in the search box if you would like to search email addresses.';
$string['sha1fingerprint'] = 'SHA1 fingerprint';
$string['md5fingerprint'] = 'MD5 fingerprint';
$string['sha1fingerprint'] = 'SHA1 fingerprint: %s';
$string['md5fingerprint'] = 'MD5 fingerprint: %s';
$string['publickeyexpireson'] = 'Public key expires: %s';
// wsdoc
$string['function'] = 'Function';
......@@ -292,28 +295,35 @@ $string['wsusername'] = 'Web service username';
// Web Service functions errors
$string['nooauth'] = 'Not enabled for OAuth';
$string['accessdenied'] = 'access denied';
$string['accessdeniedforinst'] = ' access denied for institution: ';
$string['usernameexists'] = 'Username already exists: ';
$string['invalidauthtype'] = 'Invalid authentication type: ';
$string['instexceedmax'] = 'Institution exceeded max allowed: ';
$string['cannotdeleteaccount'] = 'cannot delete account that has been used and is not suspended: ';
$string['accessdeniedforinst'] = ' access denied for institution "%s"';
$string['accessdeniedforinstuser'] = ' access denied for institution "%s" with user "%s"';
$string['accessdeniedforinstgroup'] = ' access denied for institution "%s" on group "%s"';
$string['usernameexists'] = 'Username already exists "%s"';
$string['invalidauthtype'] = 'Invalid authentication type "%s"';
$string['invalidauthtypeuser'] = 'Invalid authentication type "%s" with user "%s"';
$string['instexceedmax'] = 'Institution exceeded max allowed "%s"';
$string['cannotdeleteaccount'] = 'cannot delete account that has been used and is not suspended. User id "%s"';
$string['nousernameorid'] = 'no username or id ';
$string['invaliduser'] = 'invalid user: ';
$string['mustsetauth'] = 'must set auth and institution to update auth on user: ';
$string['invalidusername'] = 'Invalid username: ';
$string['invalidremoteusername'] = 'Invalid remote username: ';
$string['nousernameoridgroup'] = 'no username or id for group "%s"';
$string['invaliduser'] = 'invalid user "%s"';
$string['invaliduserid'] = 'invalid user id "%s"';
$string['invalidusergroup'] = 'invalid user "%s" for group "%s"';
$string['mustsetauth'] = 'must set auth and institution to update auth on user "%s"';
$string['invalidusername'] = 'Invalid username "%s"';
$string['invalidremoteusername'] = 'Invalid remote username "%s"';
$string['musthaveid'] = 'Must have id, userid or username';
$string['notauthforuserid'] = 'Not authorised for access to user id: ';
$string['invalidfavourite'] = 'Invalid favourite: ';
$string['groupexists'] = 'Group already exists: ';
$string['instmustbeongroup'] = 'institution must be set on group: ';
$string['notauthforuseridinstitution'] = 'Not authorised for access to user id "%s" for institution "%s"';
$string['notauthforuseridinstitutiongroup'] = 'Not authorised for access to user id "%s" for institution "%s" to group "%s"';
$string['invalidfavourite'] = 'Invalid favourite "%s"';
$string['groupexists'] = 'Group already exists "%s"';
$string['instmustbeongroup'] = 'institution must be set on group "%s"';
$string['noname'] = 'no name or shortname specified';
$string['catinvalid'] = 'category invalid: ';
$string['invalidjointype'] = 'invalid join type combination';
$string['catinvalid'] = 'category "%s" invalid';
$string['invalidjointype'] = 'invalid join type combination "%s"';
$string['correctjointype'] = 'must select correct join type open, request, and/or controlled';
$string['groupeditroles'] = 'group edit roles specified(%s) must be one of: %s';
$string['invalidmemroles'] = 'Invalid group membership role: %s for user: %s';
$string['groupnotexist'] = 'Group does not exist: ';
$string['instmustset'] = 'institution must be set for: ';
$string['groupeditroles'] = 'group edit roles specified "%s" must be one of: %s';
$string['invalidmemroles'] = 'Invalid group membership role "%s" for user "%s"';
$string['groupnotexist'] = 'Group "%s" does not exist';
$string['instmustset'] = 'institution must be set for "%s"';
$string['nogroup'] = 'no group specified';
$string['membersinvalidaction'] = 'invalid action(%s) for user: %s/%s - group: %s';
$string['membersinvalidaction'] = 'invalid action "%s" for user "%s" on group "%s"';
......@@ -937,15 +937,15 @@ function get_config_options_extended() {
),
'sha1fingerprint' => array(
'type' => 'html',
'value' => '<div>' . get_string('sha1fingerprint', 'auth.webservice') . ': ' . $openssl->sha1_fingerprint . '</div>',
'value' => '<div>' . get_string('sha1fingerprint', 'auth.webservice', $openssl->sha1_fingerprint) . '</div>',
),
'md5fingerprint' => array(
'type' => 'html',
'value' => '<div>' . get_string('md5fingerprint', 'auth.webservice') . ': ' . $openssl->md5_fingerprint . '</div>',
'value' => '<div>' . get_string('md5fingerprint', 'auth.webservice', $openssl->md5_fingerprint) . '</div>',
),
'expires' => array(
'type' => 'html',
'value' => '<div>' . get_string('publickeyexpires','admin') . ': ' . format_date($openssl->expires) . '</div>'
'value' => '<div>' . get_string('publickeyexpireson','auth.webservice', format_date($openssl->expires)) . '</div>'
),
),
'collapsible' => true,
......
......@@ -153,7 +153,7 @@ $elements = array(
// fieldset for managing service function list
'token_details' => array(
'type' => 'fieldset',
'legend' => get_string('token', 'auth.webservice') . ': ' . $dbtoken->token,
'legend' => get_string('tokenid', 'auth.webservice', $dbtoken->token),
'elements' => array(
'sflist' => array(
'type' => 'html',
......
......@@ -161,7 +161,7 @@ $elements = array(
// fieldset for managing service function list
'serviceusers_details' => array(
'type' => 'fieldset',
'legend' => get_string('serviceuser', 'auth.webservice') . ': ' . $dbuser->username,
'legend' => get_string('serviceusername', 'auth.webservice', $dbuser->username),
'elements' => array(
'sflist' => array(
'type' => 'html',
......
This diff is collapsed.
......@@ -284,7 +284,7 @@ function webservice_function_info($function, $strictness=MUST_EXIST) {
// make sure the implementaion class is ok
if (!method_exists($function->classname, $function->methodname)) {
throw new WebserviceCodingException(get_string('missingimplofmeth', 'auth.webservice') . $function->classname . '::' . $function->methodname);
throw new WebserviceCodingException(get_string('missingimplofmeth', 'auth.webservice', $function->classname . '::' . $function->methodname));
}
if (!method_exists($function->classname, $function->parameters_method)) {
throw new WebserviceCodingException(get_string('missingparamdesc', 'auth.webservice'));
......
......@@ -124,7 +124,7 @@ if (!empty($authtype)) {
// we are go - build the form for function parameters
if ($function != 0 && !empty($dbsf)) {
$vars = testclient_get_interface($dbsf->functionname);
$elements['spacer'] = array('type' => 'html', 'value' => '<br/><h3>' . get_string('enterparameters', 'auth.webservice').'</h3>');
$elements['spacer'] = array('type' => 'html', 'value' => '<br/><h3>' . get_string('enterparameters', 'auth.webservice') . '</h3>');
for ($i=0;$i<=$iterations; $i++) {
foreach ($vars as $var) {
$name = preg_replace('/NUM/', $i, $var['name']);
......@@ -298,7 +298,7 @@ function testclient_submit(Pieform $form, $values) {
// check user is a valid web services account
$dbuser = get_record('usr', 'username', $values['wsusername']);
if (empty($dbuser)) {
$SESSION->add_error_msg(get_string('invaliduser', 'auth.webservice') . $values['wsusername']);
$SESSION->add_error_msg(get_string('invaliduser', 'auth.webservice', $values['wsusername']));
redirect('/webservice/testclient.php?' . implode('&', $params));
}
// special web service login
......@@ -307,20 +307,20 @@ function testclient_submit(Pieform $form, $values) {
// do password auth
$ext_user = get_record('external_services_users', 'userid', $dbuser->id);
if (empty($ext_user)) {
$SESSION->add_error_msg(get_string('invaliduser', 'auth.webservice') . $values['wsusername']);
$SESSION->add_error_msg(get_string('invaliduser', 'auth.webservice', $values['wsusername']));
redirect('/webservice/testclient.php?' . implode('&', $params));
}
// determine the internal auth instance
$auth_instance = get_record('auth_instance', 'institution', $ext_user->institution, 'authname', 'webservice');
if (empty($auth_instance)) {
$SESSION->add_error_msg(get_string('invaliduser', 'auth.webservice') . $values['wsusername']);
$SESSION->add_error_msg(get_string('invaliduser', 'auth.webservice', $values['wsusername']));
redirect('/webservice/testclient.php?' . implode('&', $params));
}
// authenticate the user
$auth = new AuthWebservice($auth_instance->id);
if (!$auth->authenticate_user_account($dbuser, $values['wspassword'], 'webservice')) {
// log failed login attempts
$SESSION->add_error_msg(get_string('invaliduser', 'auth.webservice') . $values['wsusername']);
$SESSION->add_error_msg(get_string('invaliduser', 'auth.webservice', $values['wsusername']));
redirect('/webservice/testclient.php?' . implode('&', $params));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment