aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-10-13 07:15:14 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2023-10-13 07:15:14 +0000
commit75c06fc2d2da7dcd8ef5062ab588082378c08a5a (patch)
tree0ea4bccb6aa971c7cf2f645a402cfed7f6b1d227 /public
parent2735940656b21e96505ffa64d5e89f924a94a03f (diff)
fixes #3299, fixes #3300, fixes #3301, fixes #3302, fixes #3303
Closes #3299, #3300, #3301, #3302, and #3303 Merge request studip/studip!2267
Diffstat (limited to 'public')
-rw-r--r--public/jsonrpc.php28
-rw-r--r--public/xmlrpc.php33
2 files changed, 22 insertions, 39 deletions
diff --git a/public/jsonrpc.php b/public/jsonrpc.php
deleted file mode 100644
index 3a6c5c0..0000000
--- a/public/jsonrpc.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/*
- * jsonrpc.php - JSON-RPC Backend for Stud.IP web services
- *
- * Copyright (C) 2006 - Marcus Lunzenauer <mlunzena@uos.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- */
-
-require '../lib/bootstrap.php';
-require '../lib/webservices/webservices_bootstrap.php';
-
-# create server
-$dispatcher = new Studip_Ws_JsonrpcDispatcher($AVAILABLE_SERVICES);
-$server = new jsonrpc_server($dispatcher->get_dispatch_map(), 0);
-# $server->setDebug(3);
-# $server->compress_response = FALSE;
-
-# start server
-$server->service();
diff --git a/public/xmlrpc.php b/public/xmlrpc.php
index d2a8e14..8c0ffa6 100644
--- a/public/xmlrpc.php
+++ b/public/xmlrpc.php
@@ -15,11 +15,14 @@
* the License, or (at your option) any later version.
*/
+use PhpXmlRpc\Extras\XmlrpcSmartyTemplate;
+use PhpXmlRpc\PhpXmlRpc;
+
require '../lib/bootstrap.php';
require '../lib/webservices/webservices_bootstrap.php';
// Bootstrap documenting server
-class StudipDocumentingXmlRpcServer extends documenting_xmlrpc_server
+class StudipDocumentingXmlRpcServer extends \PhpXmlRpc\Extras\SelfDocumentingServer
{
public function checkAuth()
{
@@ -45,27 +48,35 @@ class StudipDocumentingXmlRpcServer extends documenting_xmlrpc_server
return parent::service($data, $return_payload, $doctype);
}
- public function generateDocs($server, $doctype='html', $lang='en', $editorpath='')
+ public function generateDocs($doctype='html', $lang='en', $editorpath='')
{
if ($doctype === 'html' && isset($_GET['methodName'])) {
$_GET['methodName'] = preg_replace('/[^a-zA-Z0-9_.:\/]/', '', $_GET['methodName']);
}
- parent::generateDocs($server, $doctype, $lang, $editorpath);
+ $documentationGenerator = new StudipServerDocumentor(new XmlrpcSmartyTemplate(null));
+ return $documentationGenerator->generateDocs($this, $doctype, $lang, $editorpath);
}
+}
- public function __get($key)
+class StudipServerDocumentor extends \PhpXmlRpc\Extras\ServerDocumentor
+{
+ public static function templates()
{
- if ($key === 'dmap') {
- return $this->allow_system_funcs
- ? array_merge($this->dmap, $this->getSystemDispatchMap())
- : $this->dmap;
- }
+ return array_merge(parent::templates(), [
+ 'docheader' => '<!DOCTYPE html>
+<html lang="{$lang}">
+<head>
+<meta name="generator" content="' . PhpXmlRpc::$xmlrpcName . '" />
+<link href="assets/stylesheets/webservices.css" type="text/css" rel="stylesheet" />
+{$extras}
+<title>{$title}</title>
+</head>
+<body>',
+ ]);
}
}
-$GLOBALS['_xmlrpcs_dmap'] = [];
-$GLOBALS['xmlrpcdocparts']['html']['docheader'] .= '<link href="assets/stylesheets/webservices.css" type="text/css" rel="stylesheet">';
# create server
$dispatcher = new Studip_Ws_XmlrpcDispatcher($AVAILABLE_SERVICES);