Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
3da4e0f6
Commit
3da4e0f6
authored
Aug 08, 2007
by
Nigel McNie
Browse files
Merge branch 'master' of
git+ssh://git.catalyst.net.nz/var/git/mahara
parents
0ffa68fc
76e85d34
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/api/xmlrpc/lib.php
View file @
3da4e0f6
...
@@ -39,7 +39,12 @@ function xmlrpc_exception (Exception $e) {
...
@@ -39,7 +39,12 @@ function xmlrpc_exception (Exception $e) {
}
}
function
get_hostname_from_uri
(
$uri
=
null
)
{
function
get_hostname_from_uri
(
$uri
=
null
)
{
static
$cache
=
array
();
if
(
array_key_exists
(
$uri
,
$cache
))
{
return
$cache
[
$uri
];
}
$count
=
preg_match
(
"@^(?:http[s]?://)?([A-Z0-9\-\.]+).*@i"
,
$uri
,
$matches
);
$count
=
preg_match
(
"@^(?:http[s]?://)?([A-Z0-9\-\.]+).*@i"
,
$uri
,
$matches
);
$cache
[
$uri
]
=
$matches
[
1
];
if
(
$count
>
0
)
return
$matches
[
1
];
if
(
$count
>
0
)
return
$matches
[
1
];
return
false
;
return
false
;
}
}
...
...
htdocs/api/xmlrpc/server.php
View file @
3da4e0f6
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
// 6010 The function does not exist
// 6010 The function does not exist
// 6011 The function does not exist
// 6011 The function does not exist
// 6012 Networking is disabled
// 6012 Networking is disabled
// 6013 Networking is not available at this address. You can access this service at get_config('wwwroot')api/xmlrpc/server.php'
define
(
'INTERNAL'
,
1
);
define
(
'INTERNAL'
,
1
);
define
(
'PUBLIC'
,
1
);
define
(
'PUBLIC'
,
1
);
...
@@ -69,6 +70,10 @@ if (empty($networkenabled)) {
...
@@ -69,6 +70,10 @@ if (empty($networkenabled)) {
exit
;
exit
;
}
}
if
(
get_hostname_from_uri
(
$_SERVER
[
'HTTP_HOST'
])
!=
get_hostname_from_uri
(
get_config
(
'wwwroot'
)))
{
throw
new
XmlrpcServerException
(
'Networking is not available at this address. You can access this service at '
.
get_config
(
'wwwroot'
)
.
'api/xmlrpc/server.php'
,
6013
);
}
// Content type for output is never html:
// Content type for output is never html:
header
(
'Content-type: text/xml; charset=utf-8'
);
header
(
'Content-type: text/xml; charset=utf-8'
);
ini_set
(
'display_errors'
,
0
);
ini_set
(
'display_errors'
,
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment