-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
42 lines (31 loc) · 1.32 KB
/
bootstrap.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
<?php
require __DIR__.'/vendor/autoload.php';
$app = new \Silex\Application();
$app['conftool.passPhrase'] = 'cG9v3N38';
$app['conftool.baseUrl'] = 'https://www.conftool.pro/esa2015/rest.php';
$app['conftool.createUrl'] = $app->protect(function($export = 'sessions', $query = []) use ($app) {
$nonce = time();
$pass = $app['conftool.passPhrase'];
$query = array_merge([
'nonce' => $nonce,
'passhash' => hash('sha256', $nonce . $pass),
'page' => 'adminExport',
'export_select' => $export, // Allowed values: papers, invitations, authors, subsumed_authors, topics, reviews, reviewers, sessions, participants, nametags, identities, event_participants, payments, identities
'form_export_format' => 'xml', //allowed: xml_short, csv_comma, csv_semicolon, and xls
'cmd_create_export' => true,
'form_export_sessions_options' => ['presentations', 'presentations_abstracts', 'all'],
], $query);
return $app['conftool.baseUrl'] . '?' . http_build_query($query);
});
$app['db.url'] = getenv('DATABASE_URL');
if (empty($app['db.url'])) {
throw new RuntimeException('Set DATABASE_URL environment variable.');
}
$app['db'] = $app->factory(function() use ($app) {
$conn = \Doctrine\DBAL\DriverManager::getConnection([
'url' => $app['db.url'],
]);
$conn->executeQuery("SET client_encoding = 'UTF8'");
return $conn;
});
return $app;