blob: c0259c2d0beacd0120ac95b14408bdd519b943cd (
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
|
<?php
require_once(__DIR__.DIRECTORY_SEPARATOR.'config.php');
// check user credentials
$config['logged_in'] = false;
$config['logged_in'] = check_login();
// subpages
if(is_numeric(path(0))) {
// show a single blog post
require_once(ROOT.DS.'single.inc.php');
} elseif(mb_strtolower(path(0)) === 'login') {
require_once(ROOT.DS.'loginform.inc.php');
} elseif(mb_strtolower(path(0)) === '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']);
die();
} elseif(mb_strtolower(path(0)) === 'new') {
require_once(ROOT.DS.'postform.inc.php');
} else {
// redirect everything else to the homepage
if(!empty(path(0)) && path(0) != 'page') {
header('Location: '.$config['url']);
die();
}
// show the homepage
require_once(ROOT.DS.'timeline.inc.php');
}
|