-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
50 lines (40 loc) · 1.57 KB
/
home.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
<?php
session_start();
require 'vendor/autoload.php';
require '_db/_db.php';
use Philo\Blade\Blade;
$views = __DIR__ . '/views';
$cache = __DIR__ . '/cache';
$key = 'OqsWo66JH24c87qrem7XcFXApz4pbe40';
$blade = new Blade($views, $cache);
$data = [];
$data['msg_errors'] = [];
$data['msg_success'] = [];
$data['styles'] = ['alertify/alertify.min', 'alertify/themes/semantic.min'];
$data['scripts'] = ['home'];
require '_login.php';
$data['projects'] = array();
$projects_r = db_x('SELECT GROUP_CONCAT(DISTINCT CONCAT(id,",",version) ORDER BY version DESC SEPARATOR ";") ids, title FROM projects WHERE user_id="'.$_SESSION['logged']['id'].'" AND status="open" GROUP BY saga_id ORDER BY title ASC;');
while ($project = db_fetch($projects_r)) {
$ids = explode(';', $project['ids']);
$project['ids'] = array();
foreach ($ids as $idpair) {
$project['ids'][] = explode(',', $idpair);
}
$data['projects'][] = $project;
}
/*
'candide.txt' => 'Candide de Voltaire',
'20000lieuessouslesmers.txt' => '20000 lieues sous les mers',
'lesmiserables.txt' => 'Les Misérables',
'lerougeetlenoir.txt' => 'Le Rouge et le Noir',
'madamebovary.txt' => 'Madame Bovary',
'sh.txt' => 'La simulation humaine',
'voyageauboutdelanuit.txt' => 'Voyage au bout de la nuit',
*/
$data['examples'] = array();
$exemples = db_s('projects', array('status' => 'sample'), array('title' => 'ASC'));
while ($e = db_fetch($exemples)) {
$data['examples'][$e['id']] = $e['title'];
}
echo $blade->view()->make('home',$data)->render();