-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.php
38 lines (28 loc) · 975 Bytes
/
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
<?php
require_once 'vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
$app = new Silex\Application();
$app->register(
new Silex\Provider\TwigServiceProvider(),
array(
'twig.path' => __DIR__.'/views'
)
);
$app['skype'] = $app->share(function() {
return Inviqa\SkypeEngine::getDbusProxy();
});
$app['bot'] = $app->protect(function($dbus) {
$bot = new Inviqa\SkypeEngine($dbus);
return $bot;
});
$app->get('/', function() use ($app) {
return $app['twig']->render('index.twig', array());
});
$app->post('/', function(Request $request) use ($app) {
$username = $request->request->get('username');
$app['skype']->Invoke( "SET USER $username ISAUTHORIZED TRUE" );
$app['skype']->Invoke( "SET USER $username ISBLOCKED FALSE" );
$app['bot']($app['skype'])->parse($app['skype']->Invoke( "SET USER $username BUDDYSTATUS 2"));
return $app['twig']->render('thanks.twig', array());
});
$app->run();