-
Notifications
You must be signed in to change notification settings - Fork 48
/
index.php
executable file
·78 lines (66 loc) · 1.99 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
/**
* Jobskee - open source job board
*
* @author Elinore Tenorio <[email protected]>
* @license MIT
* @url http://www.jobskee.com
*/
/*
* Load the configuration file
*/
require 'config.php';
/*
* Load category and city values
*/
$categories = Categories::findCategories();
$cities = Cities::findCities();
/*
* Load all existing controllers
*/
foreach (glob(CONTROLLER_PATH . "*.php") as $controller) {
require_once $controller;
}
/*
* Homepage
* Front page controller
*/
$app->get('/(:page)', function ($page=null) use ($app) {
global $categories;
global $lang;
if (isset($page) && $page != '') {
$content = R::findOne('pages', ' url=:url ', array(':url'=>$page));
if ($content && $content->id) {
// show page information
$seo_title = $content->name .' | '. APP_NAME;
$seo_desc = excerpt($content->description);
$seo_url = BASE_URL . $page;
$app->render(THEME_PATH . 'page.php',
array('lang' => $lang,
'seo_url'=>$seo_url,
'seo_title'=>$seo_title,
'seo_desc'=>$seo_desc,
'content'=>$content));
} else {
$app->flash('danger', $lang->t('alert|page_not_found'));
$app->redirect(BASE_URL, 404);
}
} else {
// show list of job
$seo_title = APP_NAME;
$seo_desc = APP_DESC;
$seo_url = BASE_URL;
$j = new Jobs();
foreach ($categories as $cat) {
$jobs[$cat->id] = $j->getJobs(ACTIVE, $cat->id, 0, HOME_LIMIT);
}
$app->render(THEME_PATH . 'home.php',
array('lang' => $lang,
'seo_url'=>$seo_url,
'seo_title'=>$seo_title,
'seo_desc'=>$seo_desc,
'jobs'=>$jobs));
}
});
// Run app
$app->run();