blob: 6b1a49cc9b82047991efe3d5a843a9cfa8f930af (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
<?php
require_once(__DIR__.DIRECTORY_SEPARATOR.'config.php');
// check user credentials
$config['logged_in'] = check_login();
$config['show_edits'] = !empty($config['show_edits']) ? $config['show_edits'] : true;
// subpages
$template = 'timeline';
if(is_numeric(path(0))) {
// show a single blog post
$template = 'single';
require_once(ROOT.DS.'templates'.DS.'single.inc.php');
} else {
$page = mb_strtolower(path(0));
// why?
// if($page == '.well_known' && path(1) == 'webfinger') { $page = 'webfinger'; }
switch($page) {
case 'login':
$template = 'login';
require_once(ROOT.DS.'templates'.DS.'loginform.inc.php');
break;
case 'logout':
$domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;
setcookie('microblog_login', '', time()-3600, '/', $domain, false);
unset($_COOKIE['microblog_login']);
header('Location: '.$config['url']);
break;
case 'new':
$template = 'postform';
require_once(ROOT.DS.'templates'.DS.'postform.inc.php');
break;
case 'rsd':
require_once(ROOT.DS.'lib'.DS.'rsd.xml.php');
break;
case 'xmlrpc':
require_once(ROOT.DS.'lib'.DS.'xmlrpc.php');
break;
case '.well-known':
if(!empty(path(1)) && path(1) == 'webfinger') {
require_once(ROOT.DS.'lib'.DS.'activitypub-webfinger.php');
} else {
http_response_code(404);
die();
}
break;
/*
case 'webfinger':
die('aaaa');
if(!empty(path(1)) && path(1) == 'webfinger') {
require_once(ROOT.DS.'lib'.DS.'activitypub-webfinger.php');
} else {
die('xxx');
http_response_code(404);
die();
}
die('abc');
break;
*/
case 'actor':
require_once(ROOT.DS.'lib'.DS.'activitypub-actor.php');
break;
case 'followers':
require_once(ROOT.DS.'lib'.DS.'activitypub-followers.php');
break;
case 'outbox':
require_once(ROOT.DS.'lib'.DS.'activitypub-outbox.php');
break;
case 'inbox':
require_once(ROOT.DS.'lib'.DS.'activitypub-inbox.php');
break;
default:
// redirect everything else to the homepage
if(!empty(path(0)) && path(0) != 'page') {
// die(path(0) . path(1) . 'WTF');
header('Location: '.$config['url']);
die();
}
// show the homepage
require_once(ROOT.DS.'templates'.DS.'timeline.inc.php');
break;
}
}
|