about summary refs log tree commit diff stats
path: root/series/core
diff options
context:
space:
mode:
Diffstat (limited to 'series/core')
-rw-r--r--series/core/trunk/install.php235
-rw-r--r--series/core/trunk/theme/uniform.css268
2 files changed, 503 insertions, 0 deletions
diff --git a/series/core/trunk/install.php b/series/core/trunk/install.php index 3b3f202..0f7549d 100644 --- a/series/core/trunk/install.php +++ b/series/core/trunk/install.php
@@ -2,4 +2,239 @@
2 2
3/* InstaDisc Series - A Four Island Project */ 3/* InstaDisc Series - A Four Island Project */
4 4
5if (!isset($_GET['submit']))
6{
7 showHeader('1');
8 showStepOne('localhost', 'root', '', 'instadisc', array());
9} else {
10 $numOfErrors = 0;
11 $errors = array();
12
13 switch ($_GET['submit'])
14 {
15 case 1:
16 if ($_POST['host'] == '')
17 {
18 addError($numOfErrors, $errors, 'host', 'Hostname is a required field');
19 }
20
21 if ($_POST['username'] == '')
22 {
23 addError($numOfErrors, $errors, 'username', 'Username is a required field');
24 }
25
26 if ($_POST['password'] == '')
27 {
28 addError($numOfErrors, $errors, 'password', 'Password is a required field');
29 }
30
31 if ($_POST['dbname'] == '')
32 {
33 addError($numOfErrors, $errors, 'dbname', 'Name is a required field');
34 }
35
36 if ($numOfErrors > 0)
37 {
38 showHeader('1');
39 showStepOne($_POST['host'], $_POST['username'], $_POST['password'], $_POST['dbname'], $errors);
40 } else {
41 if (!@mysql_connect($_POST['host'], $_POST['username'], $_POST['password']))
42 {
43 addError($numOfErrors, $errors, '', 'Cannot connect to database server');
44 showHeader('1');
45 showStepOne($_POST['host'], $_POST['username'], $_POST['password'], $_POST['dbname'], $errors);
46 } else {
47 if (!@mysql_select_db($_POST['dbname']))
48 {
49 addError($numOfErrors, $errors, 'dbname', 'Database does not exist');
50 showHeader('1');
51 showStepOne($_POST['host'], $_POST['username'], $_POST['password'], $_POST['dbname'], $errors);
52 } else {
53 $sql = file_get_contents('instadisc.sql');
54 $makedb = split(';', $sql);
55 foreach ($makedb as $name => $value)
56 {
57 if (!trim($value) == '')
58 {
59 $makedb2 = @mysql_query($value);
60 if (!$makedb2)
61 {
62 addError($numOfErrors, $errors, '', "MySQL error \"" . mysql_error() . "\" while creating database");
63 }
64 }
65 }
66
67 @file_put_contents('includes/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?>");
68
69 if (!file_exists('includes/config.php'))
70 {
71 addError($numOfErrors, $errors, '', 'Could not write config.php file, please check directory permissions');
72 }
73
74 if ($numOfErrors > 0)
75 {
76 showHeader('1');
77 showStepOne($_POST['host'], $_POST['username'], $_POST['password'], $_POST['dbname'], $errors);
78 } else {
79 showHeader('2');
80 showStepTwo('', array());
81 }
82 }
83 }
84 }
85
86 break;
87
88 case 2:
89 if ($_POST['siteName'] == '')
90 {
91 addError($numOfErrors, $errors, 'siteName', 'Site Name is a required field');
92 }
93
94 if ($numOfErrors > 0)
95 {
96 showHeader('2');
97 showStepTwo($_POST['mailDomain'], $_POST['smtpHost'], ($_POST['smtpAuth'] == 'on' ? ' CHECKED' : ''), $_POST['smtpUser'], $_POST['smtpPass'], $_POST['siteName'], $_POST['xmlrpcURL'], $_POST['adminUser'], $_POST['adminPass'], $_POST['adminEmail'], $errors);
98 } else {
99 include_once('includes/config.php');
100
101 mysql_connect($dbhost, $dbuser, $dbpass);
102 mysql_select_db($dbname);
103
104 $sql[0] = "INSERT INTO config (name,value) VALUES (\"siteName\",\"" . mysql_real_escape_string($_POST['siteName']) . "\")";
105
106 foreach ($sql as $name => $value)
107 {
108 if (!trim($value) == '')
109 {
110 $sql2 = @mysql_query($value);
111 if (!$sql2)
112 {
113 addError($numOfErrors, $errors, '', "MySQL error \"" . mysql_error() . "\" while filling database");
114 }
115 }
116 }
117
118 if ($numOfErrors > 0)
119 {
120 showHeader('2');
121 showStepTwo($_POST['siteName'], $errors);
122 } else {
123 showHeader('3');
124 showStepThree();
125 }
126 }
127
128 break;
129 }
130}
131
132?><P><CENTER><SMALL><SMALL>InstaDisc (C) Starla Insigna 2008. InstaDisc Setup uses the UniForm form theme</SMALL></SMALL></CENTER></BODY></HTML><?php
133
134function showHeader($number)
135{
136?><HTML><HEAD><TITLE>InstaDisc Series 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
137}
138
139function showStepOne($host, $username, $password, $dbname, $errors)
140{
141?>Welcome to the InstaDisc Series Control installation! Please input your database details below.<P>
142<FORM CLASS="uniform" ACTION="./install.php?submit=1" METHOD="POST">
143<?php
144 if (isset($errors[1]))
145 {
146?><DIV ID="errorMsg">Uh oh! Validation errors!<P>
147<OL><?php
148 foreach ($errors as $name => $value)
149 {
150?><LI><A HREF="#error<?php echo($name); ?>"><?php echo($value['msg']); ?></A></LI><?php
151 }
152?></OL></DIV><?php
153 }
154?>
155<FIELDSET CLASS="inlineLabels"><LEGEND>Database Details</LEGEND>
156<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'host'); ?>">
157<?php doErrors($errors, 'host'); ?> <LABEL FOR="host"><EM>*</EM> Host: </LABEL>
158 <INPUT TYPE="text" ID="host" NAME="host" CLASS="textInput" VALUE="<?php echo($host); ?>">
159</DIV>
160<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'username'); ?>">
161<?php doErrors($errors, 'username'); ?> <LABEL FOR="username"><EM>*</EM> Username: </LABEL>
162 <INPUT TYPE="text" ID="username" NAME="username" CLASS="textInput" VALUE="<?php echo($username); ?>">
163</DIV>
164<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'password'); ?>">
165<?php doErrors($errors, 'password'); ?> <LABEL FOR="password"><EM>*</EM> Password: </LABEL>
166 <INPUT TYPE="password" ID="password" NAME="password" CLASS="textInput" VALUE="<?php echo($password); ?>">
167</DIV>
168<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'dbname'); ?>">
169<?php doErrors($errors, 'dbname'); ?> <LABEL FOR="dbname"><EM>*</EM> Name: </LABEL>
170 <INPUT TYPE="text" ID="dbname" NAME="dbname" CLASS="textInput" VALUE="<?php echo($dbname); ?>">
171 <P CLASS="formHint">You need to create this database before running this script.</P>
172</DIV>
173</FIELDSET>
174<DIV CLASS="buttonHolder">
175 <INPUT TYPE="submit" VALUE="Next">
176</DIV></FORM><?php
177}
178
179function showStepTwo($siteName, $errors)
180{
181?>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:
182<FORM CLASS="uniform" ACTION="./install.php?submit=2" METHOD="POST">
183<?php
184 if (isset($errors[1]))
185 {
186?><DIV ID="errorMsg">Uh oh! Validation errors!<P>
187<OL><?php
188 foreach ($errors as $name => $value)
189 {
190?><LI><A HREF="#error<?php echo($name); ?>"><?php echo($value['msg']); ?></A></LI><?php
191 }
192?></OL></DIV><?php
193 }
5?> 194?>
195<FIELDSET CLASS="inlineLabels"><LEGEND>Website</LEGEND>
196<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'siteName'); ?>">
197<?php doErrors($errors, 'siteName'); ?> <LABEL FOR="siteName"><EM>*</EM> Site Name: </LABEL>
198 <INPUT TYPE="text" ID="siteName" NAME="siteName" CLASS="textInput" VALUE="<?php echo($siteName); ?>">
199 <P CLASS="formHint">Your website's name is required for a little personalization of emails.</P>
200</DIV>
201</FIELDSET>
202<DIV CLASS="buttonHolder">
203 <INPUT TYPE="submit" VALUE="Next">
204</DIV></FORM><?php
205}
206
207function showStepThree()
208{
209?>Congradulations! You've successfully set up your InstaDisc Series Control!<?php
210}
211
212function ifErrors($errors, $id)
213{
214 foreach ($errors as $name => $value)
215 {
216 if ($value['field'] == $id)
217 {
218 echo(' error');
219 return;
220 }
221 }
222}
223
224
225function doErrors($errors, $id)
226{
227 foreach ($errors as $name => $value)
228 {
229 if ($value['field'] == $id)
230 {
231?> <P ID="error<?php echo($name); ?>" CLASS="errorField"><EM>*</EM> <?php echo($value['msg']); ?></P><?php echo("\n");
232 }
233 }
234}
235
236function addError(&$numOfErrors, &$errors, $field, $msg)
237{
238 $numOfErrors++;
239 $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg);
240}
diff --git a/series/core/trunk/theme/uniform.css b/series/core/trunk/theme/uniform.css new file mode 100644 index 0000000..ae810cb --- /dev/null +++ b/series/core/trunk/theme/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 }