Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        module
5
 * @package         Form
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: modify_settings.php 1538 2011-12-10 15:06:15Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/form/modify_settings.php $
14
 * @lastmodified    $Date: 2011-12-10 16:06:15 +0100 (Sat, 10 Dec 2011) $
15
 * @description     
16
 */
17

    
18
require('../../config.php');
19

    
20
$print_info_banner = true;
21
// Tells script to update when this page was last updated
22
$update_when_modified = false;
23
// Include WB admin wrapper script
24
require(WB_PATH.'/modules/admin.php');
25

    
26
// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
27
@include_once(WB_PATH .'/framework/module.functions.php');
28

    
29
// load module language file
30
$lang = (dirname(__FILE__)) . '/languages/' . LANGUAGE . '.php';
31
require_once(!file_exists($lang) ? (dirname(__FILE__)) . '/languages/EN.php' : $lang );
32

    
33
// Get header and footer
34
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
35
$setting = $query_content->fetchRow();
36

    
37
// Set raw html <'s and >'s to be replace by friendly html code
38
$raw = array('<', '>');
39
$friendly = array('&lt;', '&gt;');
40
/*
41
// check if backend.css file needs to be included into the <body></body> of modify.php
42
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/form/backend.css")) {
43
	echo '<style type="text/css">';
44
	include(WB_PATH .'/modules/form/backend.css');
45
	echo "\n</style>\n";
46
}
47
*/
48
?>
49
<h2><?php echo $MOD_FORM['SETTINGS']; ?></h2>
50
<?php
51
// include the button to edit the optional module CSS files
52
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
53
// Place this call outside of any <form></form> construct!!!
54
if(function_exists('edit_module_css')) {
55
	edit_module_css('form');
56
}
57
?>
58

    
59
<form name="edit" action="<?php echo WB_URL; ?>/modules/form/save_settings.php" method="post" style="margin: 0;">
60

    
61
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
62
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
63
<?php echo $admin->getFTAN(); ?>
64

    
65
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
66
	<tr>
67
		<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td>
68
	</tr>
69
	<tr>
70
		<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
71
		<td>
72
			<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($setting['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
73
			<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
74
			<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($setting['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
75
			<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
76
		</td>
77
	</tr>
78
	<tr>
79
		<td class="setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
80
		<td class="setting_value">
81
			<input type="text" name="max_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['max_submissions'])); ?>" />
82
		</td>
83
	</tr>
84
	<tr>
85
		<td class="setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
86
		<td class="setting_value">
87
			<input type="text" name="stored_submissions" style="width: 30px;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['stored_submissions'])); ?>" />
88
		</td>
89
	</tr>
90
	<tr>
91
		<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
92
		<td class="setting_value">
93
			<textarea name="header" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['header']); ?></textarea>
94
		</td>
95
	</tr>
96
	<tr>
97
		<td class="setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
98
		<td class="setting_value">
99
			<textarea name="field_loop" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo ($setting['field_loop']); ?></textarea>
100
		</td>
101
	</tr>
102
	<tr>
103
		<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
104
		<td class="setting_value">
105
			<textarea name="footer" cols="80" rows="6" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['footer'])); ?></textarea>
106
		</td>
107
	</tr>
108
</table>	
109

    
110
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
111
	<tr>
112
		<td colspan="2"><strong><?php echo $TEXT['EMAIL'].' '.$TEXT['SETTINGS']; ?></strong></td>
113
	</tr>
114
	<tr>
115
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
116
		<td class="setting_value">
117
			<input type="text" name="email_to" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_to'])); ?>" />
118
		</td>
119
	</tr>
120
	<tr>
121
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
122
		<td class="setting_value">
123
			<select name="email_from_field" style="width: 98%;">
124
			<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option>
125
			<?php
126
			$email_from_value = str_replace($raw, $friendly, ($setting['email_from']));
127
			$query_email_fields = $database->query("SELECT field_id,title FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' AND ( type = 'textfield' OR  type = 'email' ) ORDER BY position ASC");
128
			if($query_email_fields->numRows() > 0) {
129
				while($field = $query_email_fields->fetchRow()) {
130
					?>
131
					<option value="field<?php echo $field['field_id']; ?>"<?php if($email_from_value == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
132
						<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
133
					</option>
134
					<?php
135
				}
136
			}
137
			?>
138
			</select>
139
			<input type="text" name="email_from" id="email_from" style="width: 98%; display: <?php if(isset($selected) AND $selected == true) { echo 'none'; } else { echo 'block'; } ?>;" maxlength="255" value="<?php if(substr($email_from_value, 0, 5) != 'field') { echo $email_from_value; } ?>" />
140
		</td>
141
	</tr>
142
	<tr>
143
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
144
		<td class="setting_value">
145
			<input type="text" name="email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_fromname'])); ?>" />
146
		</td>
147
	</tr>
148
	<tr>
149
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
150
		<td class="setting_value">
151
			<input type="text" name="email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['email_subject'])); ?>" />
152
		</td>
153
	</tr>
154
</table>	
155

    
156
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
157
	<tr>
158
		<td colspan="2"><strong><?php echo $TEXT['SUCCESS'].' '.$TEXT['SETTINGS']; ?></strong></td>
159
	</tr>
160
	<tr>
161
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
162
		<td class="setting_value">
163
			<select name="success_email_to" style="width: 98%;">
164
			<option value="" onclick="javascript: document.getElementById('success_email_to').style.display = 'block';"><?php echo $TEXT['NONE']; ?></option>
165
			<?php
166
			$success_email_to = str_replace($raw, $friendly, ($setting['success_email_to']));
167
			$query_email_fields = $database->query("SELECT field_id,title FROM ".TABLE_PREFIX."mod_form_fields WHERE section_id = '$section_id' AND ( type = 'textfield' OR  type = 'email' ) ORDER BY position ASC");
168
			if($query_email_fields->numRows() > 0) {
169
				while($field = $query_email_fields->fetchRow()) {
170
					?>
171
					<option value="field<?php echo $field['field_id']; ?>"<?php if($success_email_to == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
172
						<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
173
					</option>
174
					<?php
175
				}
176
			}
177
			?>
178
			</select>
179
		</td>
180
	</tr>
181
	<tr>
182
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
183
		<td class="setting_value">
184
			<input type="text" name="success_email_from" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_from'])); ?>" />
185
		</td>
186
	</tr>
187
	<tr>
188
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['NAME']; ?>:</td>
189
		<td class="setting_value">
190
			<input type="text" name="success_email_fromname" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_fromname'])); ?>" />
191
		</td>
192
	</tr>
193
	<tr>
194
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
195
		<td class="setting_value">
196
			<input type="text" name="success_email_subject" style="width: 98%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, ($setting['success_email_subject'])); ?>" />
197
		</td>
198
	</tr>
199
	<tr>
200
		<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TEXT']; ?>:</td>
201
		<td class="setting_value">
202
			<textarea name="success_email_text" cols="80" rows="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($setting['success_email_text'])); ?></textarea>
203
		</td>
204
	</tr>
205
	<tr>
206
		<td class="newsection"><?php echo $TEXT['SUCCESS'].' '.$TEXT['PAGE']; ?>:</td>
207
		<td class="newsection">
208
			<select name="success_page">
209
			<option value="none"><?php echo $TEXT['NONE']; ?></option>
210
			<?php 
211
			// Get exisiting pages and show the pagenames
212
			$query = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE visibility <> 'deleted'");
213
			while($mail_page = $query->fetchRow()) {
214
				if(!$admin->page_is_visible($mail_page))
215
					continue;
216
				$mail_pagename = $mail_page['menu_title'];		
217
				$success_page = $mail_page['page_id'];
218
			  //	echo $success_page.':'.$setting['success_page'].':'; not vailde
219
				if($setting['success_page'] == $success_page) {
220
					$selected = ' selected="selected"';
221
				} else { 
222
					$selected = '';
223
				}
224
				echo '<option value="'.$success_page.'"'.$selected.'>'.$mail_pagename.'</option>';
225
		 	}
226
			?>
227
			</select>
228
		</td>
229
	</tr>
230
</table>
231

    
232
<table cellpadding="0" cellspacing="0" border="0" width="100%">
233
	<tr>
234
		<td align="left">
235
			<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;">
236
		</td>
237
		<td align="right">
238
			<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
239
		</td>
240
	</tr>
241
</table>
242
</form>
243
<?php
244

    
245
// Print admin footer
246
$admin->print_footer();
(13-13/22)