forked from phoboslab/Asaph
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
39 lines (32 loc) · 1.07 KB
/
index.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
<?php
// Asaph-PHP7 v1.1 - https://github.com/remouk/Asaph-PHP7/
define( 'ASAPH_PATH', '' );
require_once( ASAPH_PATH.'lib/asaph.class.php' );
header( 'Content-type: text/html; charset=utf-8' );
// Is mod_rewrite enabled? (see .htaccess)
if( isset($_GET['rw']) ) {
define( 'ASAPH_LINK_PREFIX', Asaph_Config::$absolutePath );
$params = explode( '/', $_GET['rw'] );
} else {
define( 'ASAPH_LINK_PREFIX', Asaph_Config::$absolutePath.'?' );
$params = empty($_GET) ? array() : explode( '/', key($_GET) );
}
// about page
if( !empty($params[0]) && $params[0] == 'about' ) {
include( ASAPH_PATH.Asaph_Config::$templates['about'] );
}
// feed
else if( !empty($params[0]) && $params[0] == 'feed' ) {
$asaph = new Asaph( Asaph_Config::$postsPerPage );
$posts = $asaph->getPosts( 0 );
include( ASAPH_PATH.Asaph_Config::$templates['feed'] );
}
// blog
else {
$page = !empty($params[1]) ? $params[1]-1 : 0;
$asaph = new Asaph( Asaph_Config::$postsPerPage );
$posts = $asaph->getPosts( $page );
$pages = $asaph->getPages();
include( ASAPH_PATH.Asaph_Config::$templates['posts'] );
}
?>