From fb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 28 Sep 2008 21:40:47 +0000 Subject: Central: Removed UI Refs #63 --- central/trunk/activate.php | 103 --------------- central/trunk/changepassword.php | 119 ------------------ central/trunk/index.php | 262 +++++++++++++++++++++++++++++++++++++- central/trunk/login.php | 87 ------------- central/trunk/logout.php | 11 -- central/trunk/register.php | 109 ---------------- central/trunk/userpanel.php | 24 ---- central/trunk/xmlrpc.php | 266 --------------------------------------- 8 files changed, 258 insertions(+), 723 deletions(-) delete mode 100644 central/trunk/activate.php delete mode 100644 central/trunk/changepassword.php delete mode 100644 central/trunk/login.php delete mode 100644 central/trunk/logout.php delete mode 100644 central/trunk/register.php delete mode 100644 central/trunk/userpanel.php delete mode 100644 central/trunk/xmlrpc.php (limited to 'central/trunk') diff --git a/central/trunk/activate.php b/central/trunk/activate.php deleted file mode 100644 index 9706a69..0000000 --- a/central/trunk/activate.php +++ /dev/null @@ -1,103 +0,0 @@ - 0) - { - showForm($_POST['username'], $_POST['code'], $errors); - } else { - if ($_POST['submit'] == "Verify") - { - if (instaDisc_activateAccount($_POST['username'], $_POST['code'])) - { - $template = new FITemplate('activated'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - $template->display(); - } else { - addError($numOfErrors, $errors, '', 'The email could not be sent'); - showForm($_POST['username'], $_POST['code'], $errors); - } - } else { - instaDisc_deactivateAccount($_POST['username'], $_POST['code']); - } - } -} - -function showForm($username, $code, $errors) -{ - $template = new FITemplate('activate'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - - if (isset($errors[1])) - { - $template->adds_block('ERROR', array('ex'=>'1')); - - foreach ($errors as $name => $value) - { - $template->adds_block('ERRORS', array( 'NAME' => $name, - 'MSG' => $value['msg'])); - } - } - - $template->add('USERNAME_ERR', ifErrors($errors, 'username')); - $template->add('CODE_ERR', ifErrors($errors, 'code')); - - doErrors($template, $errors, 'username'); - doErrors($template, $errors, 'code'); - - $template->add('USERNAME', $username); - $template->add('CODE', $code); - - $template->display(); -} - -function ifErrors($errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - return ' error'; - } - } - - return ''; -} - -function doErrors($template, $errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, - 'VALUE' => $value['msg'])); - } - } -} - -function addError(&$numOfErrors, &$errors, $field, $msg) -{ - $numOfErrors++; - $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); -} - -?> diff --git a/central/trunk/changepassword.php b/central/trunk/changepassword.php deleted file mode 100644 index 1b92666..0000000 --- a/central/trunk/changepassword.php +++ /dev/null @@ -1,119 +0,0 @@ - 0) - { - showForm($_POST['old'], $_POST['new'], $_POST['confirm'], $errors); - } else { - instaDisc_changePassword($_SESSION['username'], $_POST['new']); - - $template = new FITemplate('changedpassword'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - $template->display(); - } - } -} else { - header('Location: index.php'); -} - -function showForm($old, $new, $confirm, $errors) -{ - $template = new FITemplate('changepassword'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - - if (isset($errors[1])) - { - $template->adds_block('ERROR', array('ex'=>'1')); - - foreach ($errors as $name => $value) - { - $template->adds_block('ERRORS', array( 'NAME' => $name, - 'MSG' => $value['msg'])); - } - } - - $template->add('OLD_ERR', ifErrors($errors, 'old')); - $template->add('NEW_ERR', ifErrors($errors, 'new')); - $template->add('CONFIRM_ERR', ifErrors($errors, 'confirm')); - - doErrors($template, $errors, 'old'); - doErrors($template, $errors, 'new'); - doErrors($template, $errors, 'confirm'); - - $template->add('OLD', $old); - $template->add('NEW', $new); - $template->add('CONFIRM', $confirm); - - $template->display(); -} - -function ifErrors($errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - return ' error'; - } - } - - return ''; -} - -function doErrors($template, $errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, - 'VALUE' => $value['msg'])); - } - } -} - -function addError(&$numOfErrors, &$errors, $field, $msg) -{ - $numOfErrors++; - $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); -} - -?> diff --git a/central/trunk/index.php b/central/trunk/index.php index 703cab8..ea77e3f 100644 --- a/central/trunk/index.php +++ b/central/trunk/index.php @@ -2,11 +2,265 @@ /* InstaDisc Server - A Four Island Project */ +include('includes/xmlrpc/xmlrpc.inc'); +include('includes/xmlrpc/xmlrpcs.inc'); include('includes/instadisc.php'); -include('includes/template.php'); -$template = new FITemplate('index'); -$template->add('SITENAME', instaDisc_getConfig('siteName')); -$template->display(); +function checkRegistration($username, $verification, $verificationID) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + return new xmlrpcresp(new xmlrpcval(0, "int")); + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +function deleteItem($username, $verification, $verificationID, $id) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $getitem = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\" AND itemID = " . $id; + $getitem2 = mysql_query($getitem); + $getitem3 = mysql_fetch_array($getitem2); + if ($getitem3['itemID'] == $id) + { + $delitem = "DELETE FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\" AND itemID = " . $id; + $delitem2 = mysql_query($delitem); + + return new xmlrpcresp(new xmlrpcval(0, "int")); + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +function resendItem($username, $verification, $verificationID, $id) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $getitem = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\" AND itemID = " . $id; + $getitem2 = mysql_query($getitem); + $getitem3 = mysql_fetch_array($getitem2); + if ($getitem3['itemID'] == $id) + { + $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); + if ($getuser3['downloadItemMode'] == 'Push') + { + instaDisc_sendItem($username, $id); + + return new xmlrpcresp(new xmlrpcval(0, "int")); + } else if ($getuser3['downloadItemMode'] == 'Pull') + { + return new xmlrpcresp(new xmlrpcval(instaDisc_formItem($username, $id), 'string')); + } + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +function requestRetained($username, $verification, $verificationID) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); + if ($getuser3['downloadItemMode'] == 'Push') + { + $getitems = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\""; + $getitems2 = mysql_query($getitems); + $i=0; + while ($getitems3[$i] = mysql_fetch_array($getitems2)) + { + if (!instaDisc_sendItem($username, $getitems3[$i]['itemID'])) + { + return new xmlrpcresp(new xmlrpcval(1, "int")); + } + $i++; + } + + return new xmlrpcresp(new xmlrpcval(0, "int")); + } else if ($getuser3['downloadItemMode'] == 'Pull') + { + $getitems = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\" LIMIT 0,2"; + $getitems2 = mysql_query($getitems); + $getitems3 = mysql_fetch_array($getitems2); + $getitems4 = mysql_fetch_array($getitems2); + if ($getitems3['username'] == $username) + { + $item = instaDisc_formItem($username, $getitems3['id']); + if ($getitems4['username'] == $username) + { + $item .= 'More: ' . $getitems4['id'] . "\n"; + } + + return new xmlrpcresp(new xmlrpcval($item, 'string')); + } + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +function sendItem($username, $verification, $verificationID, $id) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); + if ($getuser3['downloadItemMode'] == 'Pull') + { + $getitems = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\" AND itemID > " . ($id-1) . " LIMIT 0,2"; + $getitems2 = mysql_query($getitems); + $getitems3 = mysql_fetch_array($getitems2); + $getitems4 = mysql_fetch_array($getitems2); + if ($getitems3['username'] == $username) + { + $item = instaDisc_formItem($username, $getitems3['id']); + if ($getitems4['username'] == $username) + { + $item .= 'More: ' . $getitems4['id'] . "\n"; + } + + return new xmlrpcresp(new xmlrpcval($item, 'string')); + } + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + + +function sendFromUpdate($subscriptionURL, $title, $author, $url, $semantics, $encryptionID) +{ + $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscriptionURL) . "\""; + $getsed2 = mysql_query($getsed); + $i=0; + while ($getsed3[$i] = mysql_fetch_array($getsed2)) + { + instaDisc_addItem($getsed3[$i]['username'], $subscriptionURL, $title, $author, $url, $semantics, $encryptionID); + $i++; + } + + return new xmlrpcresp(new xmlrpcval(0, "int")); +} + +function deleteSubscription($username, $verification, $verificationID, $subscription) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $getsub = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND username = \"" . mysql_real_escape_string($username) . "\""; + $getsub2 = mysql_query($getsub); + $getsub3 = mysql_fetch_array($getsub2); + if ($getsub3['url'] == $subscription) + { + $delsub = "DELETE FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND username = \"" . mysql_real_escape_string($username) . "\""; + $delsub2 = mysql_query($delsub); + + return new xmlrpcresp(new xmlrpcval(0, "int")); + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +function addSubscription($username, $verification, $verificationID, $subscription, $category) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $getsub = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND username = \"" . mysql_real_escape_string($username) . "\""; + $getsub2 = mysql_query($getsub) or die($getsub); + $getsub3 = mysql_fetch_array($getsub2); + if ($getsub3['url'] != $subscription) + { + $inssub = "INSERT INTO subscriptions (url, username, category) VALUES (\"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($category) . "\")"; + $inssub2 = mysql_query($inssub); + + return new xmlrpcresp(new xmlrpcval(0, "int")); + } + } + + return new xmlrpcresp(new xmlrpcval(1, "int")); +} + +function downloadItemModeTest() +{ + $fp = @fsockopen($_SERVER['REMOTE_ADDR'], 61200, $errno, $errstr); + if ($fp) + { + fwrite($fp, "InstaDisc Download Item Mode Test\r\n\r\n\r\n"); + fclose($fp); + return new xmlrpcresp(new xmlrpcval('0', 'int')); + } else { + return new xmlrpcresp(new xmlrpcval('1', 'int')); + } +} + +function setDownloadItemMode($username, $verification, $verificationID, $mode) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $setuser = "UPDATE users SET downloadItemMode = \"" . mysql_real_escape_string($mode) . "\" WHERE username = \"" . mysql_real_escape_string($username) . "\""; + $setuser2 = mysql_query($setuser); + + return new xmlrpcresp(new xmlrpcval('0', 'int')); + } + + return new xmlrpcresp(new xmlrpcval('1', 'int')); +} + +function initalizePort($username, $verification, $verificationID) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + return new xmlrpcresp(new xmlrpcval(instaDisc_initalizePort($username), 'int')); + } + + return new xmlrpcresp(new xmlrpcval('0', 'int')); +} + +function deinitalizePort($username, $verification, $verificationID) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $setuser = "UPDATE users SET port = 0 WHERE username = \"" . mysql_real_escape_string($username) . "\""; + $setuser2 = mysql_query($setuser); + + return new xmlrpcresp(new xmlrpcval('0', 'int')); + } + + return new xmlrpcresp(new xmlrpcval('1', 'int')); +} + +function countSubscribers($url) +{ + $cntsub = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($url) . "\""; + $cntsub2 = mysql_query($cntsub); + $cntsub3 = mysql_fetch_array($cntsub2); + + return new xmlrpcresp(new xmlrpcval($cntsub3[0], 'int')); +} + +$s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), + "InstaDisc.deleteItem" => array("function" => "deleteItem"), + "InstaDisc.resendItem" => array("function" => "resendItem"), + "InstaDisc.requestRetained" => array("function" => "requestRetained"), + "InstaDisc.sendItem" => array("function" => "sendItem"), + "InstaDisc.sendFromUpdate" => array("function" => "sendFromUpdate"), + "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription"), + "InstaDisc.addSubscription" => array("function" => "addSubscription"), + "InstaDisc.downloadItemModeTest" => array("function" => "downloadItemModeTest"), + "InstaDisc.setDownloadItemMode" => array("function" => "setDownloadItemMode"), + "InstaDisc.initalizePort" => array("function" => "initalizePort"), + "InstaDisc.deinitalizePort" => array("function" => "deinitalizePort"), + "InstaDisc.countSubscribers" => array("function" => "countSubscribers") + ),0); +$s->functions_parameters_type = 'phpvals'; +$s->service(); ?> diff --git a/central/trunk/login.php b/central/trunk/login.php deleted file mode 100644 index 19c5dc3..0000000 --- a/central/trunk/login.php +++ /dev/null @@ -1,87 +0,0 @@ -add('SITENAME', instaDisc_getConfig('siteName')); - $template->display(); - } else { - addError($numOfErrors, $errors, '', 'Account could not be found'); - showForm($_POST['username'], $_POST['password'], $errors); - } -} - -function showForm($username, $password, $errors) -{ - $template = new FITemplate('login'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - - if (isset($errors[1])) - { - $template->adds_block('ERROR', array('ex'=>'1')); - - foreach ($errors as $name => $value) - { - $template->adds_block('ERRORS', array( 'NAME' => $name, - 'MSG' => $value['msg'])); - } - } - - $template->add('USERNAME_ERR', ifErrors($errors, 'username')); - $template->add('PASSWORD_ERR', ifErrors($errors, 'password')); - - doErrors($template, $errors, 'username'); - doErrors($template, $errors, 'password'); - - $template->add('USERNAME', $username); - $template->add('PASSWORD', $password); - - $template->display(); -} - -function ifErrors($errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - return ' error'; - } - } - - return ''; -} - -function doErrors($template, $errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, - 'VALUE' => $value['msg'])); - } - } -} - -function addError(&$numOfErrors, &$errors, $field, $msg) -{ - $numOfErrors++; - $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); -} - -?> diff --git a/central/trunk/logout.php b/central/trunk/logout.php deleted file mode 100644 index e915329..0000000 --- a/central/trunk/logout.php +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/central/trunk/register.php b/central/trunk/register.php deleted file mode 100644 index 8a02d0c..0000000 --- a/central/trunk/register.php +++ /dev/null @@ -1,109 +0,0 @@ - 0) - { - showForm($_POST['username'], $_POST['password'], $_POST['email'], $errors); - } else { - $send = instaDisc_sendActivationEmail($_POST['username'], $_POST['password'], $_POST['email']); - if ($send === TRUE) - { - $template = new FITemplate('registered'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - $template->display(); - } else { - addError($numOfErrors, $errors, '', $send); - showForm($_POST['username'], $_POST['password'], $_POST['email'], $errors); - } - } -} - -function showForm($username, $password, $email, $errors) -{ - $template = new FITemplate('register'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - - if (isset($errors[1])) - { - $template->adds_block('ERROR', array('ex'=>'1')); - - foreach ($errors as $name => $value) - { - $template->adds_block('ERRORS', array( 'NAME' => $name, - 'MSG' => $value['msg'])); - } - } - - $template->add('USERNAME_ERR', ifErrors($errors, 'username')); - $template->add('PASSWORD_ERR', ifErrors($errors, 'password')); - $template->add('EMAIL_ERR', ifErrors($errors, 'email')); - - doErrors($template, $errors, 'username'); - doErrors($template, $errors, 'password'); - doErrors($template, $errors, 'email'); - - $template->add('USERNAME', $username); - $template->add('PASSWORD', $password); - $template->add('EMAIL', $email); - - $template->display(); -} - -function ifErrors($errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - return ' error'; - } - } - - return ''; -} - -function doErrors($template, $errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, - 'VALUE' => $value['msg'])); - } - } -} - -function addError(&$numOfErrors, &$errors, $field, $msg) -{ - $numOfErrors++; - $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); -} - -?> diff --git a/central/trunk/userpanel.php b/central/trunk/userpanel.php deleted file mode 100644 index d0570e1..0000000 --- a/central/trunk/userpanel.php +++ /dev/null @@ -1,24 +0,0 @@ -add('SITENAME', instaDisc_getConfig('siteName')); - $template->add('USERNAME', $_SESSION['username']); - - if (instaDisc_getConfig('owner') == $_SESSION['username']) - { - $template->adds_block('ADMIN',array('ex'=>1)); - } - - $template->display(); -} else { - header('Location: index.php'); -} - -?> diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php deleted file mode 100644 index ea77e3f..0000000 --- a/central/trunk/xmlrpc.php +++ /dev/null @@ -1,266 +0,0 @@ - " . ($id-1) . " LIMIT 0,2"; - $getitems2 = mysql_query($getitems); - $getitems3 = mysql_fetch_array($getitems2); - $getitems4 = mysql_fetch_array($getitems2); - if ($getitems3['username'] == $username) - { - $item = instaDisc_formItem($username, $getitems3['id']); - if ($getitems4['username'] == $username) - { - $item .= 'More: ' . $getitems4['id'] . "\n"; - } - - return new xmlrpcresp(new xmlrpcval($item, 'string')); - } - } - } - - return new xmlrpcresp(new xmlrpcval(1, "int")); -} - - -function sendFromUpdate($subscriptionURL, $title, $author, $url, $semantics, $encryptionID) -{ - $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscriptionURL) . "\""; - $getsed2 = mysql_query($getsed); - $i=0; - while ($getsed3[$i] = mysql_fetch_array($getsed2)) - { - instaDisc_addItem($getsed3[$i]['username'], $subscriptionURL, $title, $author, $url, $semantics, $encryptionID); - $i++; - } - - return new xmlrpcresp(new xmlrpcval(0, "int")); -} - -function deleteSubscription($username, $verification, $verificationID, $subscription) -{ - if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) - { - $getsub = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND username = \"" . mysql_real_escape_string($username) . "\""; - $getsub2 = mysql_query($getsub); - $getsub3 = mysql_fetch_array($getsub2); - if ($getsub3['url'] == $subscription) - { - $delsub = "DELETE FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND username = \"" . mysql_real_escape_string($username) . "\""; - $delsub2 = mysql_query($delsub); - - return new xmlrpcresp(new xmlrpcval(0, "int")); - } - } - - return new xmlrpcresp(new xmlrpcval(1, "int")); -} - -function addSubscription($username, $verification, $verificationID, $subscription, $category) -{ - if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) - { - $getsub = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND username = \"" . mysql_real_escape_string($username) . "\""; - $getsub2 = mysql_query($getsub) or die($getsub); - $getsub3 = mysql_fetch_array($getsub2); - if ($getsub3['url'] != $subscription) - { - $inssub = "INSERT INTO subscriptions (url, username, category) VALUES (\"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($category) . "\")"; - $inssub2 = mysql_query($inssub); - - return new xmlrpcresp(new xmlrpcval(0, "int")); - } - } - - return new xmlrpcresp(new xmlrpcval(1, "int")); -} - -function downloadItemModeTest() -{ - $fp = @fsockopen($_SERVER['REMOTE_ADDR'], 61200, $errno, $errstr); - if ($fp) - { - fwrite($fp, "InstaDisc Download Item Mode Test\r\n\r\n\r\n"); - fclose($fp); - return new xmlrpcresp(new xmlrpcval('0', 'int')); - } else { - return new xmlrpcresp(new xmlrpcval('1', 'int')); - } -} - -function setDownloadItemMode($username, $verification, $verificationID, $mode) -{ - if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) - { - $setuser = "UPDATE users SET downloadItemMode = \"" . mysql_real_escape_string($mode) . "\" WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $setuser2 = mysql_query($setuser); - - return new xmlrpcresp(new xmlrpcval('0', 'int')); - } - - return new xmlrpcresp(new xmlrpcval('1', 'int')); -} - -function initalizePort($username, $verification, $verificationID) -{ - if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) - { - return new xmlrpcresp(new xmlrpcval(instaDisc_initalizePort($username), 'int')); - } - - return new xmlrpcresp(new xmlrpcval('0', 'int')); -} - -function deinitalizePort($username, $verification, $verificationID) -{ - if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) - { - $setuser = "UPDATE users SET port = 0 WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $setuser2 = mysql_query($setuser); - - return new xmlrpcresp(new xmlrpcval('0', 'int')); - } - - return new xmlrpcresp(new xmlrpcval('1', 'int')); -} - -function countSubscribers($url) -{ - $cntsub = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($url) . "\""; - $cntsub2 = mysql_query($cntsub); - $cntsub3 = mysql_fetch_array($cntsub2); - - return new xmlrpcresp(new xmlrpcval($cntsub3[0], 'int')); -} - -$s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), - "InstaDisc.deleteItem" => array("function" => "deleteItem"), - "InstaDisc.resendItem" => array("function" => "resendItem"), - "InstaDisc.requestRetained" => array("function" => "requestRetained"), - "InstaDisc.sendItem" => array("function" => "sendItem"), - "InstaDisc.sendFromUpdate" => array("function" => "sendFromUpdate"), - "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription"), - "InstaDisc.addSubscription" => array("function" => "addSubscription"), - "InstaDisc.downloadItemModeTest" => array("function" => "downloadItemModeTest"), - "InstaDisc.setDownloadItemMode" => array("function" => "setDownloadItemMode"), - "InstaDisc.initalizePort" => array("function" => "initalizePort"), - "InstaDisc.deinitalizePort" => array("function" => "deinitalizePort"), - "InstaDisc.countSubscribers" => array("function" => "countSubscribers") - ),0); -$s->functions_parameters_type = 'phpvals'; -$s->service(); - -?> -- cgit 1.4.1