forked from f3-factory/F3com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
78 lines (62 loc) · 1.75 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
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
<?php
/**
F3::WIKI
The contents of f3 file are subject to the terms of the GNU General
Public License Version 3.0. You may not use f3 file except in
compliance with the license. Any of the license terms and conditions
can be waived if you get permission from the copyright holder.
Copyright (c) 2013 F3-Junkies
http://www.fatfreeframework.com
@version 0.8.0
**/
$f3 = require __DIR__.'/lib/base.php';
// set global vars
$f3->set('AUTOLOAD', 'inc/;app/');
$f3->set('DEBUG', 1);
$f3->set('TZ', 'Europe/Berlin');
$f3->set('CACHE', FALSE);
// set paths
$f3->set('UI', 'gui/');
$f3->set('LOCALES', 'dict/');
$f3->set('TEMP', 'temp/');
$f3->set('TMPL', 'tmpl/');
// markdown content data
$f3->set('MDCONTENT', 'content/');
// extend Template Engine
\Template::instance()->extend('navigation', '\Navigation\View::renderTag');
\Template::instance()->extend('select', '\ViewHelper::renderSelect');
\Template::instance()->extend('markdown', '\ViewHelper::renderMarkdown');
// init DB
$f3->set('DB',new DB\Jig('db/'));
// app vars
$f3->set('REPO', 'https://github.com/F3Community/F3com-data');
$f3->set('DOMAIN', 'fatfreeframework.com');
// ROUTING
// default page
$f3->route('GET /', function($f3) { $f3->reroute('/home'); });
// view page
$f3->route('GET /@page', '\Page\Controller->view');
// get edit form
$f3->route(
array(
'GET /create',
'GET /edit/@page',
'GET /edit/@page/@marker'
),
'\Page\Controller->edit'
);
// save page
$f3->route(
array(
'POST /edit',
'POST /edit/@page'
),
'\Page\Controller->save'
);
// delete page
$f3->route('GET /delete/@page', '\Page\Controller->delete');
// misc
$f3->route('GET /install', '\Common->installJIG');
$f3->set('ONERROR','\Common->error');
// kick start
$f3->run();