diff options
Diffstat (limited to 'central/trunk')
| -rw-r--r-- | central/trunk/addsub.php | 94 | ||||
| -rw-r--r-- | central/trunk/theme/addedsub.tpl | 17 | ||||
| -rw-r--r-- | central/trunk/theme/addsub.tpl | 50 |
3 files changed, 161 insertions, 0 deletions
| diff --git a/central/trunk/addsub.php b/central/trunk/addsub.php new file mode 100644 index 0000000..fd46234 --- /dev/null +++ b/central/trunk/addsub.php | |||
| @@ -0,0 +1,94 @@ | |||
| 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/theme/addedsub.tpl b/central/trunk/theme/addedsub.tpl new file mode 100644 index 0000000..9efa010 --- /dev/null +++ b/central/trunk/theme/addedsub.tpl | |||
| @@ -0,0 +1,17 @@ | |||
| 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 new file mode 100644 index 0000000..148b67c --- /dev/null +++ b/central/trunk/theme/addsub.tpl | |||
| @@ -0,0 +1,50 @@ | |||
| 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> | ||
