diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-06 21:42:34 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-06 21:42:34 +0000 |
commit | fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0 (patch) | |
tree | ef4aca9adde8522de8d3e6f56107045be00799f1 /central | |
parent | 0b80d600e22ac218a59e1c09967a3caee91b1981 (diff) | |
download | instadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.tar.gz instadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.tar.bz2 instadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.zip |
Central: Started moving to Series
Refs #28
Diffstat (limited to 'central')
-rw-r--r-- | central/trunk/activatesub.php | 124 | ||||
-rw-r--r-- | central/trunk/addsub.php | 94 | ||||
-rw-r--r-- | central/trunk/includes/instadisc.php | 142 | ||||
-rw-r--r-- | central/trunk/instadisc.sql | 54 | ||||
-rw-r--r-- | central/trunk/mansub.php | 27 | ||||
-rw-r--r-- | central/trunk/theme/activatedsub.tpl | 14 | ||||
-rw-r--r-- | central/trunk/theme/activatesub.tpl | 51 | ||||
-rw-r--r-- | central/trunk/theme/addedsub.tpl | 17 | ||||
-rw-r--r-- | central/trunk/theme/addsub.tpl | 50 | ||||
-rw-r--r-- | central/trunk/theme/mansub.tpl | 30 | ||||
-rw-r--r-- | central/trunk/theme/userpanel.tpl | 6 | ||||
-rw-r--r-- | central/trunk/xmlrpc.php | 83 |
12 files changed, 66 insertions, 626 deletions
diff --git a/central/trunk/activatesub.php b/central/trunk/activatesub.php deleted file mode 100644 index 46a05ec..0000000 --- a/central/trunk/activatesub.php +++ /dev/null | |||
@@ -1,124 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Server - A Four Island Project */ | ||
4 | |||
5 | include('includes/instadisc.php'); | ||
6 | include('includes/template.php'); | ||
7 | |||
8 | if (isset($_SESSION['username'])) | ||
9 | { | ||
10 | if (!isset($_GET['submit'])) | ||
11 | { | ||
12 | showForm('',array()); | ||
13 | } else { | ||
14 | $numOfErrors = 0; | ||
15 | $errors = array(); | ||
16 | |||
17 | $getpending = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($_SESSION['username']) . "\" AND url = \"" . mysql_real_escape_string($_POST['url']) . "\""; | ||
18 | $getpending2 = mysql_query($getpending); | ||
19 | $getpending3 = mysql_fetch_array($getpending2); | ||
20 | if ($getpending3['username'] != $_POST['username']) | ||
21 | { | ||
22 | addError($numOfErrors, $errors, 'url', 'Subscription could not be found'); | ||
23 | } | ||
24 | |||
25 | if ($numOfErrors > 0) | ||
26 | { | ||
27 | showForm($_POST['url'], $errors); | ||
28 | } else { | ||
29 | if ($_POST['submit'] == "Verify") | ||
30 | { | ||
31 | switch (instaDisc_addSubscription($_SESSION['username'], $_POST['url'])) | ||
32 | { | ||
33 | case 0: | ||
34 | $template = new FITemplate('activatedsub'); | ||
35 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
36 | $template->display(); | ||
37 | break; | ||
38 | |||
39 | case 1: | ||
40 | addError($numOfErrors, $errors, '', 'Unknown error'); | ||
41 | showForm($_POST['url'], $errors); | ||
42 | break; | ||
43 | |||
44 | case 2: | ||
45 | addError($numOfErrors, $errors, 'url', 'Subscription could not be found'); | ||
46 | showForm($_POST['url'], $errors); | ||
47 | break; | ||
48 | |||
49 | case 3: | ||
50 | addError($numOfErrors, $errors, '', 'Subscription File is not well-formed'); | ||
51 | showForm($_POST['url'], $errors); | ||
52 | break; | ||
53 | |||
54 | case 4: | ||
55 | addError($numOfErrors, $errors, '', 'Key in Subscription File is incorrect'); | ||
56 | showForm($_POST['url'], $errors); | ||
57 | break; | ||
58 | } | ||
59 | } else { | ||
60 | instaDisc_cancelSubscription($_SESSION['username'], $_POST['url']); | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | } else { | ||
65 | header('Location: index.php'); | ||
66 | } | ||
67 | |||
68 | function showForm($url, $errors) | ||
69 | { | ||
70 | $template = new FITemplate('activatesub'); | ||
71 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
72 | |||
73 | if (isset($errors[1])) | ||
74 | { | ||
75 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
76 | |||
77 | foreach ($errors as $name => $value) | ||
78 | { | ||
79 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
80 | 'MSG' => $value['msg'])); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | $template->add('URL_ERR', ifErrors($errors, 'url')); | ||
85 | |||
86 | doErrors($template, $errors, 'url'); | ||
87 | |||
88 | $template->add('URL', $url); | ||
89 | |||
90 | $template->display(); | ||
91 | } | ||
92 | |||
93 | function ifErrors($errors, $id) | ||
94 | { | ||
95 | foreach ($errors as $name => $value) | ||
96 | { | ||
97 | if ($value['field'] == $id) | ||
98 | { | ||
99 | return ' error'; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | return ''; | ||
104 | } | ||
105 | |||
106 | function doErrors($template, $errors, $id) | ||
107 | { | ||
108 | foreach ($errors as $name => $value) | ||
109 | { | ||
110 | if ($value['field'] == $id) | ||
111 | { | ||
112 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
113 | 'VALUE' => $value['msg'])); | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
119 | { | ||
120 | $numOfErrors++; | ||
121 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
122 | } | ||
123 | |||
124 | ?> | ||
diff --git a/central/trunk/addsub.php b/central/trunk/addsub.php deleted file mode 100644 index fd46234..0000000 --- a/central/trunk/addsub.php +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Server - A Four Island Project */ | ||
4 | |||
5 | include('includes/instadisc.php'); | ||
6 | include('includes/template.php'); | ||
7 | |||
8 | if (!isset($_GET['submit'])) | ||
9 | { | ||
10 | showForm('',array()); | ||
11 | } else { | ||
12 | $numOfErrors = 0; | ||
13 | $errors = array(); | ||
14 | |||
15 | if ($_POST['url'] == '') | ||
16 | { | ||
17 | addError($numOfErrors, $errors, 'url', 'URL is a required field'); | ||
18 | } | ||
19 | |||
20 | if ($numOfErrors > 0) | ||
21 | { | ||
22 | showForm($_POST['url'], $errors); | ||
23 | } else { | ||
24 | $key = instaDisc_generateSubscriptionActivation($_SESSION['username'], $_POST['url']); | ||
25 | if ($key !== FALSE) | ||
26 | { | ||
27 | $template = new FITemplate('addedsub'); | ||
28 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
29 | $template->add('KEY', $key); | ||
30 | $template->display(); | ||
31 | } else { | ||
32 | addError($numOfErrors, $errors, '', 'Unknown error'); | ||
33 | showForm($_POST['url'], $errors); | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | |||
38 | function showForm($url, $errors) | ||
39 | { | ||
40 | $template = new FITemplate('addsub'); | ||
41 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
42 | |||
43 | if (isset($errors[1])) | ||
44 | { | ||
45 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
46 | |||
47 | foreach ($errors as $name => $value) | ||
48 | { | ||
49 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
50 | 'MSG' => $value['msg'])); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | $template->add('URL_ERR', ifErrors($errors, 'url')); | ||
55 | |||
56 | doErrors($template, $errors, 'url'); | ||
57 | |||
58 | $template->add('URL', $url); | ||
59 | |||
60 | $template->display(); | ||
61 | } | ||
62 | |||
63 | function ifErrors($errors, $id) | ||
64 | { | ||
65 | foreach ($errors as $name => $value) | ||
66 | { | ||
67 | if ($value['field'] == $id) | ||
68 | { | ||
69 | return ' error'; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | return ''; | ||
74 | } | ||
75 | |||
76 | function doErrors($template, $errors, $id) | ||
77 | { | ||
78 | foreach ($errors as $name => $value) | ||
79 | { | ||
80 | if ($value['field'] == $id) | ||
81 | { | ||
82 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
83 | 'VALUE' => $value['msg'])); | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | |||
88 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
89 | { | ||
90 | $numOfErrors++; | ||
91 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
92 | } | ||
93 | |||
94 | ?> | ||
diff --git a/central/trunk/includes/instadisc.php b/central/trunk/includes/instadisc.php index d00893b..3f3922a 100644 --- a/central/trunk/includes/instadisc.php +++ b/central/trunk/includes/instadisc.php | |||
@@ -271,148 +271,6 @@ function instaDisc_getConfig($key) | |||
271 | return $getconfig3['value']; | 271 | return $getconfig3['value']; |
272 | } | 272 | } |
273 | 273 | ||
274 | function instaDisc_listSubscriptions($username) | ||
275 | { | ||
276 | $getsubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND owner = \"true\""; | ||
277 | $getsubs2 = mysql_query($getsubs); | ||
278 | $i=0; | ||
279 | while ($getsubs3[$i] = mysql_fetch_array($getsubs2)) | ||
280 | { | ||
281 | $subs[$i] = $getsubs3[$i]['url']; | ||
282 | |||
283 | $i++; | ||
284 | } | ||
285 | |||
286 | $subs['size'] = $i; | ||
287 | return $subs; | ||
288 | } | ||
289 | |||
290 | function instaDisc_addSubscription($username, $url) | ||
291 | { | ||
292 | $getcode = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\""; | ||
293 | $getcode2 = mysql_query($getcode); | ||
294 | $getcode3 = mysql_fetch_array($getcode2); | ||
295 | if ($getcode3['username'] == $username) | ||
296 | { | ||
297 | $c = curl_init(); | ||
298 | curl_setopt($c, CURLOPT_URL, $url); | ||
299 | curl_setopt($c, CURLOPT_HEADER, false); | ||
300 | curl_setopt($c, CURLOPT_RETURNTRANSFER, true); | ||
301 | $page_data = curl_exec($c); | ||
302 | curl_close($c); | ||
303 | |||
304 | $headers = split("\n", $page_data); | ||
305 | foreach ($headers as $name => $value) | ||
306 | { | ||
307 | $header = split(": ", $value); | ||
308 | $headerMap[$header[0]] = $header[1]; | ||
309 | } | ||
310 | |||
311 | if (isset($headerMap['Subscription'])) | ||
312 | { | ||
313 | if (isset($headerMap['Title'])) | ||
314 | { | ||
315 | if (isset($headerMap['Category'])) | ||
316 | { | ||
317 | if (isset($headerMap['Key'])) | ||
318 | { | ||
319 | if ($headerMap['Key'] == $getcode3['code']) | ||
320 | { | ||
321 | $inssub = "INSERT INTO subscriptions (username,url,owner,category) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($headerMap['Subscription']) . "\", \"true\", \"" . mysql_real_escape_string($headerMap['Category']) . "\")"; | ||
322 | $inssub2 = mysql_query($inssub); | ||
323 | |||
324 | $delcode = "DELETE FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\""; | ||
325 | $delcode2 = mysql_query($delcode); | ||
326 | |||
327 | return 0; | ||
328 | } else { | ||
329 | return 4; | ||
330 | } | ||
331 | } else { | ||
332 | return 3; | ||
333 | } | ||
334 | } else { | ||
335 | return 3; | ||
336 | } | ||
337 | } else { | ||
338 | return 3; | ||
339 | } | ||
340 | } else { | ||
341 | return 3; | ||
342 | } | ||
343 | } else { | ||
344 | return 2; | ||
345 | } | ||
346 | |||
347 | return 1; | ||
348 | } | ||
349 | |||
350 | function instaDisc_listPendingSubscriptions($username) | ||
351 | { | ||
352 | $getsubs = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\""; | ||
353 | $getsubs2 = mysql_query($getsubs); | ||
354 | $i=0; | ||
355 | while ($getsubs3[$i] = mysql_fetch_array($getsubs2)) | ||
356 | { | ||
357 | $subs[$i] = array('url' => $getsubs3[$i]['url'], 'code' => $getsubs3[$i]['code']); | ||
358 | |||
359 | $i++; | ||
360 | } | ||
361 | |||
362 | $subs['size'] = $i; | ||
363 | return $subs; | ||
364 | } | ||
365 | |||
366 | function instaDisc_generateSubscriptionActivation($username, $url) | ||
367 | { | ||
368 | $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; | ||
369 | $getuser2 = mysql_query($getuser); | ||
370 | $getuser3 = mysql_fetch_array($getuser2); | ||
371 | if ($getuser3['username'] == $username) | ||
372 | { | ||
373 | $key = md5(rand(1,2147483647)); | ||
374 | |||
375 | $inspending = "INSERT INTO pending2 (username, url, code) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($url) . "\", \"" . mysql_real_escape_string($key) . "\")"; | ||
376 | $inspending2 = mysql_query($inspending); | ||
377 | |||
378 | return $key; | ||
379 | } | ||
380 | |||
381 | return false; | ||
382 | } | ||
383 | |||
384 | function instaDisc_deleteSubscription($username, $url) | ||
385 | { | ||
386 | $getsub = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")"; | ||
387 | $getsub2 = mysql_query($getsub); | ||
388 | $getsub3 = mysql_fetch_array($getsub2); | ||
389 | if ($getsub3['username'] == $username) | ||
390 | { | ||
391 | $delsub = "DELETE FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")"; | ||
392 | $delsub2 = mysql_query($delsub); | ||
393 | |||
394 | return true; | ||
395 | } | ||
396 | |||
397 | return false; | ||
398 | } | ||
399 | |||
400 | function instaDisc_cancelSubscription($username, $url) | ||
401 | { | ||
402 | $getsub = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")"; | ||
403 | $getsub2 = mysql_query($getsub); | ||
404 | $getsub3 = mysql_fetch_array($getsub2); | ||
405 | if ($getsub3['username'] == $username) | ||
406 | { | ||
407 | $delsub = "DELETE FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")"; | ||
408 | $delsub2 = mysql_query($delsub); | ||
409 | |||
410 | return true; | ||
411 | } | ||
412 | |||
413 | return false; | ||
414 | } | ||
415 | |||
416 | function instaDisc_changePassword($username, $password) | 274 | function instaDisc_changePassword($username, $password) |
417 | { | 275 | { |
418 | $setpass = "UPDATE users WHERE username = \"" . mysql_real_escape_string($username) . "\" SET password = \"" . mysql_real_escape_string(md5($password)) . "\""; | 276 | $setpass = "UPDATE users WHERE username = \"" . mysql_real_escape_string($username) . "\" SET password = \"" . mysql_real_escape_string(md5($password)) . "\""; |
diff --git a/central/trunk/instadisc.sql b/central/trunk/instadisc.sql index 2019503..70e3c3b 100644 --- a/central/trunk/instadisc.sql +++ b/central/trunk/instadisc.sql | |||
@@ -3,11 +3,11 @@ | |||
3 | -- http://www.phpmyadmin.net | 3 | -- http://www.phpmyadmin.net |
4 | -- | 4 | -- |
5 | -- Host: localhost | 5 | -- Host: localhost |
6 | -- Generation Time: Aug 03, 2008 at 04:54 PM | 6 | -- Generation Time: Sep 06, 2008 at 05:37 PM |
7 | -- Server version: 5.0.51 | 7 | -- Server version: 5.0.51 |
8 | -- PHP Version: 5.2.4-2ubuntu5.3 | 8 | -- PHP Version: 5.2.4-2ubuntu5.3 |
9 | -- | 9 | -- |
10 | -- Database: `instadisc` | 10 | -- Database: `instadisc_central` |
11 | -- | 11 | -- |
12 | 12 | ||
13 | -- -------------------------------------------------------- | 13 | -- -------------------------------------------------------- |
@@ -16,13 +16,14 @@ | |||
16 | -- Table structure for table `centralServers` | 16 | -- Table structure for table `centralServers` |
17 | -- | 17 | -- |
18 | 18 | ||
19 | CREATE TABLE IF NOT EXISTS `centralServers` ( | 19 | DROP TABLE IF EXISTS `centralServers`; |
20 | CREATE TABLE `centralServers` ( | ||
20 | `id` int(11) NOT NULL auto_increment, | 21 | `id` int(11) NOT NULL auto_increment, |
21 | `url` varchar(255) NOT NULL, | 22 | `url` varchar(255) NOT NULL, |
22 | `code` varchar(255) NOT NULL, | 23 | `code` varchar(255) NOT NULL, |
23 | `xmlrpc` varchar(255) NOT NULL, | 24 | `xmlrpc` varchar(255) NOT NULL, |
24 | PRIMARY KEY (`id`) | 25 | PRIMARY KEY (`id`) |
25 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 26 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
26 | 27 | ||
27 | -- -------------------------------------------------------- | 28 | -- -------------------------------------------------------- |
28 | 29 | ||
@@ -30,12 +31,13 @@ CREATE TABLE IF NOT EXISTS `centralServers` ( | |||
30 | -- Table structure for table `config` | 31 | -- Table structure for table `config` |
31 | -- | 32 | -- |
32 | 33 | ||
33 | CREATE TABLE IF NOT EXISTS `config` ( | 34 | DROP TABLE IF EXISTS `config`; |
35 | CREATE TABLE `config` ( | ||
34 | `id` int(11) NOT NULL auto_increment, | 36 | `id` int(11) NOT NULL auto_increment, |
35 | `name` varchar(255) NOT NULL, | 37 | `name` varchar(255) NOT NULL, |
36 | `value` varchar(255) NOT NULL, | 38 | `value` varchar(255) NOT NULL, |
37 | PRIMARY KEY (`id`) | 39 | PRIMARY KEY (`id`) |
38 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 40 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
39 | 41 | ||
40 | -- -------------------------------------------------------- | 42 | -- -------------------------------------------------------- |
41 | 43 | ||
@@ -43,7 +45,8 @@ CREATE TABLE IF NOT EXISTS `config` ( | |||
43 | -- Table structure for table `inbox` | 45 | -- Table structure for table `inbox` |
44 | -- | 46 | -- |
45 | 47 | ||
46 | CREATE TABLE IF NOT EXISTS `inbox` ( | 48 | DROP TABLE IF EXISTS `inbox`; |
49 | CREATE TABLE `inbox` ( | ||
47 | `id` int(11) NOT NULL auto_increment, | 50 | `id` int(11) NOT NULL auto_increment, |
48 | `username` varchar(255) NOT NULL, | 51 | `username` varchar(255) NOT NULL, |
49 | `itemID` int(11) NOT NULL, | 52 | `itemID` int(11) NOT NULL, |
@@ -54,7 +57,7 @@ CREATE TABLE IF NOT EXISTS `inbox` ( | |||
54 | `semantics` text NOT NULL, | 57 | `semantics` text NOT NULL, |
55 | `encryptionID` int(11) NOT NULL, | 58 | `encryptionID` int(11) NOT NULL, |
56 | PRIMARY KEY (`id`) | 59 | PRIMARY KEY (`id`) |
57 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 60 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
58 | 61 | ||
59 | -- -------------------------------------------------------- | 62 | -- -------------------------------------------------------- |
60 | 63 | ||
@@ -62,12 +65,13 @@ CREATE TABLE IF NOT EXISTS `inbox` ( | |||
62 | -- Table structure for table `oldVerID` | 65 | -- Table structure for table `oldVerID` |
63 | -- | 66 | -- |
64 | 67 | ||
65 | CREATE TABLE IF NOT EXISTS `oldVerID` ( | 68 | DROP TABLE IF EXISTS `oldVerID`; |
69 | CREATE TABLE `oldVerID` ( | ||
66 | `id` int(11) NOT NULL auto_increment, | 70 | `id` int(11) NOT NULL auto_increment, |
67 | `username` varchar(255) NOT NULL, | 71 | `username` varchar(255) NOT NULL, |
68 | `verID` int(11) NOT NULL, | 72 | `verID` int(11) NOT NULL, |
69 | PRIMARY KEY (`id`) | 73 | PRIMARY KEY (`id`) |
70 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 74 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
71 | 75 | ||
72 | -- -------------------------------------------------------- | 76 | -- -------------------------------------------------------- |
73 | 77 | ||
@@ -75,7 +79,8 @@ CREATE TABLE IF NOT EXISTS `oldVerID` ( | |||
75 | -- Table structure for table `pending` | 79 | -- Table structure for table `pending` |
76 | -- | 80 | -- |
77 | 81 | ||
78 | CREATE TABLE IF NOT EXISTS `pending` ( | 82 | DROP TABLE IF EXISTS `pending`; |
83 | CREATE TABLE `pending` ( | ||
79 | `id` int(11) NOT NULL auto_increment, | 84 | `id` int(11) NOT NULL auto_increment, |
80 | `username` varchar(255) NOT NULL, | 85 | `username` varchar(255) NOT NULL, |
81 | `password` varchar(255) NOT NULL, | 86 | `password` varchar(255) NOT NULL, |
@@ -87,29 +92,15 @@ CREATE TABLE IF NOT EXISTS `pending` ( | |||
87 | -- -------------------------------------------------------- | 92 | -- -------------------------------------------------------- |
88 | 93 | ||
89 | -- | 94 | -- |
90 | -- Table structure for table `pending2` | ||
91 | -- | ||
92 | |||
93 | CREATE TABLE IF NOT EXISTS `pending2` ( | ||
94 | `id` int(11) NOT NULL auto_increment, | ||
95 | `username` varchar(255) NOT NULL, | ||
96 | `url` varchar(255) NOT NULL, | ||
97 | `code` varchar(255) NOT NULL, | ||
98 | PRIMARY KEY (`id`) | ||
99 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
100 | |||
101 | -- -------------------------------------------------------- | ||
102 | |||
103 | -- | ||
104 | -- Table structure for table `subscriptions` | 95 | -- Table structure for table `subscriptions` |
105 | -- | 96 | -- |
106 | 97 | ||
107 | CREATE TABLE IF NOT EXISTS `subscriptions` ( | 98 | DROP TABLE IF EXISTS `subscriptions`; |
108 | `id` mediumint(11) NOT NULL auto_increment, | 99 | CREATE TABLE `subscriptions` ( |
100 | `id` int(11) NOT NULL auto_increment, | ||
109 | `username` varchar(255) NOT NULL, | 101 | `username` varchar(255) NOT NULL, |
110 | `url` varchar(255) NOT NULL, | 102 | `url` varchar(255) NOT NULL, |
111 | `owner` varchar(5) NOT NULL, | 103 | `identity` varchar(255) NOT NULL, |
112 | `category` varchar(255) NOT NULL, | ||
113 | PRIMARY KEY (`id`) | 104 | PRIMARY KEY (`id`) |
114 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 105 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
115 | 106 | ||
@@ -119,7 +110,8 @@ CREATE TABLE IF NOT EXISTS `subscriptions` ( | |||
119 | -- Table structure for table `users` | 110 | -- Table structure for table `users` |
120 | -- | 111 | -- |
121 | 112 | ||
122 | CREATE TABLE IF NOT EXISTS `users` ( | 113 | DROP TABLE IF EXISTS `users`; |
114 | CREATE TABLE `users` ( | ||
123 | `id` int(11) NOT NULL auto_increment, | 115 | `id` int(11) NOT NULL auto_increment, |
124 | `username` varchar(255) NOT NULL, | 116 | `username` varchar(255) NOT NULL, |
125 | `password` varchar(255) NOT NULL, | 117 | `password` varchar(255) NOT NULL, |
@@ -127,5 +119,5 @@ CREATE TABLE IF NOT EXISTS `users` ( | |||
127 | `ip` varchar(255) NOT NULL, | 119 | `ip` varchar(255) NOT NULL, |
128 | `nextItemID` int(11) NOT NULL, | 120 | `nextItemID` int(11) NOT NULL, |
129 | PRIMARY KEY (`id`) | 121 | PRIMARY KEY (`id`) |
130 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 122 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
131 | 123 | ||
diff --git a/central/trunk/mansub.php b/central/trunk/mansub.php deleted file mode 100644 index b36966f..0000000 --- a/central/trunk/mansub.php +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Server - A Four Island Project */ | ||
4 | |||
5 | include('includes/instadisc.php'); | ||
6 | include('includes/template.php'); | ||
7 | |||
8 | if (isset($_SESSION['username'])) | ||
9 | { | ||
10 | $template = new FITemplate('mansub'); | ||
11 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
12 | |||
13 | $subs = instaDisc_listSubscriptions($_SESSION['username']); | ||
14 | $i=0; | ||
15 | for ($i=0;$i<$subs['size'];$i++) | ||
16 | { | ||
17 | $template->adds_block('SUBSCRIPTIONS', array( 'URL' => $subs[$i], | ||
18 | 'ID' => $i, | ||
19 | 'EVEN' => (($i % 2 == 0) ? " CLASS=\"even\"" : ""))); | ||
20 | } | ||
21 | |||
22 | $template->display(); | ||
23 | } else { | ||
24 | header('Location: index.php'); | ||
25 | } | ||
26 | |||
27 | ?> | ||
diff --git a/central/trunk/theme/activatedsub.tpl b/central/trunk/theme/activatedsub.tpl deleted file mode 100644 index 9bdcbf5..0000000 --- a/central/trunk/theme/activatedsub.tpl +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> | ||
4 | </HEAD> | ||
5 | |||
6 | <BODY> | ||
7 | <CENTER> | ||
8 | <H1>InstaDisc Subscription Activation</H1> | ||
9 | |||
10 | <P>You've sucessfully activated your subscription! <A HREF="userpanel.php">Back to User Panel</A> | ||
11 | </CENTER> | ||
12 | </BODY> | ||
13 | </HTML> | ||
14 | |||
diff --git a/central/trunk/theme/activatesub.tpl b/central/trunk/theme/activatesub.tpl deleted file mode 100644 index f6dd6a0..0000000 --- a/central/trunk/theme/activatesub.tpl +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> | ||
4 | <LINK REL="stylesheet" TYPE="text/css" HREF="theme/uniform.css"> | ||
5 | </HEAD> | ||
6 | |||
7 | <BODY> | ||
8 | <CENTER> | ||
9 | <H1>InstaDisc Subscription Activation</H1> | ||
10 | |||
11 | <P>If you've already requested a subscription be sponsered and added its Activation Key to its Subscription File, you can activate the subscription here: | ||
12 | </CENTER> | ||
13 | |||
14 | <FORM CLASS="uniform" ACTION="./activatesub.php?submit=" METHOD="POST"> | ||
15 | |||
16 | <!--BEGIN ERROR--> | ||
17 | <DIV ID="errorMsg">Uh oh! Validation errors!<P> | ||
18 | <OL> | ||
19 | <!--END ERROR--> | ||
20 | |||
21 | <!--BEGIN ERRORS--> | ||
22 | <LI><A HREF="#error<!--ERRORS.NAME-->"><!--ERRORS.MSG--></A></LI> | ||
23 | <!--END ERRORS--> | ||
24 | |||
25 | <!--BEGIN ERROR--> | ||
26 | </OL> | ||
27 | </DIV> | ||
28 | <!--END ERROR--> | ||
29 | |||
30 | <FIELDSET CLASS="inlineLabels"> | ||
31 | <LEGEND>User Details</LEGEND> | ||
32 | |||
33 | <DIV CLASS="ctrlHolder<!--URL_ERR-->"> | ||
34 | <!--BEGIN URL_ERRS--> | ||
35 | <P ID="error<!--URL_ERRS.NAME-->" CLASS="errorField"><EM>*</EM> | ||
36 | <!--URL_ERRS.MSG--> | ||
37 | </P> | ||
38 | <!--END URL_ERRS--> | ||
39 | |||
40 | <LABEL FOR="url"><EM>*</EM> Subscription File URL: </LABEL> | ||
41 | <INPUT TYPE="text" ID="url" NAME="url" CLASS="textInput" VALUE="<!--URL-->"> | ||
42 | </DIV> | ||
43 | </FIELDSET> | ||
44 | |||
45 | <DIV CLASS="buttonHolder"> | ||
46 | <INPUT TYPE="submit" NAME="submit" VALUE="Verify"> | ||
47 | <INPUT TYPE="submit" NAME="submit" VALUE="Delete"> | ||
48 | </DIV> | ||
49 | </FORM> | ||
50 | </BODY> | ||
51 | </HTML> | ||
diff --git a/central/trunk/theme/addedsub.tpl b/central/trunk/theme/addedsub.tpl deleted file mode 100644 index 9efa010..0000000 --- a/central/trunk/theme/addedsub.tpl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> | ||
4 | </HEAD> | ||
5 | |||
6 | <BODY> | ||
7 | <CENTER> | ||
8 | <H1>InstaDisc Add Subscription</H1> | ||
9 | |||
10 | <P>Thank you for submitting! An activation key has been generated for you. Here it is: | ||
11 | <P><!--KEY--> | ||
12 | <P>Please place that in your Subscription File and return here to activate your subscription. | ||
13 | <P>Don't know how to add the key to your subscription file? Well, simply go to <A HREF="http://fourisland.com/projects/instadisc/">Four Island</A>, find the type of Update Server you are using, and there should be instructions on how to add an Activation Key to your subscription file. | ||
14 | <P><A HREF="userpanel.php">Back to the User Panel</A> | ||
15 | </CENTER> | ||
16 | </BODY> | ||
17 | </HTML> | ||
diff --git a/central/trunk/theme/addsub.tpl b/central/trunk/theme/addsub.tpl deleted file mode 100644 index 148b67c..0000000 --- a/central/trunk/theme/addsub.tpl +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> | ||
4 | <LINK REL="stylesheet" TYPE="text/css" HREF="theme/uniform.css"> | ||
5 | </HEAD> | ||
6 | |||
7 | <BODY> | ||
8 | <CENTER> | ||
9 | <H1>InstaDisc Add Subscription</H1> | ||
10 | |||
11 | <P>If you would like to have us sponser a subscription for you, please fill out the form below: | ||
12 | </CENTER> | ||
13 | |||
14 | <FORM CLASS="uniform" ACTION="./addsub.php?submit=" METHOD="POST"> | ||
15 | |||
16 | <!--BEGIN ERROR--> | ||
17 | <DIV ID="errorMsg">Uh oh! Validation errors!<P> | ||
18 | <OL> | ||
19 | <!--END ERROR--> | ||
20 | |||
21 | <!--BEGIN ERRORS--> | ||
22 | <LI><A HREF="#error<!--ERRORS.NAME-->"><!--ERRORS.MSG--></A></LI> | ||
23 | <!--END ERRORS--> | ||
24 | |||
25 | <!--BEGIN ERROR--> | ||
26 | </OL> | ||
27 | </DIV> | ||
28 | <!--END ERROR--> | ||
29 | |||
30 | <FIELDSET CLASS="inlineLabels"> | ||
31 | <LEGEND>Subscription Details</LEGEND> | ||
32 | |||
33 | <DIV CLASS="ctrlHolder<!--URL_ERR-->"> | ||
34 | <!--BEGIN URL_ERRS--> | ||
35 | <P ID="error<!--URL_ERRS.NAME-->" CLASS="errorField"><EM>*</EM> | ||
36 | <!--URL_ERRS.MSG--> | ||
37 | </P> | ||
38 | <!--END URL_ERRS--> | ||
39 | |||
40 | <LABEL FOR="url"><EM>*</EM> Subscription File URL: </LABEL> | ||
41 | <INPUT TYPE="text" ID="url" NAME="url" CLASS="textInput" VALUE="<!--URL-->"> | ||
42 | </DIV> | ||
43 | </FIELDSET> | ||
44 | |||
45 | <DIV CLASS="buttonHolder"> | ||
46 | <INPUT TYPE="submit" NAME="submit" VALUE="Submit"> | ||
47 | </DIV> | ||
48 | </FORM> | ||
49 | </BODY> | ||
50 | </HTML> | ||
diff --git a/central/trunk/theme/mansub.tpl b/central/trunk/theme/mansub.tpl deleted file mode 100644 index 23639b1..0000000 --- a/central/trunk/theme/mansub.tpl +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> | ||
4 | <LINK REL="stylesheet" HREF="theme/table.css"> | ||
5 | </HEAD> | ||
6 | |||
7 | <BODY> | ||
8 | <CENTER> | ||
9 | <H1>InstaDisc Subscription Management</H1> | ||
10 | |||
11 | <P>If you've sponsered subscriptions here but have decided you want to move elsewhere you can delete subscriptions using the table below: | ||
12 | |||
13 | <TABLE> | ||
14 | <TR> | ||
15 | <TH>Subscription URL</TH> | ||
16 | <TH>Actions</TH> | ||
17 | </TR> | ||
18 | |||
19 | <!--BEGIN SUBSCRIPTIONS--> | ||
20 | <TR<!--SUBSCRIPTIONS.EVEN-->> | ||
21 | <TD><!--SUBSCRIPTIONS.URL--></TD> | ||
22 | <TD><A HREF="deletesub.php?id=<!--SUBSCRIPTIONS.ID-->">Delete</A></TD> | ||
23 | </TR> | ||
24 | <!--END SUBSCRIPTIONS--> | ||
25 | </TABLE> | ||
26 | |||
27 | <P><A HREF="userpanel.php">Back to User Panel</A> | ||
28 | </CENTER> | ||
29 | </BODY> | ||
30 | </HTML> | ||
diff --git a/central/trunk/theme/userpanel.tpl b/central/trunk/theme/userpanel.tpl index c10c0dc..37d5ec0 100644 --- a/central/trunk/theme/userpanel.tpl +++ b/central/trunk/theme/userpanel.tpl | |||
@@ -14,12 +14,10 @@ | |||
14 | <LI><A HREF="logout.php">Log out</A></LI> | 14 | <LI><A HREF="logout.php">Log out</A></LI> |
15 | </UL> | 15 | </UL> |
16 | 16 | ||
17 | <P>If you own a subscription and wish to have this Central Server sponser it, you can use the options below: | 17 | <P>If you own a subscription and wish to have this Central Server sponser it, you can use the option below: |
18 | 18 | ||
19 | <UL> | 19 | <UL> |
20 | <LI><A HREF="addsub.php">Submit a Subscription for Sponsership</A></LI> | 20 | <LI><A HREF="setSeries.php">Set Series Control URL</A></LI> |
21 | <LI><A HREF="activatesub.php">Activate a Subscription</A></LI> | ||
22 | <LI><A HREF="mansub.php">Manage subscriptions</A></LI> | ||
23 | </UL> | 21 | </UL> |
24 | 22 | ||
25 | <!--BEGIN ADMIN--> | 23 | <!--BEGIN ADMIN--> |
diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index a451d93..64dc4f7 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php | |||
@@ -75,45 +75,40 @@ function requestRetained($username, $verification, $verificationID) | |||
75 | return new xmlrpcresp(new xmlrpcval(1, "int")); | 75 | return new xmlrpcresp(new xmlrpcval(1, "int")); |
76 | } | 76 | } |
77 | 77 | ||
78 | function sendFromUpdate($username, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID) | 78 | function sendFromUpdate($username, $verification, $verificationID, $subscriptionSeriesURL, $subscriptionID, $title, $author, $url, $semantics, $encryptionID) |
79 | { | 79 | { |
80 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | 80 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) |
81 | { | 81 | { |
82 | $getusubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"true\" AND category <> \"instadisc\""; | 82 | $cserver = $_SERVER['SERVER_NAME']; |
83 | $getusubs2 = mysql_query($getusubs); | 83 | $getuk = "SELECT * FROM centralServers WHERE url = \"" . mysql_real_escape_string($cserver) . "\""; |
84 | $getusubs3 = mysql_fetch_array($getusubs2); | 84 | $getuk2 = mysql_query($getuk); |
85 | if ($getusubs3['username'] == $username) | 85 | $getuk3 = mysql_fetch_array($getuk2); |
86 | { | ||
87 | $cserver = $_SERVER['SERVER_NAME']; | ||
88 | $getuk = "SELECT * FROM centralServers WHERE url = \"" . mysql_real_escape_string($cserver) . "\""; | ||
89 | $getuk2 = mysql_query($getuk); | ||
90 | $getuk3 = mysql_fetch_array($getuk2); | ||
91 | 86 | ||
92 | $getcs = "SELECT * FROM centralServers"; | 87 | $getcs = "SELECT * FROM centralServers"; |
93 | $getcs2 = mysql_query($getcs); | 88 | $getcs2 = mysql_query($getcs); |
94 | $i=0; | 89 | $i=0; |
95 | while ($getcs3[$i] = mysql_fetch_array($getcs2)) | 90 | while ($getcs3[$i] = mysql_fetch_array($getcs2)) |
96 | { | 91 | { |
97 | $verID = rand(1,2147483647); | 92 | $verID = rand(1,2147483647); |
98 | |||
99 | $client = new xmlrpc_client($getcs3[$i]['xmlrpc']); | ||
100 | $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'), | ||
101 | new xmlrpcval(md5($cserver . ":" . $getuk3['code'] . ":" . $verID), 'string'), | ||
102 | new xmlrpcval($verID, 'int'), | ||
103 | new xmlrpcval($subscription, 'string'), | ||
104 | new xmlrpcval($title, 'string'), | ||
105 | new xmlrpcval($author, 'string'), | ||
106 | new xmlrpcval($url, 'string'), | ||
107 | new xmlrpcval($semantics, 'string'), | ||
108 | new xmlrpcval($encryptionID, 'int'), | ||
109 | new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'), | ||
110 | new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); | ||
111 | $client->send($msg); | ||
112 | $i++; | ||
113 | } | ||
114 | 93 | ||
115 | return new xmlrpcresp(new xmlrpcval(0, "int")); | 94 | $client = new xmlrpc_client($getcs3[$i]['xmlrpc']); |
95 | $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'), | ||
96 | new xmlrpcval(md5($cserver . ":" . $getuk3['code'] . ":" . $verID), 'string'), | ||
97 | new xmlrpcval($verID, 'int'), | ||
98 | new xmlrpcval($subscriptionSeriesURL, 'string'), | ||
99 | new xmlrpcval($subscriptionID, 'string'), | ||
100 | new xmlrpcval($title, 'string'), | ||
101 | new xmlrpcval($author, 'string'), | ||
102 | new xmlrpcval($url, 'string'), | ||
103 | new xmlrpcval($semantics, 'string'), | ||
104 | new xmlrpcval($encryptionID, 'int'), | ||
105 | new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'), | ||
106 | new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); | ||
107 | $client->send($msg); | ||
108 | $i++; | ||
116 | } | 109 | } |
110 | |||
111 | return new xmlrpcresp(new xmlrpcval(0, "int")); | ||
117 | } else { | 112 | } else { |
118 | return new xmlrpcresp(new xmlrpcval(2, "int")); | 113 | return new xmlrpcresp(new xmlrpcval(2, "int")); |
119 | } | 114 | } |
@@ -121,7 +116,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription | |||
121 | return new xmlrpcresp(new xmlrpcval(1, "int")); | 116 | return new xmlrpcresp(new xmlrpcval(1, "int")); |
122 | } | 117 | } |
123 | 118 | ||
124 | function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID, $softwareVersion, $databaseVersion) | 119 | function sendFromCentral($cserver, $verification, $verificationID, $subscriptionSeriesURL, $subscriptionID, $title, $author, $url, $semantics, $encryptionID, $softwareVersion, $databaseVersion) |
125 | { | 120 | { |
126 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) | 121 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) |
127 | { | 122 | { |
@@ -165,16 +160,20 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription | |||
165 | instaDisc_sendDatabase($cserver); | 160 | instaDisc_sendDatabase($cserver); |
166 | } | 161 | } |
167 | 162 | ||
168 | $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"false\" AND category <> \"instadisc\""; | 163 | $subscriptionURL = instaDisc_resolveSubscription($subscriptionSeriesURL, $subscriptionID); |
169 | $getsed2 = mysql_query($getsed); | 164 | if ($subscriptionURL != 'false') |
170 | $i=0; | ||
171 | while ($getsed3[$i] = mysql_fetch_array($getsed2)) | ||
172 | { | 165 | { |
173 | instaDisc_addItem($getsed3[$i]['username'], $subscription, $title, $author, $url, $semantics, $encryptionID); | 166 | $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscriptionSeriesURL) . "\" AND identity = \"" . mysql_real_escape_string($subscriptionID) . "\""; |
174 | $i++; | 167 | $getsed2 = mysql_query($getsed); |
175 | } | 168 | $i=0; |
169 | while ($getsed3[$i] = mysql_fetch_array($getsed2)) | ||
170 | { | ||
171 | instaDisc_addItem($getsed3[$i]['username'], $subscriptionURL, $title, $author, $url, $semantics, $encryptionID); | ||
172 | $i++; | ||
173 | } | ||
176 | 174 | ||
177 | return new xmlrpcresp(new xmlrpcval(0, "int")); | 175 | return new xmlrpcresp(new xmlrpcval(0, "int")); |
176 | } | ||
178 | } | 177 | } |
179 | 178 | ||
180 | return new xmlrpcresp(new xmlrpcval(1, "int")); | 179 | return new xmlrpcresp(new xmlrpcval(1, "int")); |