Loading htdocs/lib/mahara.php +11 −1 Original line number Diff line number Diff line Loading @@ -300,10 +300,20 @@ function string_exists($identifier, $section = 'mahara') { return $string !== '[[' . $identifier . '/' . $section . ']]'; } function _return_string_unchanged($string, $args, $lang='en.utf8') { function _return_string_unchanged($string, $args=array(), $lang='en.utf8') { return $string; } /** * Find out the number of expected arguments if $identifier for get_string() is * passed in by a variable. Eg in webservices error handling. */ function count_string_args($identifier, $section = 'mahara') { $string = get_string_location($identifier, $section, array(), '_return_string_unchanged'); preg_match_all('/[^\%]\%[^\%]/', $string, $matches); return count($matches[0]); } function get_string($identifier, $section='mahara') { $variables = func_get_args(); Loading htdocs/webservice/lib.php +8 −2 Original line number Diff line number Diff line Loading @@ -2259,13 +2259,19 @@ class WebserviceException extends MaharaException { $this->errorcode = rtrim($errorcode, '0123456789'); if (string_exists($errorcode, 'auth.webservice')) { $count = count_string_args($errorcode, 'auth.webservice'); if ($count) { $message = get_string($errorcode, 'auth.webservice', $debuginfo); } else { $message = get_string($errorcode, 'auth.webservice'); } } else { $message = $errorcode; } if ($debuginfo) { if ($debuginfo && !$count) { $message .= ' : ' . $debuginfo; } Loading Loading
htdocs/lib/mahara.php +11 −1 Original line number Diff line number Diff line Loading @@ -300,10 +300,20 @@ function string_exists($identifier, $section = 'mahara') { return $string !== '[[' . $identifier . '/' . $section . ']]'; } function _return_string_unchanged($string, $args, $lang='en.utf8') { function _return_string_unchanged($string, $args=array(), $lang='en.utf8') { return $string; } /** * Find out the number of expected arguments if $identifier for get_string() is * passed in by a variable. Eg in webservices error handling. */ function count_string_args($identifier, $section = 'mahara') { $string = get_string_location($identifier, $section, array(), '_return_string_unchanged'); preg_match_all('/[^\%]\%[^\%]/', $string, $matches); return count($matches[0]); } function get_string($identifier, $section='mahara') { $variables = func_get_args(); Loading
htdocs/webservice/lib.php +8 −2 Original line number Diff line number Diff line Loading @@ -2259,13 +2259,19 @@ class WebserviceException extends MaharaException { $this->errorcode = rtrim($errorcode, '0123456789'); if (string_exists($errorcode, 'auth.webservice')) { $count = count_string_args($errorcode, 'auth.webservice'); if ($count) { $message = get_string($errorcode, 'auth.webservice', $debuginfo); } else { $message = get_string($errorcode, 'auth.webservice'); } } else { $message = $errorcode; } if ($debuginfo) { if ($debuginfo && !$count) { $message .= ' : ' . $debuginfo; } Loading