From 91e44b203be3421e1e48e3cbdf7bb80b24b8291c Mon Sep 17 00:00:00 2001 From: daniwe4 Date: Thu, 8 Feb 2024 09:45:05 +0100 Subject: [PATCH] add resources to public folder --- .../ILIAS/AuthShibboleth/AuthShibboleth.php | 6 +- .../AuthShibboleth/resources/shib_login.php | 40 +++++ .../AuthShibboleth/resources/shib_logout.php | 170 ++++++++++++++++++ .../ILIAS/Authentication/Authentication.php | 3 + .../Authentication/resources/sessioncheck.php | 46 +++++ components/ILIAS/Feeds/Feeds.php | 6 +- components/ILIAS/Feeds/resources/feed.php | 51 ++++++ components/ILIAS/Feeds/resources/privfeed.php | 87 +++++++++ .../ILIAS/GlobalScreen/GlobalScreen.php | 3 + .../GlobalScreen/resources/gs_content.php | 46 +++++ components/ILIAS/Init/Init.php | 24 ++- components/ILIAS/Init/resources/error.php | 32 ++++ components/ILIAS/Init/resources/ilias.php | 0 components/ILIAS/Init/resources/index.php | 44 +++++ components/ILIAS/Init/resources/login.php | 30 ++++ components/ILIAS/Init/resources/logout.php | 21 +++ components/ILIAS/Init/resources/pwassist.php | 22 +++ components/ILIAS/Init/resources/register.php | 19 ++ components/ILIAS/Init/resources/sso/index.php | 32 ++++ components/ILIAS/LTI/LTI.php | 3 + components/ILIAS/LTI/resources/lti.php | 0 .../artifacts/object_specific_properties.php | 3 + .../ILIAS/OpenIdConnect/OpenIdConnect.php | 3 +- .../OpenIdConnect/resources/openidconnect.php | 26 +++ components/ILIAS/Saml/Saml.php | 3 +- components/ILIAS/Saml/resources/saml.php | 0 components/ILIAS/Scorm2004/Scorm2004.php | 6 +- .../ILIAS/Scorm2004/resources/storeScorm.php | 0 .../Scorm2004/resources/storeScorm2004.php | 61 +++++++ components/ILIAS/StaticURL/StaticURL.php | 3 + components/ILIAS/StaticURL/resources/goto.php | 32 ++++ components/ILIAS/WOPI/WOPI.php | 3 + .../ILIAS/WOPI/resources/wopi/index.php | 19 ++ components/ILIAS/WebDAV/WebDAV.php | 6 +- .../ILIAS/WebDAV/resources/rootindex.php | 24 +++ components/ILIAS/WebDAV/resources/webdav.php | 65 +++++++ .../soap/resources/soap/nusoapserver.php | 44 +++++ .../ILIAS/soap/resources/soap/server.php | 53 ++++++ components/ILIAS/soap/soap.php | 6 +- 39 files changed, 1034 insertions(+), 8 deletions(-) create mode 100644 components/ILIAS/AuthShibboleth/resources/shib_login.php create mode 100644 components/ILIAS/AuthShibboleth/resources/shib_logout.php create mode 100644 components/ILIAS/Authentication/resources/sessioncheck.php create mode 100644 components/ILIAS/Feeds/resources/feed.php create mode 100644 components/ILIAS/Feeds/resources/privfeed.php create mode 100644 components/ILIAS/GlobalScreen/resources/gs_content.php create mode 100644 components/ILIAS/Init/resources/error.php create mode 100644 components/ILIAS/Init/resources/ilias.php create mode 100644 components/ILIAS/Init/resources/index.php create mode 100644 components/ILIAS/Init/resources/login.php create mode 100644 components/ILIAS/Init/resources/logout.php create mode 100644 components/ILIAS/Init/resources/pwassist.php create mode 100644 components/ILIAS/Init/resources/register.php create mode 100644 components/ILIAS/Init/resources/sso/index.php create mode 100644 components/ILIAS/LTI/resources/lti.php create mode 100644 components/ILIAS/Object/artifacts/object_specific_properties.php create mode 100644 components/ILIAS/OpenIdConnect/resources/openidconnect.php create mode 100644 components/ILIAS/Saml/resources/saml.php create mode 100644 components/ILIAS/Scorm2004/resources/storeScorm.php create mode 100644 components/ILIAS/Scorm2004/resources/storeScorm2004.php create mode 100644 components/ILIAS/StaticURL/resources/goto.php create mode 100644 components/ILIAS/WOPI/resources/wopi/index.php create mode 100644 components/ILIAS/WebDAV/resources/rootindex.php create mode 100644 components/ILIAS/WebDAV/resources/webdav.php create mode 100644 components/ILIAS/soap/resources/soap/nusoapserver.php create mode 100644 components/ILIAS/soap/resources/soap/server.php diff --git a/components/ILIAS/AuthShibboleth/AuthShibboleth.php b/components/ILIAS/AuthShibboleth/AuthShibboleth.php index 57190e61e70a..52b528608a33 100644 --- a/components/ILIAS/AuthShibboleth/AuthShibboleth.php +++ b/components/ILIAS/AuthShibboleth/AuthShibboleth.php @@ -32,6 +32,10 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - // ... + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "shib_login.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "shib_logout.php"); } } diff --git a/components/ILIAS/AuthShibboleth/resources/shib_login.php b/components/ILIAS/AuthShibboleth/resources/shib_login.php new file mode 100644 index 000000000000..0611d1e039ed --- /dev/null +++ b/components/ILIAS/AuthShibboleth/resources/shib_login.php @@ -0,0 +1,40 @@ +http()->request()->getServerParams(); + +if ( + !isset($server['HTTP_SHIB_APPLICATION_ID']) + && !isset($server['Shib-Application-ID']) + && !isset($server['REDIRECT_Shib_Application_ID']) +) { + $factory = $DIC->ui()->factory(); + $message_box = $factory->messageBox()->failure("The file shib_login.php must be protected by Shibboleth, otherwise you cannot use Shibboleth authentication.")->withButtons([ + $factory->button()->standard('Open Documentation', './Services/AuthShibboleth/README.md') + ]); + + $DIC->ui()->mainTemplate()->setContent($DIC->ui()->renderer()->render($message_box)); + $DIC->ui()->mainTemplate()->printToStdout(); +} else { + // authentication is done here -> + // @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer. + // $DIC->ctrl()->setCmd('doShibbolethAuthentication'); + $DIC->ctrl()->callBaseClass(ilStartUpGUI::class); +} \ No newline at end of file diff --git a/components/ILIAS/AuthShibboleth/resources/shib_logout.php b/components/ILIAS/AuthShibboleth/resources/shib_logout.php new file mode 100644 index 000000000000..ca4e08403df2 --- /dev/null +++ b/components/ILIAS/AuthShibboleth/resources/shib_logout.php @@ -0,0 +1,170 @@ +http()->wrapper()->query(); +if ( + $q->has('return') + && $q->has('action') + && $q->retrieve('action', $DIC->refinery()->to()->string()) === 'logout' +) { + ilInitialisation::initILIAS(); + // Logout out user from application + // Destroy application session/cookie etc + $GLOBALS['DIC']['ilAuthSession']->logout(); + + // Finally, send user to the return URL + ilUtil::redirect($q->retrieve('action', $DIC->refinery()->kindlyTo()->string())); +} + +// Back channel logout // + +// Note: This is the preferred logout channel because it also allows +// administrative logout. However, it requires your application to be +// adapated in the sense that the user's Shibboleth session ID must be +// stored in the application's session data. +// See function LogoutNotification below + +elseif (!empty($HTTP_RAW_POST_DATA)) { + ilContext::init(ilContext::CONTEXT_SOAP); + + // Load ILIAS libraries and initialise ILIAS in non-web context + ilInitialisation::initILIAS(); + + // Set SOAP header + $server = new SoapServer('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '/LogoutNotification.wsdl'); + $server->addFunction("LogoutNotification"); + $server->handle(); +} + +// Return WSDL + +// Note: This is needed for the PHP SoapServer class. +// Since I'm not a web service guru it might be that the code below is not +// absolutely correct but at least it seems to to its job properly when it +// comes to Shibboleth logout + +else { + header('Content-Type: text/xml'); + + $url = filter_var("https://{$_SERVER['HTTP_HOST']}/shib_logout.php", FILTER_SANITIZE_URL); + + echo << + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +WSDL; + exit; +} + +/******************************************************************************/ +/// This function does the actual logout +function LogoutNotification($SessionID) +{ + // Delete session of user using $SessionID to locate the user's session file + // on the file system or in the database + // Then delete this entry or record to clear the session + // However, for that to work it is essential that the user's Shibboleth + // SessionID is stored in the user session data! + + global $ilDB; + + $q = "SELECT session_id, data FROM usr_session WHERE expires > 'NOW()'"; + $r = $ilDB->query($q); + + while ($session_entry = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) { + $user_session = unserializesession($session_entry['data']); + + // Look for session with matching Shibboleth session id + // and then delete this ilias session + foreach ($user_session as $user_session_entry) { + if (is_array($user_session_entry) + && array_key_exists('shibboleth_session_id', $user_session_entry) + && $user_session_entry['shibboleth_session_id'] == $SessionID + ) { + // Delete this session entry + if (ilSession::_destroy($session_entry['session_id']) !== true) { + return new SoapFault('LogoutError', 'Could not delete session entry in database.'); + } + } + } + } + // If no SoapFault is returned, all is fine +} + +/******************************************************************************/ +// Deserializes session data and returns it in a hash array of arrays +function unserializesession($serialized_string) +{ + $variables = array(); + $a = preg_split("/(\w+)\|/", $serialized_string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + for ($i = 0; $i < count($a); $i = $i + 2) { + $variables[$a[$i]] = unserialize($a[$i + 1]); + } + + return ($variables); +} \ No newline at end of file diff --git a/components/ILIAS/Authentication/Authentication.php b/components/ILIAS/Authentication/Authentication.php index 1a7f58cf8f18..3e096a126e0b 100644 --- a/components/ILIAS/Authentication/Authentication.php +++ b/components/ILIAS/Authentication/Authentication.php @@ -36,5 +36,8 @@ public function init( new \ilAuthenticationSetupAgent( $pull[\ILIAS\Refinery\Factory::class] ); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "sessioncheck.php"); } } diff --git a/components/ILIAS/Authentication/resources/sessioncheck.php b/components/ILIAS/Authentication/resources/sessioncheck.php new file mode 100644 index 000000000000..d49d7a95ce47 --- /dev/null +++ b/components/ILIAS/Authentication/resources/sessioncheck.php @@ -0,0 +1,46 @@ +http()->saveResponse( + ( + new ilSessionReminderCheck( + $DIC->http(), + $DIC->refinery(), + $DIC->language(), + $DIC->database(), + $DIC['ilClientIniFile'], + $DIC->logger()->auth(), + (new DataFactory())->clock()->utc() + ) + )->handle() +); +$DIC->http()->sendResponse(); +$DIC->http()->close(); \ No newline at end of file diff --git a/components/ILIAS/Feeds/Feeds.php b/components/ILIAS/Feeds/Feeds.php index 0d931aef436d..10224bced388 100644 --- a/components/ILIAS/Feeds/Feeds.php +++ b/components/ILIAS/Feeds/Feeds.php @@ -32,6 +32,10 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - // ... + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "privfeed.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "feed.php"); } } diff --git a/components/ILIAS/Feeds/resources/feed.php b/components/ILIAS/Feeds/resources/feed.php new file mode 100644 index 000000000000..4a21d2772e80 --- /dev/null +++ b/components/ILIAS/Feeds/resources/feed.php @@ -0,0 +1,51 @@ + + */ +ilContext::init(ilContext::CONTEXT_RSS); + +ilInitialisation::initILIAS(); +global $DIC; + +$getPar = static function (string $key, string $func) { + global $DIC; + return $DIC->http()->wrapper()->query()->has($key) + ? $DIC->http()->wrapper()->query()->retrieve( + $key, + $DIC->refinery()->kindlyTo()->$func() + ) : ($func === "int" ? 0 : ''); +}; + +$requested_user_id = $getPar("user_id", "int"); +$requested_ref_id = $getPar("ref_id", "int"); +$requested_purpose = $getPar("purpose", "string"); +$requested_blog_id = $getPar("blog_id", "string"); +$requested_hash = $getPar("hash", "string"); + +if ($requested_user_id > 0) { + $writer = new ilUserFeedWriter($requested_user_id, $requested_hash); + $writer->showFeed(); +} elseif ($requested_ref_id > 0) { + $writer = new ilObjectFeedWriter($requested_ref_id, false, $requested_purpose); + $writer->showFeed(); +} elseif ($requested_blog_id > 0) { + ilObjBlog::deliverRSS($requested_blog_id); +} \ No newline at end of file diff --git a/components/ILIAS/Feeds/resources/privfeed.php b/components/ILIAS/Feeds/resources/privfeed.php new file mode 100644 index 000000000000..a7e7ad4785c0 --- /dev/null +++ b/components/ILIAS/Feeds/resources/privfeed.php @@ -0,0 +1,87 @@ + + * @version $Id$ + */ + +ilContext::init(ilContext::CONTEXT_RSS_AUTH); + +ilInitialisation::initILIAS(); + +global $lng, $ilSetting; + +$feed_set = new ilSetting("news"); + + +if (!isset($_SERVER['PHP_AUTH_PW']) || !isset($_SERVER['PHP_AUTH_USER'])) { + Header("WWW-Authenticate: Basic realm=\"ILIAS Newsfeed\""); + Header("HTTP/1.0 401 Unauthorized"); + + exit; +} else { + if ($_GET["user_id"] != "" && ilObjUser::_getFeedPass($_GET["user_id"]) != "" && + (md5($_SERVER['PHP_AUTH_PW']) == ilObjUser::_getFeedPass($_GET["user_id"]) && + $_SERVER['PHP_AUTH_USER'] == ilObjUser::_lookupLogin($_GET["user_id"])) + && $feed_set->get("enable_private_feed")) { + include_once("./Services/Feeds/classes/class.ilUserFeedWriter.php"); + // Third parameter is true for private feed + $writer = new ilUserFeedWriter($_GET["user_id"], $_GET["hash"], true); + $writer->showFeed(); + } elseif ($_GET["ref_id"] != "" && md5($_SERVER['PHP_AUTH_PW']) == ilObjUser::_getFeedPass(ilObjUser::_lookupId($_SERVER['PHP_AUTH_USER']))) { + include_once("./Services/Feeds/classes/class.ilObjectFeedWriter.php"); + // Second parameter is optional to pass on to database-level to get news for logged-in users + $writer = new ilObjectFeedWriter($_GET["ref_id"], ilObjUser::_lookupId($_SERVER['PHP_AUTH_USER'])); + $writer->showFeed(); + } else { + // send appropriate header, if password is wrong, otherwise + // there is no chance to re-enter it (unless, e.g. the browser is closed) + if (md5($_SERVER['PHP_AUTH_PW']) != ilObjUser::_getFeedPass(ilObjUser::_lookupId($_SERVER['PHP_AUTH_USER']))) { + Header("WWW-Authenticate: Basic realm=\"ILIAS Newsfeed\""); + Header("HTTP/1.0 401 Unauthorized"); + exit; + } + + include_once("./Services/Feeds/classes/class.ilFeedItem.php"); + include_once("./Services/Feeds/classes/class.ilFeedWriter.php"); + + $blankFeedWriter = new ilFeedWriter(); + $feed_item = new ilFeedItem(); + $lng->loadLanguageModule("news"); + + if ($ilSetting->get('short_inst_name') != "") { + $blankFeedWriter->setChannelTitle($ilSetting->get('short_inst_name')); + } else { + $blankFeedWriter->setChannelTitle("ILIAS"); + } + + + + + if (!$feed_set->get("enable_private_feed")) { + $blankFeedWriter->setChannelAbout(ILIAS_HTTP_PATH); + $blankFeedWriter->setChannelLink(ILIAS_HTTP_PATH); + // title + $feed_item->setTitle($lng->txt("priv_feed_no_access_title")); + + // description + $feed_item->setDescription($lng->txt("priv_feed_no_access_body")); + $feed_item->setLink(ILIAS_HTTP_PATH); + } else { + $blankFeedWriter->setChannelAbout(ILIAS_HTTP_PATH); + $blankFeedWriter->setChannelLink(ILIAS_HTTP_PATH); + // title + $feed_item->setTitle($lng->txt("priv_feed_no_auth_title")); + + // description + $feed_item->setDescription($lng->txt("priv_feed_no_auth_body")); + $feed_item->setLink(ILIAS_HTTP_PATH); + } + $blankFeedWriter->addItem($feed_item); + $blankFeedWriter->showFeed(); + } +} \ No newline at end of file diff --git a/components/ILIAS/GlobalScreen/GlobalScreen.php b/components/ILIAS/GlobalScreen/GlobalScreen.php index e00f762fa530..851387c283d6 100644 --- a/components/ILIAS/GlobalScreen/GlobalScreen.php +++ b/components/ILIAS/GlobalScreen/GlobalScreen.php @@ -36,5 +36,8 @@ public function init( new \ilGlobalScreenSetupAgent( $pull[\ILIAS\Refinery\Factory::class] ); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "gs_content.php"); } } diff --git a/components/ILIAS/GlobalScreen/resources/gs_content.php b/components/ILIAS/GlobalScreen/resources/gs_content.php new file mode 100644 index 000000000000..6dc0912fdd98 --- /dev/null +++ b/components/ILIAS/GlobalScreen/resources/gs_content.php @@ -0,0 +1,46 @@ +globalScreen(); + + $GS->collector()->mainmenu()->collectStructure(); + $GS->collector()->mainmenu()->filterItemsByVisibilty(true); + $GS->collector()->mainmenu()->prepareItemsForUIRepresentation(); + + $unhash = $this->unhash($_GET['item']); + $identification = $GS->identification()->fromSerializedIdentification($unhash); + $item = $GS->collector()->mainmenu()->getSingleItemFromFilter($identification); + + if ($item instanceof Lost) { + $f = $DIC->ui()->factory(); + $component = $f->button()->bulky( + $f->symbol()->glyph()->login(), + $DIC->language()->txt('login'), + 'login.php?client_id=' . rawurlencode(CLIENT_ID) . '&cmd=force_login&lang=' . $DIC->user()->getCurrentLanguage() + ); + } else { + $component = $item->getTypeInformation()->getRenderer()->getComponentForItem($item, true); + } + echo $DIC->ui()->renderer()->renderAsync($component); + } +} + +if (php_sapi_name() !== 'cli') { + (new ContentRenderer())->run(); +} \ No newline at end of file diff --git a/components/ILIAS/Init/Init.php b/components/ILIAS/Init/Init.php index 4b448ef9c4ce..fbde0489395f 100644 --- a/components/ILIAS/Init/Init.php +++ b/components/ILIAS/Init/Init.php @@ -32,6 +32,28 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - // ... + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "register.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "pwassist.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "login.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "logout.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "index.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "ilias.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "error.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\ComponentResource($this, "sso/index.php", "sso"); } } diff --git a/components/ILIAS/Init/resources/error.php b/components/ILIAS/Init/resources/error.php new file mode 100644 index 000000000000..021593526b23 --- /dev/null +++ b/components/ILIAS/Init/resources/error.php @@ -0,0 +1,32 @@ +globalScreen()->tool()->context()->claim()->external(); + $local_tpl = new ilGlobalTemplate("tpl.main.html", true, true); + $local_tpl->addBlockFile("CONTENT", "content", "tpl.error.html"); + $lng->loadLanguageModule("error"); + // #13515 - link back to "system" [see ilWebAccessChecker::sendError()] + $nd = $tree->getNodeData(ROOT_FOLDER_ID); + $txt = $lng->txt('error_back_to_repository'); + $local_tpl->SetCurrentBlock("ErrorLink"); + $local_tpl->SetVariable("TXT_LINK", $txt); + $local_tpl->SetVariable("LINK", ilUtil::secureUrl(ILIAS_HTTP_PATH . '/ilias.php?baseClass=ilRepositoryGUI&client_id=' . CLIENT_ID)); + $local_tpl->ParseCurrentBlock(); + + ilSession::clear("referer"); + ilSession::clear("message"); + $tpl->setContent($local_tpl->get()); + $tpl->printToStdout(); +} catch (Exception $e) { + if (defined('DEVMODE') && DEVMODE) { + throw $e; + } + + if (!($e instanceof \PDOException)) { + die($e->getMessage()); + } +} \ No newline at end of file diff --git a/components/ILIAS/Init/resources/ilias.php b/components/ILIAS/Init/resources/ilias.php new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/components/ILIAS/Init/resources/index.php b/components/ILIAS/Init/resources/index.php new file mode 100644 index 000000000000..f0bb349e46ab --- /dev/null +++ b/components/ILIAS/Init/resources/index.php @@ -0,0 +1,44 @@ + + * @version $Id$ + * + * @package ilias + */ + +require_once '../vendor/composer/vendor/autoload.php'; +// jump to setup if ILIAS3 is not installed +if (!file_exists(getcwd() . "/../ilias.ini.php")) { + header("Location: ./cli/setup.php"); + exit(); +} + +// BEGIN WebDAV: Block WebDAV Requests from Microsoft WebDAV MiniRedir client. +// We MUST block WebDAV requests on the root page of the Web-Server +// in order to make the "Microsoft WebDAV MiniRedir" client work with ILIAS +// WebDAV. +// Important: If this index.php page is NOT at the root of your Web-Server, you +// MUST create an index page at the root of your Web-Server with the same +// blocking behaviour. If you don't implement this, the "Microsoft WebDAV +// MiniRedir" client will not work with ILIAS. +// You can copy the file rootindex.php for this. + +// Block WebDAV Requests from Microsoft WebDAV MiniRedir client. +if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND' + || $_SERVER['REQUEST_METHOD'] == 'OPTIONS') { + $status = '404 Not Found'; + header("HTTP/1.1 $status"); + header("X-WebDAV-Status: $status", true); + exit; +} +// END WebDAV: Block WebDAV Requests from Microsoft WebDAV MiniRedir client. + +ilInitialisation::initILIAS(); + +$ilCtrl->callBaseClass('ilStartUpGUI'); +$ilBench->save(); \ No newline at end of file diff --git a/components/ILIAS/Init/resources/login.php b/components/ILIAS/Init/resources/login.php new file mode 100644 index 000000000000..843be6692910 --- /dev/null +++ b/components/ILIAS/Init/resources/login.php @@ -0,0 +1,30 @@ + + * @author Peter Gabriel + * @version $Id$ + * + * @package ilias-layout + */ + +require_once '../vendor/composer/vendor/autoload.php'; + +// jump to setup if ILIAS3 is not installed +if (!file_exists(getcwd() . "/../ilias.ini.php")) { + header("Location: ./cli/setup.php"); + exit(); +} + +ilInitialisation::initILIAS(); + +// @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer. +// $ilCtrl->setCmd('showLoginPageOrStartupPage'); +$ilCtrl->callBaseClass('ilStartUpGUI'); +$ilBench->save(); + +exit; \ No newline at end of file diff --git a/components/ILIAS/Init/resources/logout.php b/components/ILIAS/Init/resources/logout.php new file mode 100644 index 000000000000..ce6c58473c90 --- /dev/null +++ b/components/ILIAS/Init/resources/logout.php @@ -0,0 +1,21 @@ + + * @version $Id$ + * + * @package ilias-core + */ + +ilInitialisation::initILIAS(); + +// @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer. +// $ilCtrl->setCmd('doLogout'); +$ilCtrl->callBaseClass('ilStartUpGUI'); +$ilBench->save(); + +exit; \ No newline at end of file diff --git a/components/ILIAS/Init/resources/pwassist.php b/components/ILIAS/Init/resources/pwassist.php new file mode 100644 index 000000000000..2038cd14747a --- /dev/null +++ b/components/ILIAS/Init/resources/pwassist.php @@ -0,0 +1,22 @@ + + * @version $Id$ + * + * @package ilias-core + */ + +ilInitialisation::initILIAS(); + +// @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer. +// $ilCtrl->setCmd('jumpToPasswordAssistance'); +$ilCtrl->callBaseClass('ilStartUpGUI'); +$ilBench->save(); + +exit; \ No newline at end of file diff --git a/components/ILIAS/Init/resources/register.php b/components/ILIAS/Init/resources/register.php new file mode 100644 index 000000000000..59cc654d4edc --- /dev/null +++ b/components/ILIAS/Init/resources/register.php @@ -0,0 +1,19 @@ + + * @version $Id$ + * + * @package ilias-core + */ + +ilInitialisation::initILIAS(); + +// @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer. +// $ilCtrl->setCmd("jumpToRegistration"); +$ilCtrl->callBaseClass('ilStartUpGUI'); +$ilBench->save(); \ No newline at end of file diff --git a/components/ILIAS/Init/resources/sso/index.php b/components/ILIAS/Init/resources/sso/index.php new file mode 100644 index 000000000000..a01505a0310e --- /dev/null +++ b/components/ILIAS/Init/resources/sso/index.php @@ -0,0 +1,32 @@ +setCmd('doApacheAuthentication'); +$ilCtrl->callBaseClass('ilStartUpGUI'); \ No newline at end of file diff --git a/components/ILIAS/LTI/LTI.php b/components/ILIAS/LTI/LTI.php index 397cb8506163..3c01d4315e39 100644 --- a/components/ILIAS/LTI/LTI.php +++ b/components/ILIAS/LTI/LTI.php @@ -36,5 +36,8 @@ public function init( new \ilLTISetupAgent( $pull[\ILIAS\Refinery\Factory::class] ); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "lti.php"); } } diff --git a/components/ILIAS/LTI/resources/lti.php b/components/ILIAS/LTI/resources/lti.php new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/components/ILIAS/Object/artifacts/object_specific_properties.php b/components/ILIAS/Object/artifacts/object_specific_properties.php new file mode 100644 index 000000000000..b1a021700e38 --- /dev/null +++ b/components/ILIAS/Object/artifacts/object_specific_properties.php @@ -0,0 +1,3 @@ + 'FileObjectProperties', +); \ No newline at end of file diff --git a/components/ILIAS/OpenIdConnect/OpenIdConnect.php b/components/ILIAS/OpenIdConnect/OpenIdConnect.php index 69df034a5dfe..360be13b6a53 100644 --- a/components/ILIAS/OpenIdConnect/OpenIdConnect.php +++ b/components/ILIAS/OpenIdConnect/OpenIdConnect.php @@ -32,6 +32,7 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - // ... + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "openidconnect.php"); } } diff --git a/components/ILIAS/OpenIdConnect/resources/openidconnect.php b/components/ILIAS/OpenIdConnect/resources/openidconnect.php new file mode 100644 index 000000000000..81c8bc69881c --- /dev/null +++ b/components/ILIAS/OpenIdConnect/resources/openidconnect.php @@ -0,0 +1,26 @@ + +// @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer. +// $DIC->ctrl()->setCmd('doOpenIdConnectAuthentication'); +$DIC->ctrl()->setTargetScript('ilias.php'); +$DIC->ctrl()->callBaseClass(ilStartUpGUI::class); \ No newline at end of file diff --git a/components/ILIAS/Saml/Saml.php b/components/ILIAS/Saml/Saml.php index 8e748b62a219..bdc460e30c81 100644 --- a/components/ILIAS/Saml/Saml.php +++ b/components/ILIAS/Saml/Saml.php @@ -32,6 +32,7 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - // ... + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "saml.php"); } } diff --git a/components/ILIAS/Saml/resources/saml.php b/components/ILIAS/Saml/resources/saml.php new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/components/ILIAS/Scorm2004/Scorm2004.php b/components/ILIAS/Scorm2004/Scorm2004.php index 38f528f7f7d0..30ec21cdc117 100644 --- a/components/ILIAS/Scorm2004/Scorm2004.php +++ b/components/ILIAS/Scorm2004/Scorm2004.php @@ -32,6 +32,10 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - // ... + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "storeScorm2004.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "storeScorm.php"); } } diff --git a/components/ILIAS/Scorm2004/resources/storeScorm.php b/components/ILIAS/Scorm2004/resources/storeScorm.php new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/components/ILIAS/Scorm2004/resources/storeScorm2004.php b/components/ILIAS/Scorm2004/resources/storeScorm2004.php new file mode 100644 index 000000000000..a33c6cc36cb4 --- /dev/null +++ b/components/ILIAS/Scorm2004/resources/storeScorm2004.php @@ -0,0 +1,61 @@ +database(); + +$packageId = $DIC->http()->wrapper()->query()->retrieve('package_id', $DIC->refinery()->kindlyTo()->int()); +$refId = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int()); +$doUnload = false; +if ($DIC->http()->wrapper()->query()->has('do')) { + if ($DIC->http()->wrapper()->query()->retrieve('do', $DIC->refinery()->kindlyTo()->string()) == "unload") { + $doUnload = true; + } +} + +$defaultLessonMode = "normal"; +$comments = true; +$interactions = true; +$objectives = true; +$time_from_lms = false; + +$lm_set = $ilDB->queryF( + 'SELECT default_lesson_mode, interactions, objectives, time_from_lms, comments FROM sahs_lm WHERE id = %s', + array('integer'), + array($packageId) +); +while ($lm_rec = $ilDB->fetchAssoc($lm_set)) { + $defaultLessonMode = ($lm_rec["default_lesson_mode"]); + $interactions = ilUtil::yn2tf($lm_rec["interactions"]); + $objectives = ilUtil::yn2tf($lm_rec["objectives"]); + $time_from_lms = ilUtil::yn2tf($lm_rec["time_from_lms"]); + $comments = ilUtil::yn2tf($lm_rec["comments"]); +} + +if ($doUnload) { + ilSCORM2004StoreData::scormPlayerUnload($packageId, $refId, $time_from_lms, null); +} else { +// $data = file_get_contents('php://input'); + ilSCORM2004StoreData::persistCMIData($packageId, $refId, $defaultLessonMode, $comments, $interactions, $objectives, $time_from_lms, null, null); +} \ No newline at end of file diff --git a/components/ILIAS/StaticURL/StaticURL.php b/components/ILIAS/StaticURL/StaticURL.php index f4ce746465f3..d6343bbdd9b6 100644 --- a/components/ILIAS/StaticURL/StaticURL.php +++ b/components/ILIAS/StaticURL/StaticURL.php @@ -36,5 +36,8 @@ public function init( new \ILIAS\StaticURL\SetupAgent( $pull[\ILIAS\Refinery\Factory::class] ); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "goto.php"); } } diff --git a/components/ILIAS/StaticURL/resources/goto.php b/components/ILIAS/StaticURL/resources/goto.php new file mode 100644 index 000000000000..a29cd7dbb9d6 --- /dev/null +++ b/components/ILIAS/StaticURL/resources/goto.php @@ -0,0 +1,32 @@ +handler()->performRedirect( + $static_url->builder()->getBaseURI() +); \ No newline at end of file diff --git a/components/ILIAS/WOPI/WOPI.php b/components/ILIAS/WOPI/WOPI.php index eef1052b06ba..9e3a5b8fa724 100644 --- a/components/ILIAS/WOPI/WOPI.php +++ b/components/ILIAS/WOPI/WOPI.php @@ -36,5 +36,8 @@ public function init( new \ilWOPISetupAgent( $pull[\ILIAS\Refinery\Factory::class] ); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\ComponentResource($this, "wopi/index.php", "wopi"); } } diff --git a/components/ILIAS/WOPI/resources/wopi/index.php b/components/ILIAS/WOPI/resources/wopi/index.php new file mode 100644 index 000000000000..7037e5f7bbb9 --- /dev/null +++ b/components/ILIAS/WOPI/resources/wopi/index.php @@ -0,0 +1,19 @@ +handleRequest(); \ No newline at end of file diff --git a/components/ILIAS/WebDAV/WebDAV.php b/components/ILIAS/WebDAV/WebDAV.php index 23a0d208c3f1..36d0b089fee9 100644 --- a/components/ILIAS/WebDAV/WebDAV.php +++ b/components/ILIAS/WebDAV/WebDAV.php @@ -32,6 +32,10 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - // ... + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "webdav.php"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\Endpoint($this, "rootindex.php"); } } diff --git a/components/ILIAS/WebDAV/resources/rootindex.php b/components/ILIAS/WebDAV/resources/rootindex.php new file mode 100644 index 000000000000..8ca0659b7593 --- /dev/null +++ b/components/ILIAS/WebDAV/resources/rootindex.php @@ -0,0 +1,24 @@ + + + 3.2.2 + Sabre\DAV\Exception\BadRequest + + '; + exit; +} + +if (!ilDAVActivationChecker::_isActive()) { + header("HTTP/1.1 403 Forbidden"); + header("X-WebDAV-Status: 403 Forbidden", true); + echo '

Sorry

' . + '

Please enable the WebDAV plugin in the ILIAS Administration panel.

' . + '

You can only access this page, if WebDAV is enabled on this server.

' . + ''; + exit; +} + +$webdav_dic = new ilWebDAVDIC(); +$webdav_dic->init($DIC); + +if ($show_mount_instr) { + $mount_gui = $webdav_dic->mountinstructions(); + $mount_gui->renderMountInstructionsContent(); +} else { + $server = new ilWebDAVRequestHandler($webdav_dic); + $server->handleRequest($post_array); +} \ No newline at end of file diff --git a/components/ILIAS/soap/resources/soap/nusoapserver.php b/components/ILIAS/soap/resources/soap/nusoapserver.php new file mode 100644 index 000000000000..14fb6d60917f --- /dev/null +++ b/components/ILIAS/soap/resources/soap/nusoapserver.php @@ -0,0 +1,44 @@ + + * @version $Id: server.php 14977 2007-10-12 11:58:35Z rkuester $ + * + * @package ilias + */ + +if (!defined('ILIAS_MODULE') || (defined('ILIAS_MODULE') && ILIAS_MODULE !== "components/ILIAS/soap")) { + //direct call to this endpoint + chdir("../.."); + define("ILIAS_MODULE", "components/ILIAS/soap"); + define("IL_SOAPMODE_NUSOAP", 0); + define("IL_SOAPMODE_INTERNAL", 1); + define("IL_SOAPMODE", IL_SOAPMODE_NUSOAP); +} + +$server = new ilNusoapUserAdministrationAdapter(true); +$server->start(); \ No newline at end of file diff --git a/components/ILIAS/soap/resources/soap/server.php b/components/ILIAS/soap/resources/soap/server.php new file mode 100644 index 000000000000..911c2aa5df80 --- /dev/null +++ b/components/ILIAS/soap/resources/soap/server.php @@ -0,0 +1,53 @@ + + * @version $Id$ + * + * @package ilias + */ + +chdir("../.."); +const ILIAS_MODULE = "components/ILIAS/soap"; +const IL_SOAPMODE_NUSOAP = 0; +const IL_SOAPMODE_INTERNAL = 1; + +// php7 only SOAPMODE_INTERNAL +const IL_SOAPMODE = IL_SOAPMODE_INTERNAL; +ilContext::init(ilContext::CONTEXT_SOAP); + +require_once("./Services/Init/classes/class.ilIniFile.php"); +$ilIliasIniFile = new ilIniFile("./ilias.ini.php"); +$ilIliasIniFile->read(); + +if ($ilIliasIniFile->readVariable('https', 'auto_https_detect_enabled')) { + $headerName = $ilIliasIniFile->readVariable('https', 'auto_https_detect_header_name'); + $headerValue = $ilIliasIniFile->readVariable('https', 'auto_https_detect_header_value'); + + $headerName = "HTTP_" . str_replace("-", "_", strtoupper($headerName)); + if (strcasecmp($_SERVER[$headerName], $headerValue) === 0) { + $_SERVER['HTTPS'] = 'on'; + } +} + +if (IL_SOAPMODE === IL_SOAPMODE_INTERNAL && strcasecmp($_SERVER["REQUEST_METHOD"], "post") === 0) { + // This is a SOAP request + include_once('components/ILIAS/soap/include/inc.soap_functions.php'); + $uri = ilSoapFunctions::buildHTTPPath() . '/public/soap/server.php'; + if (isset($_GET['client_id'])) { + $uri .= '?client_id=' . $_GET['client_id']; + $wsdl = $uri . '&wsdl'; + } else { + $wsdl = $uri . '?wsdl'; + } + $soapServer = new SoapServer($wsdl, array('uri' => $uri)); + $soapServer->setObject(new ilSoapFunctions()); + $soapServer->handle(); +} else { + // This is a request to display the available SOAP methods or WSDL... + include('public/soap/nusoapserver.php'); +} \ No newline at end of file diff --git a/components/ILIAS/soap/soap.php b/components/ILIAS/soap/soap.php index 088fd7d22e9e..d9db9a12e007 100644 --- a/components/ILIAS/soap/soap.php +++ b/components/ILIAS/soap/soap.php @@ -32,6 +32,10 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - // ... + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\ComponentResource($this, "soap/nusoapserver.php", "soap"); + + $contribute[Component\Resource\PublicAsset::class] = fn() => + new Component\Resource\ComponentResource($this, "soap/server.php", "soap"); } }