-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
55 lines (42 loc) · 3.73 KB
/
index.php
File metadata and controls
55 lines (42 loc) · 3.73 KB
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
<?php
include_once LF.'system/lib/3rdparty/parsedown/Parsedown.php';
$page = (new LfPages)->getById($_app['ini']);
(new \lf\template)->appendTitle($page['title']);
$Parsedown = new Parsedown();
//echo '<h2>'.$page['title'].'</h2>';
// apploader for separate apps.
// this addresses the inability to have a home page composed of
$frame = $Parsedown->text($page['content']);
/* need to fix this */
$count = 1;
$cwd = getcwd();
preg_match_all('/{([^}]+)}/', $frame, $match);
foreach($match[1] as $replace)
{
$ini = NULL;
$vars = '';
if(!preg_match('/^'
.'(?:([^#?\/]+))' // [1] app
.'(?:\/([^\/#?]+))' // [2] /method
.'(?:#([^?]+))?' // [2] #vars
.'(?:\?(.*))?' // [3] ?ini
.'$/', $replace, $parts))
continue;
$app = $parts[1];
if(isset($parts[2]) && $parts[2] != '')
$controller = $parts[2];
if(isset($parts[3]) && $parts[3] != '')
$vars = explode('/', $parts[3]);
if(isset($parts[4]) && $parts[4] != '')
$ini = $parts[4];
chdir(LF.'apps/'.$app);
$ftimer = microtime(true);
//$frame = str_replace('{'.$replace.'}', $this->apploader($app, $ini, $vars), $frame);
$frame = str_replace('{'.$replace.'}', $this->apploader($controller, $ini, $vars), $frame);
// needs to be preg replace so it is replaced 1 time
/*$this->app_timer['Frontpage ('.$count++.') - '.$app.'/'.$vars[0]] = microtime(true) - $ftim
er; //timer for app*/
}
chdir($cwd);
echo $frame; //(new User)->resolveIds( $frame );
(new \lf\plugin)->run('post app pages');