mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
All of these are sourcing function libraries so we don't need to include them more than once. Things that insert actual HTML into the output were left calling include(). Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Loui Chang <louipc.ist@gmail.com>
34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
<?php
|
|
|
|
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
|
|
|
|
include_once("aurjson.class.php");
|
|
|
|
if ( $_SERVER['REQUEST_METHOD'] == 'GET' ) {
|
|
if ( isset($_GET['type']) ) {
|
|
$rpc_o = new AurJSON();
|
|
echo $rpc_o->handle($_GET);
|
|
}
|
|
else {
|
|
// dump a simple usage output for people to use.
|
|
// this could be moved to an api doc in the future, or generated from
|
|
// the AurJSON class directly with phpdoc. For now though, just putting it here.
|
|
echo '<html><body>';
|
|
echo 'The methods currently allowed are: <br />';
|
|
echo '<ul>';
|
|
echo '<li>search</li>';
|
|
echo '<li>info</li>';
|
|
echo '</ul><br />';
|
|
echo 'Each method requires the following HTTP GET syntax:<br />';
|
|
echo ' type=<i>methodname</i>&arg=<i>data</i> <br /><br />';
|
|
echo 'Where <i>methodname</i> is the name of an allowed method, and <i>data</i> is the argument to the call.<br />';
|
|
echo '<br />';
|
|
echo 'If you need jsonp type callback specification, you can provide an additional variable <i>callback</i>.<br />';
|
|
echo 'Example URL: <br /> http://aur-url/rpc.php?type=search&arg=foobar&callback=jsonp1192244621103';
|
|
echo '</body></html>';
|
|
}
|
|
}
|
|
else {
|
|
echo 'POST NOT SUPPORTED';
|
|
}
|
|
?>
|