diff options
Diffstat (limited to 'central')
| -rw-r--r-- | central/trunk/instadisc.php | 14 | ||||
| -rw-r--r-- | central/trunk/instadisc.sql | 129 | ||||
| -rw-r--r-- | central/trunk/install.php | 346 | ||||
| -rw-r--r-- | central/trunk/uniform.css | 268 | ||||
| -rw-r--r-- | central/trunk/xmlrpc.php | 18 | 
5 files changed, 751 insertions, 24 deletions
| diff --git a/central/trunk/instadisc.php b/central/trunk/instadisc.php index 9883116..7ad11ee 100644 --- a/central/trunk/instadisc.php +++ b/central/trunk/instadisc.php | |||
| @@ -91,7 +91,7 @@ function instaDisc_sendDatabase($cserver) | |||
| 91 | $i=0; | 91 | $i=0; | 
| 92 | while ($getdb3[$i] = mysql_fetch_array($getdb2)) | 92 | while ($getdb3[$i] = mysql_fetch_array($getdb2)) | 
| 93 | { | 93 | { | 
| 94 | $db[$getdb3[$i]['url']]['key'] = $getdb3[$i]['key']; | 94 | $db[$getdb3[$i]['url']]['code'] = $getdb3[$i]['code']; | 
| 95 | $db[$getdb3[$i]['url']]['xmlrpc'] = $getdb3[$i]['xmlrpc']; | 95 | $db[$getdb3[$i]['url']]['xmlrpc'] = $getdb3[$i]['xmlrpc']; | 
| 96 | $i++; | 96 | $i++; | 
| 97 | } | 97 | } | 
| @@ -105,7 +105,7 @@ function instaDisc_sendDatabase($cserver) | |||
| 105 | 105 | ||
| 106 | $client = new xmlrpc_client($cserver); | 106 | $client = new xmlrpc_client($cserver); | 
| 107 | $msg = new xmlrpcmsg("InstaDisc.sendDatabase", array( new xmlrpcval($cserver2, 'string'), | 107 | $msg = new xmlrpcmsg("InstaDisc.sendDatabase", array( new xmlrpcval($cserver2, 'string'), | 
| 108 | new xmlrpcval(md5($cserver2 + ":" + $getuk3['key'] + ":" + $verID), 'string'), | 108 | new xmlrpcval(md5($cserver2 + ":" + $getuk3['code'] + ":" + $verID), 'string'), | 
| 109 | new xmlrpcval($verID, 'int'), | 109 | new xmlrpcval($verID, 'int'), | 
| 110 | new xmlrpcval($db, 'array'))); | 110 | new xmlrpcval($db, 'array'))); | 
| 111 | $client->send($msg); | 111 | $client->send($msg); | 
| @@ -152,7 +152,7 @@ function instaDisc_sendActivationEmail($username, $password, $email) | |||
| 152 | { | 152 | { | 
| 153 | $penKey = md5(rand(1,65536)); | 153 | $penKey = md5(rand(1,65536)); | 
| 154 | 154 | ||
| 155 | $inspending = "INSERT INTO pending (username, password, email, key) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string(md5($password)) . "\", \"" . mysql_real_escape_string($email) . "\", \"" . mysql_real_escape_string($penKey) . "\")"; | 155 | $inspending = "INSERT INTO pending (username, password, email, code) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string(md5($password)) . "\", \"" . mysql_real_escape_string($email) . "\", \"" . mysql_real_escape_string($penKey) . "\")"; | 
| 156 | $inspending2 = mysql_query($inspending); | 156 | $inspending2 = mysql_query($inspending); | 
| 157 | 157 | ||
| 158 | $mail = instaDisc_phpMailer(); | 158 | $mail = instaDisc_phpMailer(); | 
| @@ -165,7 +165,7 @@ function instaDisc_sendActivationEmail($username, $password, $email) | |||
| 165 | 165 | ||
| 166 | function instaDisc_activateAccount($username, $penKey) | 166 | function instaDisc_activateAccount($username, $penKey) | 
| 167 | { | 167 | { | 
| 168 | $getuser = "SELECT * FROM pending WHERE username = \"" . mysql_real_escape_string($username) . "\" AND key = \"" . mysql_real_escape_string($penKey) . "\""; | 168 | $getuser = "SELECT * FROM pending WHERE username = \"" . mysql_real_escape_string($username) . "\" AND code = \"" . mysql_real_escape_string($penKey) . "\""; | 
| 169 | $getuser2 = mysql_query($getuser); | 169 | $getuser2 = mysql_query($getuser); | 
| 170 | $getuser3 = mysql_fetch_array($getuser2); | 170 | $getuser3 = mysql_fetch_array($getuser2); | 
| 171 | if ($getuser3['username'] == $username) | 171 | if ($getuser3['username'] == $username) | 
| @@ -189,7 +189,7 @@ function instaDisc_activateAccount($username, $penKey) | |||
| 189 | 189 | ||
| 190 | function instaDisc_deactivateAccount($username, $penKey) | 190 | function instaDisc_deactivateAccount($username, $penKey) | 
| 191 | { | 191 | { | 
| 192 | $getuser = "SELECT * FROM pending WHERE username = \"" . mysql_real_escape_string($username) . "\" AND key = \"" . mysql_real_escape_string($penKey) . "\""; | 192 | $getuser = "SELECT * FROM pending WHERE username = \"" . mysql_real_escape_string($username) . "\" AND code = \"" . mysql_real_escape_string($penKey) . "\""; | 
| 193 | $getuser2 = mysql_query($getuser); | 193 | $getuser2 = mysql_query($getuser); | 
| 194 | $getuser3 = mysql_fetch_array($getuser2); | 194 | $getuser3 = mysql_fetch_array($getuser2); | 
| 195 | if ($getuser3['username'] == $username) | 195 | if ($getuser3['username'] == $username) | 
| @@ -310,7 +310,7 @@ function instaDisc_listPendingSubscriptions($username) | |||
| 310 | $i=0; | 310 | $i=0; | 
| 311 | while ($getsubs3[$i] = mysql_fetch_array($getsubs2)) | 311 | while ($getsubs3[$i] = mysql_fetch_array($getsubs2)) | 
| 312 | { | 312 | { | 
| 313 | $subs[$i] = array('url' => $getsubs3[$i]['url'], 'key' => $getsubs3[$i]['key']); | 313 | $subs[$i] = array('url' => $getsubs3[$i]['url'], 'code' => $getsubs3[$i]['code']); | 
| 314 | 314 | ||
| 315 | $i++; | 315 | $i++; | 
| 316 | } | 316 | } | 
| @@ -328,7 +328,7 @@ function instaDisc_generateSubscriptionActivation($username, $url) | |||
| 328 | { | 328 | { | 
| 329 | $key = md5(rand(1,65536)); | 329 | $key = md5(rand(1,65536)); | 
| 330 | 330 | ||
| 331 | $inspending = "INSERT INTO pending2 (username, url, key) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($url) . "\", \"" . mysql_real_escape_string($key) . "\")"; | 331 | $inspending = "INSERT INTO pending2 (username, url, code) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($url) . "\", \"" . mysql_real_escape_string($key) . "\")"; | 
| 332 | $inspending2 = mysql_query($inspending); | 332 | $inspending2 = mysql_query($inspending); | 
| 333 | 333 | ||
| 334 | return $key; | 334 | return $key; | 
| diff --git a/central/trunk/instadisc.sql b/central/trunk/instadisc.sql new file mode 100644 index 0000000..b3de26e --- /dev/null +++ b/central/trunk/instadisc.sql | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | -- phpMyAdmin SQL Dump | ||
| 2 | -- version 2.9.1.1 | ||
| 3 | -- http://www.phpmyadmin.net | ||
| 4 | -- | ||
| 5 | -- Host: localhost | ||
| 6 | -- Generation Time: Aug 03, 2008 at 04:54 PM | ||
| 7 | -- Server version: 5.0.51 | ||
| 8 | -- PHP Version: 5.2.4-2ubuntu5.3 | ||
| 9 | -- | ||
| 10 | -- Database: `instadisc` | ||
| 11 | -- | ||
| 12 | |||
| 13 | -- -------------------------------------------------------- | ||
| 14 | |||
| 15 | -- | ||
| 16 | -- Table structure for table `centralServers` | ||
| 17 | -- | ||
| 18 | |||
| 19 | CREATE TABLE IF NOT EXISTS `centralServers` ( | ||
| 20 | `id` int(11) NOT NULL auto_increment, | ||
| 21 | `url` varchar(255) NOT NULL, | ||
| 22 | `code` varchar(255) NOT NULL, | ||
| 23 | `xmlrpc` varchar(255) NOT NULL, | ||
| 24 | PRIMARY KEY (`id`) | ||
| 25 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 26 | |||
| 27 | -- -------------------------------------------------------- | ||
| 28 | |||
| 29 | -- | ||
| 30 | -- Table structure for table `config` | ||
| 31 | -- | ||
| 32 | |||
| 33 | CREATE TABLE IF NOT EXISTS `config` ( | ||
| 34 | `id` int(11) NOT NULL auto_increment, | ||
| 35 | `name` varchar(255) NOT NULL, | ||
| 36 | `value` varchar(255) NOT NULL, | ||
| 37 | PRIMARY KEY (`id`) | ||
| 38 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 39 | |||
| 40 | -- -------------------------------------------------------- | ||
| 41 | |||
| 42 | -- | ||
| 43 | -- Table structure for table `inbox` | ||
| 44 | -- | ||
| 45 | |||
| 46 | CREATE TABLE IF NOT EXISTS `inbox` ( | ||
| 47 | `id` int(11) NOT NULL auto_increment, | ||
| 48 | `username` varchar(255) NOT NULL, | ||
| 49 | `itemID` int(11) NOT NULL, | ||
| 50 | `subscription` varchar(255) NOT NULL, | ||
| 51 | `title` varchar(255) NOT NULL, | ||
| 52 | `author` varchar(255) NOT NULL, | ||
| 53 | `url` varchar(255) NOT NULL, | ||
| 54 | `semantics` text NOT NULL, | ||
| 55 | PRIMARY KEY (`id`) | ||
| 56 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 57 | |||
| 58 | -- -------------------------------------------------------- | ||
| 59 | |||
| 60 | -- | ||
| 61 | -- Table structure for table `oldVerID` | ||
| 62 | -- | ||
| 63 | |||
| 64 | CREATE TABLE IF NOT EXISTS `oldVerID` ( | ||
| 65 | `id` int(11) NOT NULL auto_increment, | ||
| 66 | `username` varchar(255) NOT NULL, | ||
| 67 | `verID` int(11) NOT NULL, | ||
| 68 | PRIMARY KEY (`id`) | ||
| 69 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 70 | |||
| 71 | -- -------------------------------------------------------- | ||
| 72 | |||
| 73 | -- | ||
| 74 | -- Table structure for table `pending` | ||
| 75 | -- | ||
| 76 | |||
| 77 | CREATE TABLE IF NOT EXISTS `pending` ( | ||
| 78 | `id` int(11) NOT NULL auto_increment, | ||
| 79 | `username` varchar(255) NOT NULL, | ||
| 80 | `password` varchar(255) NOT NULL, | ||
| 81 | `email` varchar(255) NOT NULL, | ||
| 82 | `code` varchar(255) NOT NULL, | ||
| 83 | PRIMARY KEY (`id`) | ||
| 84 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 85 | |||
| 86 | -- -------------------------------------------------------- | ||
| 87 | |||
| 88 | -- | ||
| 89 | -- Table structure for table `pending2` | ||
| 90 | -- | ||
| 91 | |||
| 92 | CREATE TABLE IF NOT EXISTS `pending2` ( | ||
| 93 | `id` int(11) NOT NULL auto_increment, | ||
| 94 | `username` varchar(255) NOT NULL, | ||
| 95 | `url` varchar(255) NOT NULL, | ||
| 96 | `code` varchar(255) NOT NULL, | ||
| 97 | PRIMARY KEY (`id`) | ||
| 98 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 99 | |||
| 100 | -- -------------------------------------------------------- | ||
| 101 | |||
| 102 | -- | ||
| 103 | -- Table structure for table `subscriptions` | ||
| 104 | -- | ||
| 105 | |||
| 106 | CREATE TABLE IF NOT EXISTS `subscriptions` ( | ||
| 107 | `id` mediumint(11) NOT NULL auto_increment, | ||
| 108 | `username` varchar(255) NOT NULL, | ||
| 109 | `url` varchar(255) NOT NULL, | ||
| 110 | `owner` varchar(5) NOT NULL, | ||
| 111 | PRIMARY KEY (`id`) | ||
| 112 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 113 | |||
| 114 | -- -------------------------------------------------------- | ||
| 115 | |||
| 116 | -- | ||
| 117 | -- Table structure for table `users` | ||
| 118 | -- | ||
| 119 | |||
| 120 | CREATE TABLE IF NOT EXISTS `users` ( | ||
| 121 | `id` int(11) NOT NULL auto_increment, | ||
| 122 | `username` varchar(255) NOT NULL, | ||
| 123 | `password` varchar(255) NOT NULL, | ||
| 124 | `email` varchar(255) NOT NULL, | ||
| 125 | `ip` varchar(255) NOT NULL, | ||
| 126 | `nextItemID` int(11) NOT NULL, | ||
| 127 | PRIMARY KEY (`id`) | ||
| 128 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 129 | |||
| diff --git a/central/trunk/install.php b/central/trunk/install.php index d04e99b..7b5514f 100644 --- a/central/trunk/install.php +++ b/central/trunk/install.php | |||
| @@ -2,20 +2,350 @@ | |||
| 2 | 2 | ||
| 3 | /* InstaDisc Server - A Four Island Project */ | 3 | /* InstaDisc Server - A Four Island Project */ | 
| 4 | 4 | ||
| 5 | if (!isset($_GET['step'])) | 5 | $softwareVersion = 1; | 
| 6 | |||
| 7 | if (!isset($_GET['submit'])) | ||
| 8 | { | ||
| 9 | showHeader('1'); | ||
| 10 | showStepOne('localhost', 'root', '', 'instadisc', array()); | ||
| 11 | } else { | ||
| 12 | $numOfErrors = 0; | ||
| 13 | $errors = array(); | ||
| 14 | |||
| 15 | switch ($_GET['submit']) | ||
| 16 | { | ||
| 17 | case 1: | ||
| 18 | if ($_POST['host'] == '') | ||
| 19 | { | ||
| 20 | addError($numOfErrors, $errors, 'host', 'Hostname is a required field'); | ||
| 21 | } | ||
| 22 | |||
| 23 | if ($_POST['username'] == '') | ||
| 24 | { | ||
| 25 | addError($numOfErrors, $errors, 'username', 'Username is a required field'); | ||
| 26 | } | ||
| 27 | |||
| 28 | if ($_POST['password'] == '') | ||
| 29 | { | ||
| 30 | addError($numOfErrors, $errors, 'password', 'Password is a required field'); | ||
| 31 | } | ||
| 32 | |||
| 33 | if ($_POST['dbname'] == '') | ||
| 34 | { | ||
| 35 | addError($numOfErrors, $errors, 'dbname', 'Name is a required field'); | ||
| 36 | } | ||
| 37 | |||
| 38 | if ($numOfErrors > 0) | ||
| 39 | { | ||
| 40 | showHeader('1'); | ||
| 41 | showStepOne($_POST['host'], $_POST['username'], $_POST['password'], $_POST['dbname'], $errors); | ||
| 42 | } else { | ||
| 43 | if (!@mysql_connect($_POST['host'], $_POST['username'], $_POST['password'])) | ||
| 44 | { | ||
| 45 | addError($numOfErrors, $errors, '', 'Cannot connect to database server'); | ||
| 46 | showHeader('1'); | ||
| 47 | showStepOne($_POST['host'], $_POST['username'], $_POST['password'], $_POST['dbname'], $errors); | ||
| 48 | } else { | ||
| 49 | if (!@mysql_select_db($_POST['dbname'])) | ||
| 50 | { | ||
| 51 | addError($numOfErrors, $errors, 'dbname', 'Database does not exist'); | ||
| 52 | showHeader('1'); | ||
| 53 | showStepOne($_POST['host'], $_POST['username'], $_POST['password'], $_POST['dbname'], $errors); | ||
| 54 | } else { | ||
| 55 | $sql = file_get_contents('instadisc.sql'); | ||
| 56 | $makedb = split(';', $sql); | ||
| 57 | foreach ($makedb as $name => $value) | ||
| 58 | { | ||
| 59 | if (!trim($value) == '') | ||
| 60 | { | ||
| 61 | $makedb2 = @mysql_query($value); | ||
| 62 | if (!$makedb2) | ||
| 63 | { | ||
| 64 | addError($numOfErrors, $errors, '', "MySQL error \"" . mysql_error() . "\" while creating database"); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | @file_put_contents('config.php', "<?php\n\n/* InstaDisc Server - A Four Island Project */\n\n\$dbhost = \"" . $_POST['host'] . "\";\n\$dbuser = \"" . $_POST['username'] . "\";\n\$dbpass = \"" . $_POST['password'] . "\";\n\$dbname = \"" . $_POST['dbname'] . "\";\n\n?>"); | ||
| 70 | |||
| 71 | if (!file_exists('config.php')) | ||
| 72 | { | ||
| 73 | addError($numOfErrors, $errors, '', 'Could not write config.php file, please check directory permissions'); | ||
| 74 | } | ||
| 75 | |||
| 76 | if ($numOfErrors > 0) | ||
| 77 | { | ||
| 78 | showHeader('1'); | ||
| 79 | showStepOne($_POST['host'], $_POST['username'], $_POST['password'], $_POST['dbname'], $errors); | ||
| 80 | } else { | ||
| 81 | showHeader('2'); | ||
| 82 | showStepTwo('','',' CHECKED','','','','','','','', array()); | ||
| 83 | } | ||
| 84 | } | ||
| 85 | } | ||
| 86 | } | ||
| 87 | |||
| 88 | break; | ||
| 89 | |||
| 90 | case 2: | ||
| 91 | if ($_POST['mailDomain'] == '') | ||
| 92 | { | ||
| 93 | addError($numOfErrors, $errors, 'mailDomain', 'Mail Domain is a required field'); | ||
| 94 | } | ||
| 95 | |||
| 96 | if ($_POST['smtpHost'] == '') | ||
| 97 | { | ||
| 98 | addError($numOfErrors, $errors, 'smtpHost', 'SMTP Host is a required field'); | ||
| 99 | } | ||
| 100 | |||
| 101 | if ($_POST['smtpAuth'] == 'on') | ||
| 102 | { | ||
| 103 | if ($_POST['smtpUser'] == '') | ||
| 104 | { | ||
| 105 | addError($numOfErrors, $errors, 'smtpUser', 'When "SMTP Authentication Required?" is checked, SMTP Username is a required field'); | ||
| 106 | } | ||
| 107 | |||
| 108 | if ($_POST['smtpPass'] == '') | ||
| 109 | { | ||
| 110 | addError($numOfErrors, $errors, 'smtpPass', 'When "SMTP Authentication Required?" is checked, SMTP Password is a required field'); | ||
| 111 | } | ||
| 112 | } | ||
| 113 | |||
| 114 | if ($_POST['siteName'] == '') | ||
| 115 | { | ||
| 116 | addError($numOfErrors, $errors, 'siteName', 'Site Name is a required field'); | ||
| 117 | } | ||
| 118 | |||
| 119 | if ($_POST['xmlrpcURL'] == '') | ||
| 120 | { | ||
| 121 | addError($numOfErrors, $errors, 'xmlrpcURL', 'XML-RPC URL is a required field'); | ||
| 122 | } else { | ||
| 123 | include_once('xmlrpc/xmlrpc.inc'); | ||
| 124 | |||
| 125 | $client = new xmlrpc_client($_POST['xmlrpcURL']); | ||
| 126 | $msg = new xmlrpcmsg('system.listMethods'); | ||
| 127 | $r = $client->send($msg); | ||
| 128 | if (stripos($r->faultString(),'Connect error') !== FALSE) | ||
| 129 | { | ||
| 130 | addError($numOfErrors, $errors, 'xmlrpcURL', $r->faultString()); | ||
| 131 | } | ||
| 132 | } | ||
| 133 | |||
| 134 | if ($_POST['adminUser'] == '') | ||
| 135 | { | ||
| 136 | addError($numOfErrors, $errors, 'adminUser', 'Admin Username is a required field'); | ||
| 137 | } | ||
| 138 | |||
| 139 | if ($_POST['adminPass'] == '') | ||
| 140 | { | ||
| 141 | addError($numOfErrors, $errors, 'adminPass', 'Admin Password is a required field'); | ||
| 142 | } | ||
| 143 | |||
| 144 | if ($_POST['adminEmail'] == '') | ||
| 145 | { | ||
| 146 | addError($numOfErrors, $errors, 'adminEmail', 'Admin Email is a required field'); | ||
| 147 | } | ||
| 148 | |||
| 149 | if ($numOfErrors > 0) | ||
| 150 | { | ||
| 151 | showHeader('2'); | ||
| 152 | showStepTwo($_POST['mailDomain'], $_POST['smtpHost'], ($_POST['smtpAuth'] == 'on' ? ' CHECKED' : ''), $_POST['smtpUser'], $_POST['smtpPass'], $_POST['siteName'], $_POST['xmlrpcURL'], $_POST['adminUser'], $_POST['adminPass'], $_POST['adminEmail'], $errors); | ||
| 153 | } else { | ||
| 154 | include_once('config.php'); | ||
| 155 | |||
| 156 | mysql_connect($dbhost, $dbuser, $dbpass); | ||
| 157 | mysql_select_db($dbname); | ||
| 158 | |||
| 159 | $sql[0] = "INSERT INTO config (name,value) VALUES (\"mailDomain\",\"" . mysql_real_escape_string($_POST['mailDomain']) . "\")"; | ||
| 160 | $sql[1] = "INSERT INTO config (name,value) VALUES (\"smtpHost\",\"" . mysql_real_escape_string($_POST['smtpHost']) . "\")"; | ||
| 161 | $sql[2] = "INSERT INTO config (name,value) VALUES (\"smtpAuth\",\"" . mysql_real_escape_string($_POST['smtpAuth']) . "\")"; | ||
| 162 | $sql[3] = "INSERT INTO config (name,value) VALUES (\"smtpUser\",\"" . mysql_real_escape_string($_POST['smtpUser']) . "\")"; | ||
| 163 | $sql[4] = "INSERT INTO config (name,value) VALUES (\"smtpPass\",\"" . mysql_real_escape_string($_POST['smtpPass']) . "\")"; | ||
| 164 | $sql[5] = "INSERT INTO config (name,value) VALUES (\"siteName\",\"" . mysql_real_escape_string($_POST['siteName']) . "\")"; | ||
| 165 | $sql[6] = "INSERT INTO config (name,value) VALUES (\"xmlrpcURL\",\"" . mysql_real_escape_string($_POST['xmlrpcURL']) . "\")"; | ||
| 166 | $sql[7] = "INSERT INTO config (name,value) VALUES (\"owner\",\"" . mysql_real_escape_string($_POST['adminUser']) . "\")"; | ||
| 167 | $sql[8] = "INSERT INTO config (name,value) VALUES (\"verIDBufferSize\",\"100\")"; | ||
| 168 | $sql[9] = "INSERT INTO config (name,value) VALUES (\"softwareVersion\",\"" . $softwareVersion . "\")"; | ||
| 169 | $sql[10] = "INSERT INTO config (name,value) VALUES (\"databaseVersion\",\"1\")"; | ||
| 170 | $sql[11] = "INSERT INTO users (username, password, email, ip) VALUES (\"" . mysql_real_escape_string($_POST['adminUser']) . "\",\"" . mysql_real_escape_string(md5($_POST['adminPass'])) . "\",\"" . mysql_real_escape_string($_POST['adminEmail']) . "\",\"" . mysql_real_escape_string($_SERVER['REMOTE_IP']) . "\")"; | ||
| 171 | $sql[12] = "INSERT INTO centralServers (url, code, xmlrpc) VALUES (\"" . mysql_real_escape_string('central.fourisland.com') . "\",\"" . mysql_real_escape_string(md5('central.fourisland.com')) . "\",\"" . mysql_real_escape_string('http://central.fourisland.com/xmlrpc.php') . "\")"; | ||
| 172 | |||
| 173 | foreach ($sql as $name => $value) | ||
| 174 | { | ||
| 175 | if (!trim($value) == '') | ||
| 176 | { | ||
| 177 | $sql2 = @mysql_query($value); | ||
| 178 | if (!$sql2) | ||
| 179 | { | ||
| 180 | addError($numOfErrors, $errors, '', "MySQL error \"" . mysql_error() . "\" while filling database"); | ||
| 181 | } | ||
| 182 | } | ||
| 183 | } | ||
| 184 | |||
| 185 | if ($numOfErrors > 0) | ||
| 186 | { | ||
| 187 | showHeader('2'); | ||
| 188 | showStepTwo($_POST['mailDomain'], $_POST['smtpHost'], ($_POST['smtpAuth'] == 'on' ? ' CHECKED' : ''), $_POST['smtpUser'], $_POST['smtpPass'], $_POST['siteName'], $_POST['xmlrpcURL'], $_POST['adminUser'], $_POST['adminPass'], $_POST['adminEmail'], $errors); | ||
| 189 | } else { | ||
| 190 | showHeader('3'); | ||
| 191 | showStepThree(); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | break; | ||
| 196 | } | ||
| 197 | } | ||
| 198 | |||
| 199 | ?><P><CENTER><SMALL><SMALL>InstaDisc (C) Starla Insigna 2008. InstaDisc Setup uses the UniForm form theme</SMALL></SMALL></CENTER></BODY></HTML><?php | ||
| 200 | |||
| 201 | function showHeader($number) | ||
| 6 | { | 202 | { | 
| 7 | ?>Welcome to the InstaDisc Central Server installation! Please input your database details here:<P><FORM ACTION="./install.php?step=2" METHOD="POST">Database host: <INPUT TYPE="text" NAME="host" VALUE="localhost"><BR>Username: <INPUT TYPE="text" NAME="username" VALUE="root"><BR>Password: <INPUT TYPE="text" NAME="password"><BR>Database name: <INPUT TYPE="text" NAME="name"> (Note: You must create this database BEFORE running installation)<BR><INPUT TYPE="submit"></FORM><?php | 203 | ?><HTML><HEAD><TITLE>InstaDisc Server Setup Step <?php echo($number); ?></TITLE><LINK REL="stylesheet" TYPE="text/css" HREF="uniform.css"></HEAD><BODY><CENTER><H1>InstaDisc Installation</H1></CENTER><P><?php | 
| 8 | } else if ($_GET['step']==2) | 204 | } | 
| 205 | |||
| 206 | function showStepOne($host, $username, $password, $dbname, $errors) | ||
| 9 | { | 207 | { | 
| 10 | if (!mysql_connect($_POST['host'], $_POST['username'], $_POST['password'])) | 208 | ?>Welcome to the InstaDisc Central Server installation! Please input your database details below.<P> | 
| 209 | <FORM CLASS="uniform" ACTION="./install.php?submit=1" METHOD="POST"> | ||
| 210 | <?php | ||
| 211 | if (isset($errors[1])) | ||
| 11 | { | 212 | { | 
| 12 | ?>Cannot connect to your database server! Please verify you typed you host, username and password correctly. <A HREF="./install.php">Back</A><?php exit(); | 213 | ?><DIV ID="errorMsg">Uh oh! Validation errors!<P> | 
| 214 | <OL><?php | ||
| 215 | foreach ($errors as $name => $value) | ||
| 216 | { | ||
| 217 | ?><LI><A HREF="#error<?php echo($name); ?>"><?php echo($value['msg']); ?></A></LI><?php | ||
| 218 | } | ||
| 219 | ?></OL></DIV><?php | ||
| 13 | } | 220 | } | 
| 14 | if (!mysql_select_db($_POST['name'])) | 221 | ?> | 
| 222 | <FIELDSET CLASS="inlineLabels"><LEGEND>Database Details</LEGEND> | ||
| 223 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'host'); ?>"> | ||
| 224 | <?php doErrors($errors, 'host'); ?> <LABEL FOR="host"><EM>*</EM> Host: </LABEL> | ||
| 225 | <INPUT TYPE="text" ID="host" NAME="host" CLASS="textInput" VALUE="<?php echo($host); ?>"> | ||
| 226 | </DIV> | ||
| 227 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'username'); ?>"> | ||
| 228 | <?php doErrors($errors, 'username'); ?> <LABEL FOR="username"><EM>*</EM> Username: </LABEL> | ||
| 229 | <INPUT TYPE="text" ID="username" NAME="username" CLASS="textInput" VALUE="<?php echo($username); ?>"> | ||
| 230 | </DIV> | ||
| 231 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'password'); ?>"> | ||
| 232 | <?php doErrors($errors, 'password'); ?> <LABEL FOR="password"><EM>*</EM> Password: </LABEL> | ||
| 233 | <INPUT TYPE="password" ID="password" NAME="password" CLASS="textInput" VALUE="<?php echo($password); ?>"> | ||
| 234 | </DIV> | ||
| 235 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'dbname'); ?>"> | ||
| 236 | <?php doErrors($errors, 'dbname'); ?> <LABEL FOR="dbname"><EM>*</EM> Name: </LABEL> | ||
| 237 | <INPUT TYPE="text" ID="dbname" NAME="dbname" CLASS="textInput" VALUE="<?php echo($dbname); ?>"> | ||
| 238 | <P CLASS="formHint">You need to create this database before running this script.</P> | ||
| 239 | </DIV> | ||
| 240 | </FIELDSET> | ||
| 241 | <DIV CLASS="buttonHolder"> | ||
| 242 | <INPUT TYPE="submit" VALUE="Next"> | ||
| 243 | </DIV></FORM><?php | ||
| 244 | } | ||
| 245 | |||
| 246 | function showStepTwo($mailDomain, $smtpHost, $smtpAuth, $smtpUser, $smtpPass, $siteName, $xmlrpcURL, $adminUser, $adminPass, $adminEmail, $errors) | ||
| 247 | { | ||
| 248 | ?>Your database has been set up. All we need to do now is fill it up a little. Please answer the below questions to set up your configuration: | ||
| 249 | <FORM CLASS="uniform" ACTION="./install.php?submit=2" METHOD="POST"> | ||
| 250 | <?php | ||
| 251 | if (isset($errors[1])) | ||
| 15 | { | 252 | { | 
| 16 | ?>Cannot connect to your database! Please verify that the database you specified already exists and that you spelled it correctly. <A HREF="./install.php">Back</A><?php exit(); | 253 | ?><DIV ID="errorMsg">Uh oh! Validation errors!<P> | 
| 254 | <OL><?php | ||
| 255 | foreach ($errors as $name => $value) | ||
| 256 | { | ||
| 257 | ?><LI><A HREF="#error<?php echo($name); ?>"><?php echo($value['msg']); ?></A></LI><?php | ||
| 258 | } | ||
| 259 | ?></OL></DIV><?php | ||
| 17 | } | 260 | } | 
| 261 | ?> | ||
| 262 | <FIELDSET CLASS="inlineLabels"><LEGEND>Email</LEGEND> | ||
| 263 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'mailDomain'); ?>"> | ||
| 264 | <?php doErrors($errors, 'mailDomain'); ?> <LABEL FOR="mailDomain"><EM>*</EM> Mail Domain: </LABEL> | ||
| 265 | <INPUT TYPE="text" ID="mailDomain" NAME="mailDomain" CLASS="textInput" VALUE="<?php echo($mailDomain); ?>"> | ||
| 266 | <P CLASS="formHint">Type in the part that comes after the @ in your email addresses. This is used when InstaDisc needs to send an email to someone.</P> | ||
| 267 | </DIV> | ||
| 268 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'smtpHost'); ?>"> | ||
| 269 | <?php doErrors($errors, 'smtpHost'); ?> <LABEL FOR="smtpHost"><EM>*</EM> SMTP Host: </LABEL> | ||
| 270 | <INPUT TYPE="text" ID="smtpHost" NAME="smtpHost" CLASS="textInput" VALUE="<?php echo($smtpHost); ?>"> | ||
| 271 | <P CLASS="formHint">This is required because InstaDisc has to be able to send emails to people.</P> | ||
| 272 | </DIV> | ||
| 273 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'smtpAuth'); ?>"> | ||
| 274 | <?php doErrors($errors, 'smtpAuth'); ?> <LABEL FOR="smtpAuth">SMTP Authentication Required? </LABEL> | ||
| 275 | <INPUT TYPE="checkbox" ID="smtpAuth" NAME="smtpAuth" CLASS="textInput"<?php echo($smtpAuth); ?>"> | ||
| 276 | <P CLASS="formHint">If your SMTP server requires authentication (most do), you need to check this box and enter the authentication details in the fields below.</P> | ||
| 277 | </DIV> | ||
| 278 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'smtpUser'); ?>"> | ||
| 279 | <?php doErrors($errors, 'smtpUser'); ?> <LABEL FOR="smtpUser">SMTP Username: </LABEL> | ||
| 280 | <INPUT TYPE="text" ID="smtpUser" NAME="smtpUser" CLASS="textInput" VALUE="<?php echo($smtpUser); ?>"> | ||
| 281 | </DIV> | ||
| 282 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'smtpPass'); ?>"> | ||
| 283 | <?php doErrors($errors, 'smtpPass'); ?> <LABEL FOR="smtpPass">SMTP Password: </LABEL> | ||
| 284 | <INPUT TYPE="password" ID="smtpPass" NAME="smtpPass" CLASS="textInput" VALUE="<?php echo($smtpPass); ?>"> | ||
| 285 | <P CLASS="formHint">The two above fields only need be filled out if the "SMTP Authentication Required?" box is checked.</P> | ||
| 286 | </DIV> | ||
| 287 | </FIELDSET><FIELDSET CLASS="inlineLabels"><LEGEND>Website</LEGEND> | ||
| 288 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'siteName'); ?>"> | ||
| 289 | <?php doErrors($errors, 'siteName'); ?> <LABEL FOR="siteName"><EM>*</EM> Site Name: </LABEL> | ||
| 290 | <INPUT TYPE="text" ID="siteName" NAME="siteName" CLASS="textInput" VALUE="<?php echo($siteName); ?>"> | ||
| 291 | <P CLASS="formHint">Your website's name is required for a little personalization of emails.</P> | ||
| 292 | </DIV> | ||
| 293 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'xmlrpcURL'); ?>"> | ||
| 294 | <?php doErrors($errors, 'xmlrpcURL'); ?> <LABEL FOR="xmlrpcURL"><EM>*</EM> XML-RPC URL: </LABEL> | ||
| 295 | <INPUT TYPE="text" ID="xmlrpcURL" NAME="xmlrpcURL" CLASS="textInput" VALUE="<?php echo($xmlrpcURL); ?>"> | ||
| 296 | <P CLASS="formHint">What is the URL of the xmlrpc.php file provided for you in the InstaDisc package?</P> | ||
| 297 | </DIV> | ||
| 298 | </FIELDSET><FIELDSET CLASS="inlineLabels"><LEGEND>Administrator's Account</LEGEND> | ||
| 299 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'adminUser'); ?>"> | ||
| 300 | <?php doErrors($errors, 'adminUser'); ?> <LABEL FOR="adminUser"><EM>*</EM> Admin Username: </LABEL> | ||
| 301 | <INPUT TYPE="text" ID="adminUser" NAME="adminUser" CLASS="textInput" VALUE="<?php echo($adminUser); ?>"> | ||
| 302 | </DIV> | ||
| 303 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'adminPass'); ?>"> | ||
| 304 | <?php doErrors($errors, 'adminPass'); ?> <LABEL FOR="adminPass"><EM>*</EM> Admin Password: </LABEL> | ||
| 305 | <INPUT TYPE="password" ID="adminPass" NAME="adminPass" CLASS="textInput" VALUE="<?php echo($adminPass); ?>"> | ||
| 306 | </DIV> | ||
| 307 | <DIV CLASS="ctrlHolder<?php ifErrors($errors, 'adminEmail'); ?>"> | ||
| 308 | <?php doErrors($errors, 'adminEmail'); ?> <LABEL FOR="adminEmail"><EM>*</EM> Admin Email: </LABEL> | ||
| 309 | <INPUT TYPE="text" ID="adminEmail" NAME="adminEmail" CLASS="textInput" VALUE="<?php echo($adminEmail); ?>"> | ||
| 310 | <P CLASS="formHint">You, the administrator, must have an account on your InstaDisc server to be able to edit configuration values (mostly the ones you just entered) at will.</P> | ||
| 311 | </DIV> | ||
| 312 | </FIELDSET> | ||
| 313 | <DIV CLASS="buttonHolder"> | ||
| 314 | <INPUT TYPE="submit" VALUE="Next"> | ||
| 315 | </DIV></FORM><?php | ||
| 316 | } | ||
| 18 | 317 | ||
| 318 | function showStepThree() | ||
| 319 | { | ||
| 19 | ?>Congradulations! You've successfully set up your InstaDisc Central Server's database! Now, the next step for you is to implement the functions in instadisc.php into your web application. Read README.txt for more information.<?php | 320 | ?>Congradulations! You've successfully set up your InstaDisc Central Server's database! Now, the next step for you is to implement the functions in instadisc.php into your web application. Read README.txt for more information.<?php | 
| 20 | } | 321 | } | 
| 21 | ?> | 322 | |
| 323 | function ifErrors($errors, $id) | ||
| 324 | { | ||
| 325 | foreach ($errors as $name => $value) | ||
| 326 | { | ||
| 327 | if ($value['field'] == $id) | ||
| 328 | { | ||
| 329 | echo(' error'); | ||
| 330 | return; | ||
| 331 | } | ||
| 332 | } | ||
| 333 | } | ||
| 334 | |||
| 335 | |||
| 336 | function doErrors($errors, $id) | ||
| 337 | { | ||
| 338 | foreach ($errors as $name => $value) | ||
| 339 | { | ||
| 340 | if ($value['field'] == $id) | ||
| 341 | { | ||
| 342 | ?> <P ID="error<?php echo($name); ?>" CLASS="errorField"><EM>*</EM> <?php echo($value['msg']); ?></P><?php echo("\n"); | ||
| 343 | } | ||
| 344 | } | ||
| 345 | } | ||
| 346 | |||
| 347 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
| 348 | { | ||
| 349 | $numOfErrors++; | ||
| 350 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
| 351 | } | ||
| diff --git a/central/trunk/uniform.css b/central/trunk/uniform.css new file mode 100644 index 0000000..ae810cb --- /dev/null +++ b/central/trunk/uniform.css | |||
| @@ -0,0 +1,268 @@ | |||
| 1 | /* uniForm */ | ||
| 2 | .uniForm{ | ||
| 3 | margin:0; padding:0; | ||
| 4 | position:relative; | ||
| 5 | width:100%; | ||
| 6 | /* user prefs */ | ||
| 7 | padding:10px 0; | ||
| 8 | } | ||
| 9 | |||
| 10 | /* Some generals */ | ||
| 11 | .uniForm fieldset{ | ||
| 12 | border:none; | ||
| 13 | margin:0; padding:0; | ||
| 14 | /* user prefs */ | ||
| 15 | margin:0 0 7px 0; padding:0 0 10px 0; | ||
| 16 | border-bottom:1px solid #efefef; | ||
| 17 | } | ||
| 18 | .uniForm fieldset legend{ | ||
| 19 | color:#000; /* Reset IE */ | ||
| 20 | margin:0; padding:0; | ||
| 21 | /* user prefs */ | ||
| 22 | margin:0 0 .5em 0; | ||
| 23 | font:bold small-caps 100%/100% "lucida grande", "lucida sans unicode", "trebuchet ms", arial, verdana, sans-serif; | ||
| 24 | letter-spacing:.1em; | ||
| 25 | color:#93b5be; | ||
| 26 | } | ||
| 27 | |||
| 28 | .ctrlHolder{ /* This is the main unit that contains our form "modules" */ | ||
| 29 | overflow:hidden; | ||
| 30 | margin:0; padding:0; | ||
| 31 | clear:both; | ||
| 32 | /* user prefs */ | ||
| 33 | background:#f9f9f9; | ||
| 34 | margin:0; padding:7px 4px; | ||
| 35 | } | ||
| 36 | |||
| 37 | .buttonHolder{ | ||
| 38 | overflow:hidden; | ||
| 39 | clear:both; | ||
| 40 | /* user prefs */ | ||
| 41 | background:#f9f9f9; | ||
| 42 | border:1px solid #ccc; border-width:1px 0; | ||
| 43 | margin:10px 0 0 0; padding:10px; | ||
| 44 | text-align:right; | ||
| 45 | } | ||
| 46 | .resetButton{ | ||
| 47 | } | ||
| 48 | .submitButton{ | ||
| 49 | } | ||
| 50 | |||
| 51 | .uniForm .inlineLabel{ | ||
| 52 | width:auto; | ||
| 53 | float:none; | ||
| 54 | display:inline; | ||
| 55 | /* user prefs */ | ||
| 56 | margin:0 2em 0 0; | ||
| 57 | font-weight:normal; | ||
| 58 | } | ||
| 59 | .uniForm .inlineLabel input{ | ||
| 60 | } | ||
| 61 | |||
| 62 | /* Highlighting the rows on input focus */ | ||
| 63 | .focused{ | ||
| 64 | background:#FFFCDF url(/theme/images/uf_focused.png); | ||
| 65 | border:1px solid #EFE795; border-width:1px 0; | ||
| 66 | padding:6px 4px; | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | /* Styles for form controls where labels are in line with the input elements */ | ||
| 71 | /* Set the class to the parent to .inlineLabels */ | ||
| 72 | .inlineLabels .ctrlHolder{ | ||
| 73 | } | ||
| 74 | .inlineLabels label, | ||
| 75 | .inlineLabels .label{ | ||
| 76 | float:left; | ||
| 77 | margin:.3em 0 0 0; padding:0; | ||
| 78 | line-height:100%; | ||
| 79 | /* user prefs */ | ||
| 80 | width:30%; | ||
| 81 | font-weight:bold; | ||
| 82 | } | ||
| 83 | |||
| 84 | .inlineLabels .textInput, | ||
| 85 | .inlineLabels .fileUpload{ | ||
| 86 | float:left; | ||
| 87 | /* user prefs */ | ||
| 88 | width:68%; | ||
| 89 | border:2px solid #dfdfdf; | ||
| 90 | } | ||
| 91 | .inlineLabels .fileUpload > input{ | ||
| 92 | } | ||
| 93 | |||
| 94 | .inlineLabels .selectInput{ | ||
| 95 | float:left; | ||
| 96 | /* user prefs */ | ||
| 97 | width:69%; | ||
| 98 | border:2px solid #dfdfdf; | ||
| 99 | } | ||
| 100 | |||
| 101 | .inlineLabels textarea{ | ||
| 102 | float:left; | ||
| 103 | width:68%; | ||
| 104 | /* user prefs */ | ||
| 105 | border:2px solid #dfdfdf; | ||
| 106 | height:12em; | ||
| 107 | } | ||
| 108 | |||
| 109 | .inlineLabels .formHint{ | ||
| 110 | clear:both; | ||
| 111 | /* user prefs */ | ||
| 112 | color:#999; | ||
| 113 | margin:.5em 0 0 30%; padding:3px 0; | ||
| 114 | font-size:80%; | ||
| 115 | } | ||
| 116 | |||
| 117 | /* inlineLabels esthetics */ | ||
| 118 | .inlineLabels .formHint strong{ | ||
| 119 | padding:0 0 0 14px; | ||
| 120 | background:url(/theme/images/icon_alert.png) 0 0 no-repeat; | ||
| 121 | display:inline-block; | ||
| 122 | } | ||
| 123 | |||
| 124 | |||
| 125 | /* ########################################################################## */ | ||
| 126 | |||
| 127 | /* Styles for form controls where labels are above the input elements */ | ||
| 128 | /* Set the class to the parent to .blockLabels */ | ||
| 129 | .blockLabels .ctrlHolder{ | ||
| 130 | } | ||
| 131 | |||
| 132 | .blockLabels label, | ||
| 133 | .blockLabels .label{ | ||
| 134 | display:block; | ||
| 135 | float:none; | ||
| 136 | margin:.3em 0; padding:0; | ||
| 137 | line-height:100%; | ||
| 138 | width:60%; | ||
| 139 | /* user prefs */ | ||
| 140 | font-weight:bold; | ||
| 141 | width:auto; | ||
| 142 | } | ||
| 143 | .blockLabels .label{ | ||
| 144 | float:left; | ||
| 145 | margin-right:3em; | ||
| 146 | } | ||
| 147 | |||
| 148 | .blockLabels .textInput{ | ||
| 149 | float:left; | ||
| 150 | width:60%; | ||
| 151 | /* user prefs */ | ||
| 152 | border:2px solid #dfdfdf; | ||
| 153 | } | ||
| 154 | |||
| 155 | .blockLabels .selectInput{ | ||
| 156 | float:left; | ||
| 157 | width:60%; | ||
| 158 | /* user prefs */ | ||
| 159 | border:2px solid #dfdfdf; | ||
| 160 | |||
| 161 | } | ||
| 162 | |||
| 163 | .blockLabels textarea{ | ||
| 164 | display:block; | ||
| 165 | float:left; | ||
| 166 | /* user prefs */ | ||
| 167 | border:2px solid #dfdfdf; | ||
| 168 | height:12em; | ||
| 169 | } | ||
| 170 | |||
| 171 | .blockLabels .formHint{ | ||
| 172 | float:right; | ||
| 173 | margin:0; | ||
| 174 | width:38%; | ||
| 175 | clear:none; | ||
| 176 | /* user prefs */ | ||
| 177 | color:#999; | ||
| 178 | font-size:80%; | ||
| 179 | font-style:italic; | ||
| 180 | } | ||
| 181 | |||
| 182 | /* blockLabels esthetics */ | ||
| 183 | .blockLabels .ctrlHolder{ | ||
| 184 | border:1px solid #dfdfdf; border-width:1px 0; | ||
| 185 | margin-top:-1px; | ||
| 186 | } | ||
| 187 | |||
| 188 | .blockLabels .focused{ | ||
| 189 | padding:7px 4px; | ||
| 190 | } | ||
| 191 | |||
| 192 | /* ########################################################################## */ | ||
| 193 | |||
| 194 | /* Focus pseudoclasses */ | ||
| 195 | .ctrlHolder .textInput:focus{ | ||
| 196 | border-color:#DFD77D; | ||
| 197 | } | ||
| 198 | div.focused .textInput:focus{ | ||
| 199 | } | ||
| 200 | div.focused .formHint{ | ||
| 201 | color:#000; | ||
| 202 | } | ||
| 203 | |||
| 204 | /* Required asterisk styling, use if needed */ | ||
| 205 | label em, | ||
| 206 | .label em{ | ||
| 207 | display:block; | ||
| 208 | position:absolute; left:28%; | ||
| 209 | font-style:normal; | ||
| 210 | font-weight:bold; | ||
| 211 | } | ||
| 212 | .blockLabels label em, | ||
| 213 | .blockLabels .label em{ | ||
| 214 | position:static; | ||
| 215 | display:inline; | ||
| 216 | } | ||
| 217 | |||
| 218 | /* Messages */ | ||
| 219 | .uniForm #errorMsg{ | ||
| 220 | background:#ffdfdf url(/theme/images/uf_error.png); | ||
| 221 | border:1px solid #df7d7d; border-width:1px 0; | ||
| 222 | margin:0 0 1em 0; padding:1em; | ||
| 223 | } | ||
| 224 | .uniForm .error, | ||
| 225 | .uniForm .blockLabels.ctrlHolder.error{ | ||
| 226 | background:#ffdfdf url(/theme/images/uf_error.png); | ||
| 227 | border:1px solid #df7d7d; border-width:1px 0; | ||
| 228 | position:relative; | ||
| 229 | } | ||
| 230 | .uniForm #errorMsg dt, | ||
| 231 | .uniForm #errorMsg h3{ | ||
| 232 | margin:0 0 .5em 0; | ||
| 233 | font-size:110%; | ||
| 234 | line-height:100%; | ||
| 235 | font-weight:bold; | ||
| 236 | color:#000; | ||
| 237 | padding:2px 0 2px 18px; | ||
| 238 | background:url(/theme/images/icon-error.png) 0 0 no-repeat; | ||
| 239 | } | ||
| 240 | .uniForm #errorMsg dd{ | ||
| 241 | margin:0; padding:0; | ||
| 242 | } | ||
| 243 | .uniForm #errorMsg ol{ | ||
| 244 | margin:0; padding:0; | ||
| 245 | } | ||
| 246 | .uniForm #errorMsg ol li{ | ||
| 247 | margin:0; padding:2px; | ||
| 248 | list-style-position:inside; | ||
| 249 | border-bottom:1px dotted #df7d7d; | ||
| 250 | position:relative; | ||
| 251 | } | ||
| 252 | .uniForm .errorField{ | ||
| 253 | margin:0 0 3px 0; | ||
| 254 | } | ||
| 255 | .uniForm .inlineLabels .errorField{ | ||
| 256 | margin-left:30%; | ||
| 257 | } | ||
| 258 | .uniForm .errorField strong{ | ||
| 259 | background:#FFE2E2; | ||
| 260 | padding:1px 3px 3px 3px; | ||
| 261 | } | ||
| 262 | .ctrlHolder.error input, | ||
| 263 | .ctrlHolder.error input:focus{ | ||
| 264 | border-color:#DF7D7D; | ||
| 265 | } | ||
| 266 | .ctrlHolder.error.focused{ | ||
| 267 | padding:7px 4px; | ||
| 268 | } | ||
| diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index 5377a3b..efaa70f 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php | |||
| @@ -96,7 +96,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription | |||
| 96 | 96 | ||
| 97 | $client = new xmlrpc_client($getcs3[$i]['xmlrpc']); | 97 | $client = new xmlrpc_client($getcs3[$i]['xmlrpc']); | 
| 98 | $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'), | 98 | $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'), | 
| 99 | new xmlrpcval(md5($cserver + ":" + $getuk3['key'] + ":" + $verID), 'string'), | 99 | new xmlrpcval(md5($cserver + ":" + $getuk3['code'] + ":" + $verID), 'string'), | 
| 100 | new xmlrpcval($verID, 'int'), | 100 | new xmlrpcval($verID, 'int'), | 
| 101 | new xmlrpcval($subscription, 'string'), | 101 | new xmlrpcval($subscription, 'string'), | 
| 102 | new xmlrpcval($title, 'string'), | 102 | new xmlrpcval($title, 'string'), | 
| @@ -118,7 +118,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription | |||
| 118 | 118 | ||
| 119 | function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $softwareVersion, $databaseVersion) | 119 | function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $softwareVersion, $databaseVersion) | 
| 120 | { | 120 | { | 
| 121 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'key')) | 121 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) | 
| 122 | { | 122 | { | 
| 123 | if ($softwareVersion > instaDisc_getConfig('softwareVersion')) | 123 | if ($softwareVersion > instaDisc_getConfig('softwareVersion')) | 
| 124 | { | 124 | { | 
| @@ -134,7 +134,7 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription | |||
| 134 | 134 | ||
| 135 | $client = new xmlrpc_client($cserver); | 135 | $client = new xmlrpc_client($cserver); | 
| 136 | $msg = new xmlrpcmsg("InstaDisc.sendUpdateNotice", array( new xmlrpcval($cserver2, 'string'), | 136 | $msg = new xmlrpcmsg("InstaDisc.sendUpdateNotice", array( new xmlrpcval($cserver2, 'string'), | 
| 137 | new xmlrpcval(md5($cserver2 . ':' . $getuk3['key'] . ':' . $verID), 'string'), | 137 | new xmlrpcval(md5($cserver2 . ':' . $getuk3['code'] . ':' . $verID), 'string'), | 
| 138 | new xmlrpcval($verID, 'int'), | 138 | new xmlrpcval($verID, 'int'), | 
| 139 | new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'))); | 139 | new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'))); | 
| 140 | $client->send($msg); | 140 | $client->send($msg); | 
| @@ -151,7 +151,7 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription | |||
| 151 | 151 | ||
| 152 | $client = new xmlrpc_client($cserver); | 152 | $client = new xmlrpc_client($cserver); | 
| 153 | $msg = new xmlrpcmsg("InstaDisc.askForDatabase", array( new xmlrpcval($cserver2, 'string'), | 153 | $msg = new xmlrpcmsg("InstaDisc.askForDatabase", array( new xmlrpcval($cserver2, 'string'), | 
| 154 | new xmlrpcval(md5($cserver2 . ':' . $getuk3['key'] . ':' . $verID), 'string'), | 154 | new xmlrpcval(md5($cserver2 . ':' . $getuk3['code'] . ':' . $verID), 'string'), | 
| 155 | new xmlrpcval($verID, 'int'), | 155 | new xmlrpcval($verID, 'int'), | 
| 156 | new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); | 156 | new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); | 
| 157 | $client->send($msg); | 157 | $client->send($msg); | 
| @@ -177,7 +177,7 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription | |||
| 177 | 177 | ||
| 178 | function sendUpdateNotice($cserver, $verification, $verificationID, $softwareVersion) | 178 | function sendUpdateNotice($cserver, $verification, $verificationID, $softwareVersion) | 
| 179 | { | 179 | { | 
| 180 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'key')) | 180 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) | 
| 181 | { | 181 | { | 
| 182 | if ($softwareVersion > instaDisc_getConfig('softwareVersion')) | 182 | if ($softwareVersion > instaDisc_getConfig('softwareVersion')) | 
| 183 | { | 183 | { | 
| @@ -192,7 +192,7 @@ function sendUpdateNotice($cserver, $verification, $verificationID, $softwareVer | |||
| 192 | 192 | ||
| 193 | function askForDatabase($cserver, $verification, $verificationID, $databaseVersion) | 193 | function askForDatabase($cserver, $verification, $verificationID, $databaseVersion) | 
| 194 | { | 194 | { | 
| 195 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'key')) | 195 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) | 
| 196 | { | 196 | { | 
| 197 | if ($databaseVersion < instaDisc_getConfig('databaseVersion')) | 197 | if ($databaseVersion < instaDisc_getConfig('databaseVersion')) | 
| 198 | { | 198 | { | 
| @@ -239,7 +239,7 @@ function addSubscription($username, $verification, $verificationID, $subscriptio | |||
| 239 | 239 | ||
| 240 | function sendDatabase($cserver, $verification, $verificationID, $db) | 240 | function sendDatabase($cserver, $verification, $verificationID, $db) | 
| 241 | { | 241 | { | 
| 242 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'key')) | 242 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) | 
| 243 | { | 243 | { | 
| 244 | if (isset($db['central.fourisland.com'])) | 244 | if (isset($db['central.fourisland.com'])) | 
| 245 | { | 245 | { | 
| @@ -247,14 +247,14 @@ function sendDatabase($cserver, $verification, $verificationID, $db) | |||
| 247 | $getfi2 = mysql_query($getfi); | 247 | $getfi2 = mysql_query($getfi); | 
| 248 | $getfi3 = mysql_fetch_array($getfi2); | 248 | $getfi3 = mysql_fetch_array($getfi2); | 
| 249 | 249 | ||
| 250 | if ($db['central.fourisland.com']['key'] == $getfi3['key']) | 250 | if ($db['central.fourisland.com']['code'] == $getfi3['code']) | 
| 251 | { | 251 | { | 
| 252 | $deldb = "DELETE FROM centralServers"; | 252 | $deldb = "DELETE FROM centralServers"; | 
| 253 | $deldb2 = mysql_query($deldb); | 253 | $deldb2 = mysql_query($deldb); | 
| 254 | 254 | ||
| 255 | foreach($db as $name => $value) | 255 | foreach($db as $name => $value) | 
| 256 | { | 256 | { | 
| 257 | $insdb = "INSERT INTO centralServers (url, key, xmlrpc) VALUES (\"" . mysql_real_escape_string($name) . "\", \"" . mysql_real_escape_string($value['key']) . "\", \"" . mysql_real_escape_string($value['xmlrpc']) . "\")"; | 257 | $insdb = "INSERT INTO centralServers (url, code, xmlrpc) VALUES (\"" . mysql_real_escape_string($name) . "\", \"" . mysql_real_escape_string($value['code']) . "\", \"" . mysql_real_escape_string($value['xmlrpc']) . "\")"; | 
| 258 | $insdb2 = mysql_query($insdb); | 258 | $insdb2 = mysql_query($insdb); | 
| 259 | } | 259 | } | 
| 260 | 260 | ||
