Subscription;unsub->Unsubscription;modify->Modify Details;";
$HELP_ITEMS["FormType"]["Title"] = "Form Type";
$HELP_ITEMS["FormType"]["Content"] = "What type of form would you like to create?
Subscription: Allows users to subscribe to your mailing list(s) via your website
Unsubscription: Allows users to unsubscribe from your mailing list(s) via your website.
Modify Details: Allow users to modify their subscription details, including email address and any other custom fields you may have specified";
$FORM_ITEMS["-1"]="submit|Next »:1-forms";
//make the form
$FORM=new AdminForm;
$FORM->title="View Banned";
$FORM->items=$FORM_ITEMS;
$FORM->action=MakeAdminLink("forms?Action=AddForm");
$FORM->MakeForm("New Form Details");
$FORM->output = "Complete the form below to create a new subscription/unsubscription form.
Click on the \"Next\" button to continue." . $FORM->output;
$OUTPUT .= MakeBox("Create Form (Step 1 of 3)", $FORM->output);
$OUTPUT .= '
';
} # end if($Action == 'Add')
if($Action=='GenerateCode') {
include '../includes/forms.inc.php';
$Code=FormCode($FormID);
$FORM_ITEMS["Form HTML"]="textarea|CODE:60:10:" . str_replace(":", ":", htmlentities($Code));
$HELP_ITEMS["CODE"]["Title"] = "Form HTML";
$HELP_ITEMS["CODE"]["Content"] = "This is the code that you should place on your website to let your visitors subscribe to your newsletter. Simply select all of the code, right click in the textbox and choose copy. Then, edit your web page and paste the code into the place where you want it to display.";
$FORM_ITEMS[-2]="spacer| ";
$FORM=new AdminForm;
$FORM->title="GetHTML";
$FORM->items=$FORM_ITEMS;
$FORM->action=MakeAdminLink("forms");
$FORM->MakeForm("HTML Form Code");
$FORM->output = "The code for your form is shown below. Simply copy the code below and paste it into your website." . $FORM->output;
$OUTPUT.=MakeBox("Generate Form Code",$FORM->output);
$DontDo=1;
} # end if($Action=="GenerateCode")
if($Action=='GeneralOptions') {
$form=mysql_fetch_assoc(mysql_query("SELECT * FROM " . $TABLEPREFIX . "forms WHERE FormID='".addslashes($FormID)."'"));
$form = stripslashes_array($form);
if($SubSave) {
mysql_query("UPDATE " . $TABLEPREFIX . "forms SET SelectLists='".addslashes($SelectLists)."', SendThankyou='".addslashes($SendThankyou)."', RequireConfirm='".addslashes($RequireConfirm)."' WHERE FormID='".addslashes($FormID)."'");
mysql_query("DELETE FROM " . $TABLEPREFIX . "form_lists WHERE FormID='".addslashes($FormID)."'");
foreach($Lists as $AListID=>$val){
if($val==1){
mysql_query("INSERT INTO " . $TABLEPREFIX . "form_lists SET FormID='".addslashes($FormID)."', ListID='".addslashes($AListID)."'");
}
}
$Action='EditForm';
}else{
$FORM_ITEMS["Work on lists"]="spacer|";
$lists=mysql_query("SELECT * FROM " . $TABLEPREFIX . "lists ORDER BY ListName ASC");
while($l=mysql_fetch_assoc($lists)) {
$l = stripslashes_array($l);
if(mysql_num_rows(mysql_query("SELECT * FROM " . $TABLEPREFIX . "form_lists WHERE ListID='".addslashes($l['ListID'])."' AND FormID='".addslashes($FormID)."'"))){$s="CHECKED";}else{$s="";}
$FORM_ITEMS[$l["ListName"]]="checkbox|Lists[".$l["ListID"]."]:1:Yes:$s";
}
$FORM_ITEMS["Require confirmation"]="select|RequireConfirm:1:0->No;1->Yes (Double Opt-In):".$form["RequireConfirm"];
$FORM_ITEMS["Send Thankyou"]="select|SendThankyou:1:0->No;1->Yes:".$form["SendThankyou"];
$FORM_ITEMS["-1"]="submit|Finish";
//make the form
$FORM=new AdminForm;
$FORM->title="View Banned";
$FORM->items=$FORM_ITEMS;
$FORM->action=MakeAdminLink("forms?Action=GeneralOptions&SubSave=Yes&FormID=$FormID");
$FORM->MakeForm();
$OUTPUT.=MakeBox("General form options",$FORM->output);
}
$DontDo=1;
}
if($Action=='AddForm'){
$FormCode=md5(uniqid(rand()));
mysql_query("INSERT INTO " . $TABLEPREFIX . "forms SET FormCode='".addslashes($FormCode)."', FormType='".addslashes($FormType)."', FormName='".addslashes($FormName)."', DateCreated='".addslashes($SYSTEMTIME)."', AdminID='" . addslashes($CURRENTADMIN['AdminID']) . "', TemplateID='".addslashes($TemplateID)."'");
$FormID=mysql_insert_id();
$Action="EditForm";
}
if($Action=='EditForm'){
$form=mysql_fetch_assoc(mysql_query("SELECT * FROM " . $TABLEPREFIX . "forms WHERE FormID='".addslashes($FormID)."'"));
$form = stripslashes_array($form);
if($Save){
switch($form['FormType']) {
case 'sub':
case 'modify':
mysql_query("UPDATE " . $TABLEPREFIX . "forms SET SelectLists='".addslashes($SelectLists)."', SendThankyou='".addslashes($SendThankyou)."', RequireConfirm='".addslashes($RequireConfirm)."', TemplateID='".addslashes($TemplateID)."' WHERE FormID='".addslashes($FormID)."'");
mysql_query("DELETE FROM " . $TABLEPREFIX . "form_lists WHERE FormID='".addslashes($FormID)."'");
foreach($Lists as $AListID=>$val){
if($val==1){
mysql_query("INSERT INTO " . $TABLEPREFIX . "form_lists SET FormID='".addslashes($FormID)."', ListID='".addslashes($AListID)."'");
}
}
$reset_qry = "DELETE FROM " . $TABLEPREFIX . "form_fields WHERE FormID='".addslashes($FormID)."' AND AdminID='".addslashes($CURRENTADMIN['AdminID'])."'";
mysql_query($reset_qry);
if (!empty($_POST['Fields'])) {
foreach(array_keys($_POST['Fields']) as $include_field) {
$insert_qry = "INSERT INTO " . $TABLEPREFIX . "form_fields (FormID, FieldID, FieldOrder, AdminID) VALUES ('".addslashes($FormID)."', '".addslashes($include_field)."', '" . addslashes((int)$_POST['FieldOrder'][$include_field]) . "', '" . addslashes($CURRENTADMIN['AdminID'])."')";
mysql_query($insert_qry);
}
}
break;
case 'unsub':
mysql_query("UPDATE " . $TABLEPREFIX . "forms SET SelectLists='".addslashes($SelectLists)."', SendThankyou='".addslashes($SendThankyou)."', RequireConfirm='".addslashes($RequireConfirm)."', TemplateID='".addslashes($TemplateID)."' WHERE FormID='".addslashes($FormID)."'");
mysql_query("DELETE FROM " . $TABLEPREFIX . "form_lists WHERE FormID='".addslashes($FormID)."'");
if($Lists) {
foreach($Lists as $ListID=>$val){
if($val==1){
mysql_query("INSERT INTO " . $TABLEPREFIX . "form_lists SET FormID='".addslashes($FormID)."', ListID='".addslashes($ListID)."'");
}
}
}
break;
}
mysql_query("UPDATE " . $TABLEPREFIX . "forms SET FormName='".addslashes($FormName)."', Status='".addslashes($Status)."' WHERE FormID='".addslashes($FormID)."'");
$SelectedType=$form["FormType"];
$Action = "ResponseOptions";
$SubSave = "";
}else{
$form=mysql_fetch_assoc(mysql_query("SELECT * FROM " . $TABLEPREFIX . "forms WHERE FormID='".addslashes($FormID)."'"));
$form = stripslashes_array($form);
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Form Name"]="textfield|FormName:100:44:".$form["FormName"];
$HELP_ITEMS["FormName"]["Title"] = "Form Name";
$HELP_ITEMS["FormName"]["Content"] = "Enter the name of this form here. The form name is used in the control panel for your reference and is also included in the HTML code that you can place on your site. An example would be "MySite.com Newsletter Subscription Form"";
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Form Design"]="select|TemplateID:1:6->HTML Only (No Style);0->Default White;1->Chisel Gray;2->Midnight Blue;3->Sunrise Orange;4->Evergreen;5->Devilish Red;:" . $form["TemplateID"] . "::";
$HELP_ITEMS["TemplateID"]["Title"] = "Preview Form";
$HELP_ITEMS["TemplateID"]["Content"] = "Which design will we use to generate your form?
Click on \'Preview Form\' to view your form including the options you choose below.";
$FORM_ITEMS[$FORM_NOT_REQUIRED_ITEM . " "]="raw| Preview Form";
if ($form['FormType'] != 'modify') {
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Require Confirmation"]="select|RequireConfirm:1:0->No;1->Yes:".$form["RequireConfirm"];
$HELP_ITEMS["RequireConfirm"]["Title"] = "Require Confirmation?";
if($form["FormType"] == "sub")
$HELP_ITEMS["RequireConfirm"]["Content"] = "If yes, then a double opt-in process will be used to verify subscribers. This means that after they complete the subscription form, they will also be required to confirm their email address by clicking on a link inside an email that will be sent to them automatically.";
else
$HELP_ITEMS["RequireConfirm"]["Content"] = "If yes, then a double opt-out process will be used to verify unsubscribers. This means that after they complete the unsubscription form, they will also be required to confirm their email address by clicking on a link inside an email that will be sent to them automatically.";
$FORM_ITEMS[$FORM_REQUIRED_ITEM . "Send Thank you"]="select|SendThankyou:1:0->No;1->Yes:".$form["SendThankyou"];
$HELP_ITEMS["SendThankyou"]["Title"] = "Send Thank you?";
}
if($form["FormType"] == "sub")
$HELP_ITEMS["SendThankyou"]["Content"] = "If yes, a thank you email will be sent to this subscriber after they complete the subscription form.";
else
$HELP_ITEMS["SendThankyou"]["Content"] = "If yes, a thank you email will be sent to this subscriber after they complete the unsubscription form.";
if($form["FormType"] == "sub")
$HELP_ITEMS["SelectLists"]["Content"] = "If yes, all lists will automatically be ticked for subscription.";
else
$HELP_ITEMS["SelectLists"]["Content"] = "If yes, all lists will automatically be ticked for unsubscription.";
$e = 0;
switch($form['FormType']){
case 'sub':
case 'modify':
$fields_selected = array();
switch($form['FormType']) {
case 'sub':
$desc = 'Lists to Subscribe to';
break;
case 'modify':
$desc = 'Lists to modify details for';
break;
}
$FORM_ITEMS["-100"]="spacer|
| $desc | |
| "; $lists=mysql_query("SELECT * FROM " . $TABLEPREFIX . "lists ORDER BY ListName ASC"); while($l=mysql_fetch_assoc($lists)){ $l = stripslashes_array($l); if(AllowList($l['ListID'])) { $e++; if(mysql_num_rows(mysql_query("SELECT * FROM " . $TABLEPREFIX . "form_lists WHERE ListID='".addslashes($l['ListID'])."' AND FormID='".addslashes($FormID)."'"))) { $s="CHECKED"; } else { $s=""; } $FORM_ITEMS[" " . $l["ListName"]]="checkbox|Lists[".$l["ListID"]."]:1:Yes:$s"; } } $all_fields = array(); $skip = array(); $ordered_fields_query = "SELECT lf.*, ff.FieldOrder, 'CHECKED' AS selected FROM " . $TABLEPREFIX . "form_fields ff, " . $TABLEPREFIX . "list_fields lf WHERE ff.FieldID=lf.FieldID AND ff.FormID='" . addslashes($FormID) . "'"; if (!isset($CURRENTADMIN['Manager']) || $CURRENTADMIN['Manager'] == 0) $ordered_fields_query .= " AND lf.AdminID='" . addslashes($CURRENTADMIN['AdminID']) . "'"; $ordered_fields_query .= " ORDER BY ff.FieldOrder, lf.FieldName"; $ordered_fields_result = mysql_query($ordered_fields_query); if (mysql_num_rows($ordered_fields_result) > 0) { while($row = mysql_fetch_assoc($ordered_fields_result)) { $row = stripslashes_array($row); $all_fields[$row['FieldID']] = $row; $skip[] = $row['FieldID']; } } if (empty($skip)) $skip[] = '0'; $unordered_fields_query = "SELECT *, 0 AS FieldOrder, 0 AS selected FROM " . $TABLEPREFIX . "list_fields WHERE FieldID NOT IN (" . implode(',', $skip) . ")"; if (!isset($CURRENTADMIN['Manager']) || $CURRENTADMIN['Manager'] == 0) $unordered_fields_query .= " AND AdminID='".addslashes($CURRENTADMIN['AdminID'])."'"; $unordered_fields_query .= " ORDER BY FieldName ASC"; $unordered_results = mysql_query($unordered_fields_query); if (mysql_num_rows($unordered_results) > 0) { while($row = mysql_fetch_assoc($unordered_results)) { $row = stripslashes_array($row); $all_fields[$row['FieldID']] = $row; } } if (!empty($all_fields)) { $FORM_ITEMS["-102"]="spacer| | |
| Custom Fields to Show | |
| ";
$first = true;
foreach($all_fields as $fieldid => $details) {
$FORM_ITEMS[" " . $details['FieldName'].' ']="checkbox|Fields[".$fieldid."]:1:Yes:" . $details['selected'] . '$$$BAR$$$';
$FORM_ITEMS[" " . $details['FieldName'] . " Order"]="textfield|FieldOrder[".$fieldid."]:2:2:" . $details['FieldOrder'].":0::field20";
if ($first) {
$HELP_ITEMS['FieldOrder[' . $fieldid . ']']['Title'] = 'Include this field';
$HELP_ITEMS['FieldOrder[' . $fieldid . ']']['Content'] = 'If ticked, this field will be included in the form. Sort Order You can also set the order the fields appear in - put in a number (eg 1) for that fields position in the form'; } $first = false; } } break; case 'unsub': $FORM_ITEMS["-101"]="spacer| | |
| Lists to unsubscribe from | |
| ";
$lists=mysql_query("SELECT * FROM " . $TABLEPREFIX . "lists ORDER BY ListName ASC");
while($l=mysql_fetch_assoc($lists)) {
$l = stripslashes_array($l);
if(AllowList($l['ListID'])) {
$e++;
if(mysql_num_rows(mysql_query("SELECT * FROM " . $TABLEPREFIX . "form_lists WHERE ListID='".addslashes($l['ListID'])."' AND FormID='".addslashes($FormID)."'"))) {
$s="CHECKED";
} else {
$s="";
}
$FORM_ITEMS[" " . $l["ListName"]]="checkbox|Lists[".$l["ListID"]."]:1:Yes:$s";
}
}
break;
}
$FORM_ITEMS["-2"]="spacer| "; if($SubAction == "") $FORM_ITEMS[-1]="submit|Next »:1-forms"; else $FORM_ITEMS[-1]="submit|Next »:1-forms"; //make the form $FORM=new AdminForm; $FORM->title="View Banned"; $FORM->items=$FORM_ITEMS; if($SubAction == "") $action = "forms?Action=EditForm&Save=Yes&FormID=$FormID"; else $action = "forms?Action=EditForm&SubAction=Edit&Save=Yes&FormID=$FormID"; $FORM->action=MakeAdminLink($action); $FORM->MakeForm("New Form Details"); $FO=$FORM->output; switch($form['FormType']) { case 'sub': $formType = 'Subscription'; break; case 'unsub': $formType = 'Unsubscription'; break; case 'modify': $formType = 'Modify Subscriber Details'; break; } if($SubAction == "") { $FO = "Complete the form below to create a new $formType form. Click on the \"Continue to Step 3\" button to continue." . $FO; $OUTPUT.=MakeBox("Create Form (Step 2 of 3)", $FO); } else { $FO = "Complete the form below to update the selected form. Click on the \"Continue to Step 2\" button to continue." . $FO; $OUTPUT.=MakeBox("Edit Form (Step 1 of 2)", $FO); } $OUTPUT .= ' '; $DontDo=1; } } if($Action=='ResponseOptions'){ $form=mysql_fetch_assoc(mysql_query("SELECT * FROM " . $TABLEPREFIX . "forms WHERE FormID='".addslashes($FormID)."'")); $form = stripslashes_array($form); if($SubSave){ mysql_query("DELETE FROM " . $TABLEPREFIX . "form_responses WHERE FormID='".addslashes($FormID)."'"); foreach($Responses as $Name => $Val ) { mysql_query("INSERT INTO " . $TABLEPREFIX . "form_responses SET ResponseName='".addslashes($Name)."', FormID='".addslashes($FormID)."', ResponseData='".addslashes($Val)."'"); } $query = "UPDATE " . $TABLEPREFIX . "forms SET SendName='" . addslashes($_POST['SendName']) . "', SendEmail='" . addslashes($_POST['SendEmail']) . "' WHERE FormID='" . addslashes($FormID) . "'"; mysql_query($query); $OUTPUT .= MakeSuccessBox("Form Saved Successfully", "Your form has been saved successfully.", MakeAdminLink("forms")); }else{ $extraChecks = ""; // lets set all the defaults. These are the only things that are different. switch($form['FormType']) { case 'sub': $confirm_subject = "Confirm Subscribe Request"; $confirm_email = "Hi,\r\nPlease click on the link below to confirm your subscription of %EMAIL% to the following mailing lists:\r\n\r\n%LISTS%\r\n\r\n%CONFIRMLINK%"; $confirm_html = ' | |