diff options
| author | André Noack <noack@data-quest.de> | 2024-09-03 19:09:43 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2024-09-03 19:09:43 +0000 |
| commit | 7074064de6df104bf63e7973a5b39843eacc51f5 (patch) | |
| tree | fbf2f299d49f1996466145c788dab4d7f9645c0b /public | |
| parent | 81e65905a0cba547701813ff1ef398a1e3406408 (diff) | |
Resolve "Ausbau der SOAP/XMLRPC Webservices"
Closes #4110
Merge request studip/studip!3361
Diffstat (limited to 'public')
| -rw-r--r-- | public/soap.php | 40 | ||||
| -rw-r--r-- | public/xmlrpc.php | 88 |
2 files changed, 0 insertions, 128 deletions
diff --git a/public/soap.php b/public/soap.php deleted file mode 100644 index a51dfcd..0000000 --- a/public/soap.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -# Lifter002: TODO -# Lifter007: TODO -# Lifter003: TODO -# Lifter010: TODO - -/* - * soap.php - SOAP 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'; - -$delegate = new Studip_Ws_SoapDispatcher($AVAILABLE_SERVICES); -$server = new DelegatingSoapServer($delegate); - -# use UTF-8 encoding -$server->soap_defencoding = 'UTF-8'; -$server->decode_utf8 = false; - -# creating WSDL -$namespace = 'urn:studip_wsd'; -$server->configureWSDL('Stud.IP Webservice', $namespace); -$server->wsdl->schemaTargetNamespace = $namespace; - -# register operations -$delegate->register_operations($server); - -# start server -$fp = fopen('php://input', 'rb'); -stream_filter_append($fp, 'dechunk', STREAM_FILTER_READ); -$server->service(stream_get_contents($fp)); - diff --git a/public/xmlrpc.php b/public/xmlrpc.php deleted file mode 100644 index 8c0ffa6..0000000 --- a/public/xmlrpc.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -# Lifter002: TODO -# Lifter007: TODO -# Lifter003: TODO -# Lifter010: TODO - -/* - * xmlrpc.php - XML-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. - */ - -use PhpXmlRpc\Extras\XmlrpcSmartyTemplate; -use PhpXmlRpc\PhpXmlRpc; - -require '../lib/bootstrap.php'; -require '../lib/webservices/webservices_bootstrap.php'; - -// Bootstrap documenting server -class StudipDocumentingXmlRpcServer extends \PhpXmlRpc\Extras\SelfDocumentingServer -{ - public function checkAuth() - { - $rules = WebserviceAccessRule::findByApiKey($_SERVER['PHP_AUTH_PW']); - if (count($rules) === 0) { - header('WWW-Authenticate: Basic realm="Please enter valid api key as password"'); - header('HTTP/1.0 401 Unauthorized'); - die('Please enter valid api key as password'); - } - } - - public function service($data = null, $return_payload = false, $doctype = '') - { - if ($_SERVER['REQUEST_METHOD'] !== 'POST') { - $this->checkAuth(); - } elseif( - isset($_SERVER['CONTENT_TYPE']) - && $_SERVER['CONTENT_TYPE'] === 'application/x-www-form-urlencoded' - && isset($_POST['methodCall']) - ) { - $this->checkAuth(); - } - return parent::service($data, $return_payload, $doctype); - } - - public function generateDocs($doctype='html', $lang='en', $editorpath='') - { - if ($doctype === 'html' && isset($_GET['methodName'])) { - $_GET['methodName'] = preg_replace('/[^a-zA-Z0-9_.:\/]/', '', $_GET['methodName']); - } - - $documentationGenerator = new StudipServerDocumentor(new XmlrpcSmartyTemplate(null)); - return $documentationGenerator->generateDocs($this, $doctype, $lang, $editorpath); - } -} - -class StudipServerDocumentor extends \PhpXmlRpc\Extras\ServerDocumentor -{ - public static function templates() - { - 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>', - ]); - } -} - - -# create server -$dispatcher = new Studip_Ws_XmlrpcDispatcher($AVAILABLE_SERVICES); - -$server = new StudipDocumentingXmlRpcServer($dispatcher->get_dispatch_map(), false); -$server->debug = false; - -# start server -$server->service(); |
