-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.php
44 lines (41 loc) · 1.4 KB
/
boot.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
spl_autoload_register(function ($class) {
$prefix = 'BePassword';
$base_dir = dirname(__FILE__) . '/src';
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
return;
}
$relative_class = substr($class, $len);
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
if (file_exists($file)) {
require $file;
}
});
if ('login' == rex_be_controller::getCurrentPage()) {
rex_view::addJsFile(rex_url::addonAssets('be_password', 'javascript/be_password.js'));
rex_view::addCssFile(rex_url::addonAssets('be_password', 'be_password.css'));
}
rex_extension::register('PACKAGES_INCLUDED', function () {
// mailer-klasse selbst laden... warum auch immer
require_once __DIR__ . '/../phpmailer/lib/mailer.php';
if (
isset($_GET['be_password_request'])
&& 2 <= substr_count($_GET['be_password_request'], '/')
) {
$a = explode('/', $_GET['be_password_request']);
$controller = ucfirst($a[1]);
$action = $a[2] . 'Action';
if (isset($a[3])) {
$arg = $a[3];
} else {
$arg = '';
}
$controller_file = ucfirst($a[1]) . 'Controller.php';
$controller_class = 'BePassword\Controller\\' . ucfirst($a[1]) . 'Controller';
$c = new $controller_class();
$content = $c->{$action}($arg);
echo $content;
die();
}
});