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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<?php
/* InstaDisc Series - A Four Project */
include('includes/instadisc.php');
function subscriptionInfo($id)
{
if (!instaDisc_subscriptionExists($id))
{
return new xmlrpcresp(new xmlrpcval('false', 'string'));
}
$sub = instaDisc_getSubscription($id);
return serialize(array( 'url' => $sub['url'],
'category' => $sub['category']
));
}
function getPasswordInfo($id)
{
if (!instaDisc_subscriptionExists($id))
{
return new xmlrpcresp(new xmlrpcval('false', 'string'));
}
$sub = instaDisc_getSubscription($id);
if ($sub['password'] == '')
{
return new xmlrpcresp(new xmlrpcval('false', 'string'));
} else {
$verID = rand(1,2147483647);
return new xmlrpcresp(new xmlrpcval(md5($sub['password'] . ':' . $verID) . ':' . $verID, 'string'));
}
}
function sendFromUpdate($username, $verification, $verificationID, $seriesURL, $seriesID, $title, $author, $url, $semantics, $encryptionID)
{
if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password'))
{
$getsub = "SELECT * FROM subscriptions WHERE identity = \"" . mysql_real_escape_string($seriesID) . "\"";
$getsub2 = mysql_query($getsub);
$getsub3 = mysql_fetch_array($getsub2);
if ($getsub3['identity'] == $seriesID)
{
if ($getsub3['username'] != $username)
{
return new xmlrpcresp(new xmlrpcval('1', 'int'));
}
$setsub = "UPDATE subscriptions SET title = \"" . mysql_real_escape_string($subscriptionTitle) . "\", url = \"" . mysql_real_escape_string($subscriptionURL) . "\", category = \"" . mysql_real_escape_string($subscriptionCategory) . "\", personal = \"" . mysql_real_escape_string($subscriptionPersonal) . "\"";
$setsub2 = mysql_query($setsub);
} else {
$inssub = "INSERT INTO subscriptions (identity, title, url, category, personal, username) VALUES (\"" . mysql_real_escape_string($seriesID) . "\",\"" . mysql_real_escape_string($subscriptionTitle) . "\",\"" . mysql_real_escape_string($subscriptionURL) . "\",\"" . mysql_real_escape_string($subscriptionCategory) . "\",\"" . mysql_real_escape_string($subscriptionPersonal) . "\",\"" . mysql_real_escape_string($username) . "\")";
$inssub2 = mysql_query($inssub);
}
$client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php');
$msg = new xmlrpcmsg("InstaDisc.sendFromSeries", array( new xmlrpcval($seriesURL, 'string'),
new xmlrpcval($seriesID, 'string'),
new xmlrpcval($title, 'string'),
new xmlrpcval($author, 'string'),
new xmlrpcval($url, 'string'),
new xmlrpcval($semantics, 'string'),
new xmlrpcval($encryptionID, 'int')));
$client->send($msg);
return new xmlrpcresp(new xmlrpcval('0', 'int'));
} else {
return new xmlrpcresp(new xmlrpcval('2', 'int'));
}
return new xmlrpcresp(new xmlrpcval('1', 'int'));
}
function initSubscription($username, $verification, $verificationID, $seriesURL, $subscriptionID, $subscriptionURL, $subscriptionTitle, $subscriptionCategory, $subscriptionPersonal)
{
if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password'))
{
$getsub = "SELECT * FROM subscriptions WHERE identity = \"" . mysql_real_escape_string($seriesID) . "\"";
$getsub2 = mysql_query($getsub);
$getsub3 = mysql_fetch_array($getsub2);
if ($getsub3['identity'] == $seriesID)
{
if ($getsub3['username'] != $username)
{
return new xmlrpcresp(new xmlrpcval('1', 'int'));
}
$setsub = "UPDATE subscriptions SET title = \"" . mysql_real_escape_string($subscriptionTitle) . "\", url = \"" . mysql_real_escape_string($subscriptionURL) . "\", category = \"" . mysql_real_escape_string($subscriptionCategory) . "\", personal = \"" . mysql_real_escape_string($subscriptionPersonal) . "\"";
$setsub2 = mysql_query($setsub);
} else {
$inssub = "INSERT INTO subscriptions (identity, title, url, category, personal, username) VALUES (\"" . mysql_real_escape_string($seriesID) . "\",\"" . mysql_real_escape_string($subscriptionTitle) . "\",\"" . mysql_real_escape_string($subscriptionURL) . "\",\"" . mysql_real_escape_string($subscriptionCategory) . "\",\"" . mysql_real_escape_string($subscriptionPersonal) . "\",\"" . mysql_real_escape_string($username) . "\")";
$inssub2 = mysql_query($inssub);
}
}
}
$s = new xmlrpc_server(array( "InstaDisc.subscriptionInfo" => array('function' => 'subscriptionInfo'),
"InstaDisc.getPasswordInfo" => array('function' => 'getPasswordInfo'),
"InstaDisc.sendFromUpdate" => array('function' => 'sendFromUpdate'),
"InstaDisc.initSubscription" => array('function' => 'initSubscription')
), 0);
$s->functions_parameters_type = 'phpvals';
$s->service();
?>
|