-
Notifications
You must be signed in to change notification settings - Fork 1
/
handler.php
53 lines (48 loc) · 1.38 KB
/
handler.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
<?php
//ini_set('display_errors', 1);
include 'SoMail.php';
$db;
mysqlSetup($db);
//echo $_SERVER['REQUEST_URI'];
// find the function/method to call
$callback = NULL;
if (preg_match('/api\/([^\/\?]+)/', $_SERVER['REQUEST_URI'], $m)) {
$callback = $m[1];
}
//echo "\n$callback\n";
switch ($callback) {
case 'findPath':
// echo "findPath";
if(!isset($_REQUEST['uid'],$_REQUEST['from'],$_REQUEST['to']))
echo -2;
else
echo findPath($_REQUEST['uid'],$_REQUEST['from'],$_REQUEST['to']);
break;
case 'verifyXdsl':
if(!isset($_REQUEST['xdsl'], $_REQUEST['to'], $_REQUEST['uid']))
echo -2;
else
{
$xdslPath=verifyXdsl($_REQUEST['xdsl'], trim($_REQUEST['to'],","), $_REQUEST['uid'], $db);
if($xdslPath != "Can't verify X-DSL.")
echo "<div id=\"xdslTrust\" style=\"display: none;\">". $_REQUEST['xdsl'] . "," .
origXdslTrust($_REQUEST['uid'], $_REQUEST['xdsl'], $db) . "," .
xdslTrust($_REQUEST['uid'], $_REQUEST['xdsl'], $db) .
"</div>";
echo $xdslPath;
}
break;
case 'registerXdsl':
if(!isset($_REQUEST['uid'], $_REQUEST['paths']))
echo -2;
else
echo registerXdsl($_REQUEST['uid'], $_REQUEST['paths'], $db);
break;
case 'xdslTrust':
if(!isset($_REQUEST['xdsl'], $_REQUEST['uid']))
echo -2;
else
echo origXdslTrust($_REQUEST['uid'], $_REQUEST['xdsl'], $db) .",".xdslTrust($_REQUEST['uid'], $_REQUEST['xdsl'], $db);
break;
}
?>