/var/www/html/moodle/lib/outputrequirementslib.php
* the call to print_header. If you call it when it is too late, an exception
* will be thrown.
*
* Even if a particular style sheet is requested more than once, it will only
* be linked to once.
*
* Please note use of this feature is strongly discouraged,
* it is suitable only for places where CSS is submitted directly by teachers.
* (Students must not be allowed to submit any external CSS because it may
* contain embedded javascript!). Example of correct use is mod/data.
*
* @param string $stylesheet The path to the .css file, relative to $CFG->wwwroot.
* For example:
* $PAGE->requires->css('mod/data/css.php?d='.$data->id);
*/
public function css($stylesheet) {
global $CFG;
if ($this->headdone) {
throw new coding_exception('Cannot require a CSS file after <head> has been printed.', $stylesheet);
}
if ($stylesheet instanceof moodle_url) {
// ok
} else if (strpos($stylesheet, '/') === 0) {
$stylesheet = new moodle_url($stylesheet);
} else {
throw new coding_exception('Invalid stylesheet parameter.', $stylesheet);
}
$this->cssurls[$stylesheet->out()] = $stylesheet;
}
/**
* Add theme stylesheet to page - do not use from plugin code,
* this should be called only from the core renderer!
*
* @param moodle_url $stylesheet
* @return void
*/
/var/www/html/moodle/local/accessibility/classes/hooks/output/before_http_headers.php
* Allow plugin to modify headers.
*
* @package local_accessibility
* @copyright 2024 Bartlomiej Jencz <bartlomiej.jencz@p.lodz.pl>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class before_http_headers {
/**
* Callback to allow modify headers.
*
* @param \core\hook\output\before_http_headers $hook
*/
public static function callback(\core\hook\output\before_http_headers $hook): void {
global $PAGE;
$widgetinstances = local_accessibility_getwidgetinstances();
if (!count($widgetinstances)) {
return;
}
/** @var \moodle_page $PAGE */
$PAGE->requires->css('/local/accessibility/styles.css');
$PAGE->requires->css('/local/accessibility/styles.php');
foreach ($widgetinstances as $widgetinstance) {
$widgetinstance->init();
}
}
}
/var/www/html/moodle/lib/classes/hook/manager.php
if (empty($callbacks)) {
// Nothing is interested in this hook.
return $event;
}
foreach ($callbacks as $callback) {
// Note: PSR-14 states:
// If passed a Stoppable Event, a Dispatcher
// MUST call isPropagationStopped() on the Event before each Listener has been called.
// If that method returns true it MUST return the Event to the Emitter immediately and
// MUST NOT call any further Listeners. This implies that if an Event is passed to the
// Dispatcher that always returns true from isPropagationStopped(), zero listeners will be called.
// Ergo, we check for a stopped event before calling each listener, not afterwards.
if ($event instanceof StoppableEventInterface) {
if ($event->isPropagationStopped()) {
return $event;
}
}
call_user_func($callback, $event);
}
// Developers need to be careful to not create infinite loops in hook callbacks.
return $event;
}
/**
* Initialise list of all callbacks for each hook.
*/
private function init_standard_callbacks(): void {
global $CFG;
$this->allcallbacks = [];
$this->alldeprecations = [];
$cache = null;
// @codeCoverageIgnoreStart
if (!PHPUNIT_TEST && !CACHE_DISABLE_ALL) {
$cache = \cache::make('core', 'hookcallbacks');
$callbacks = $cache->get('callbacks');
/var/www/html/moodle/lib/classes/hook/manager.php
if (empty($callbacks)) {
// Nothing is interested in this hook.
return $event;
}
foreach ($callbacks as $callback) {
// Note: PSR-14 states:
// If passed a Stoppable Event, a Dispatcher
// MUST call isPropagationStopped() on the Event before each Listener has been called.
// If that method returns true it MUST return the Event to the Emitter immediately and
// MUST NOT call any further Listeners. This implies that if an Event is passed to the
// Dispatcher that always returns true from isPropagationStopped(), zero listeners will be called.
// Ergo, we check for a stopped event before calling each listener, not afterwards.
if ($event instanceof StoppableEventInterface) {
if ($event->isPropagationStopped()) {
return $event;
}
}
call_user_func($callback, $event);
}
// Developers need to be careful to not create infinite loops in hook callbacks.
return $event;
}
/**
* Initialise list of all callbacks for each hook.
*/
private function init_standard_callbacks(): void {
global $CFG;
$this->allcallbacks = [];
$this->alldeprecations = [];
$cache = null;
// @codeCoverageIgnoreStart
if (!PHPUNIT_TEST && !CACHE_DISABLE_ALL) {
$cache = \cache::make('core', 'hookcallbacks');
$callbacks = $cache->get('callbacks');
/var/www/html/moodle/lib/outputrenderers.php
/**
* Start output by sending the HTTP headers, and printing the HTML <head>
* and the start of the <body>.
*
* To control what is printed, you should set properties on $PAGE.
*
* @return string HTML that you must output this, preferably immediately.
*/
public function header() {
global $USER, $CFG, $SESSION;
// Ensure that the callback exists prior to cache purge.
// This is a critical page path.
// TODO MDL-81134 Remove after LTS+1.
require_once(__DIR__ . '/classes/hook/output/before_http_headers.php');
$hook = new before_http_headers($this);
$hook->process_legacy_callbacks();
di::get(hook_manager::class)->dispatch($hook);
if (\core\session\manager::is_loggedinas()) {
$this->page->add_body_class('userloggedinas');
}
if (isset($SESSION->justloggedin) && !empty($CFG->displayloginfailures)) {
require_once($CFG->dirroot . '/user/lib.php');
// Set second parameter to false as we do not want reset the counter, the same message appears on footer.
if ($count = user_count_login_failures($USER, false)) {
$this->page->add_body_class('loginfailures');
}
}
// If the user is logged in, and we're not in initial install,
// check to see if the user is role-switched and add the appropriate
// CSS class to the body element.
if (!during_initial_install() && isloggedin() && is_role_switched($this->page->course->id)) {
$this->page->add_body_class('userswitchedrole');
}
/var/www/html/moodle/login/forgot_password.php
if (!empty($SESSION->password_reset_token)) {
$token = $SESSION->password_reset_token;
unset($SESSION->password_reset_token);
$tokeninsession = true;
}
if (empty($token)) {
core_login_process_password_reset_request();
} else {
if (!$tokeninsession && $_SERVER['REQUEST_METHOD'] === 'GET') {
$SESSION->password_reset_token = $token;
redirect($CFG->wwwroot . '/login/forgot_password.php');
} else {
core_login_process_password_set($token);
}
}
$mform = new login_forgot_password_form();
echo $OUTPUT->header();
?>
<div class="d-flex row">
<div class="col-xl-4 col-lg-5 col-md-8 col-sm-10 mx-auto">
<img src="{{{logourl}}}" alt="Login image" width="120" />
<h2 class="text-dark">Forgot Password</h2>
<p>Don't worry, it happens to the best of us. Enter your phone number to get a password reset verification code.</p>
<?php
$mform->display();
?>
<a href="login.php">Go back to login</a>
</div>
</div>
<?php
echo $OUTPUT->footer();