Project

General

Profile

1
<?php
2

    
3
// $Id: modify_settings.php 1108 2009-08-06 16:47:16Z Ruebenwurzel $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
require('../../config.php');
27

    
28
// Include WB admin wrapper script
29
require(WB_PATH.'/modules/admin.php');
30

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

    
34
// check if module language file exists for the language set by the user (e.g. DE, EN)
35
if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) {
36
	// no module language file exists for the language set by the user, include default module language file EN.php
37
	require_once(WB_PATH .'/modules/news/languages/EN.php');
38
} else {
39
	// a module language file exists for the language defined by the user, load it
40
	require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php');
41
}
42

    
43
// Get header and footer
44
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
45
$fetch_content = $query_content->fetchRow();
46

    
47
// Set raw html <'s and >'s to be replace by friendly html code
48
$raw = array('<', '>');
49
$friendly = array('&lt;', '&gt;');
50

    
51
// check if backend.css file needs to be included into the <body></body> of modify.php
52
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/form/backend.css")) {
53
	echo '<style type="text/css">';
54
	include(WB_PATH .'/modules/form/backend.css');
55
	echo "\n</style>\n";
56
}
57

    
58
?>
59
<h2><?php echo $MOD_NEWS['SETTINGS']; ?></h2>
60
<?php
61
// include the button to edit the optional module CSS files (function added with WB 2.7)
62
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
63
// Place this call outside of any <form></form> construct!!!
64
if(function_exists('edit_module_css')) {
65
	edit_module_css('news');
66
}
67
?>
68

    
69
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_settings.php" method="post" style="margin: 0;">
70

    
71
	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
72
	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
73

    
74
	<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
75
		<tr>
76
			<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td>
77
		<tr>
78
			<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
79
			<td class="setting_value">
80
				<textarea name="header" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo ($fetch_content['header']); ?></textarea>
81
			</td>
82
		</tr>
83
		<tr>
84
			<td class="setting_name"><?php echo $TEXT['POST'].' '.$TEXT['LOOP']; ?>:</td>
85
			<td class="setting_value">
86
				<textarea name="post_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo ($fetch_content['post_loop']); ?></textarea>
87
			</td>
88
		</tr>
89
		<tr>
90
			<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
91
			<td class="setting_value">
92
				<textarea name="footer" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['footer'])); ?></textarea>
93
			</td>
94
		</tr>
95
		<tr>
96
			<td class="setting_name"><?php echo $TEXT['POST_HEADER']; ?>:</td>
97
			<td class="setting_value">
98
				<textarea name="post_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_header'])); ?></textarea>
99
			</td>
100
		</tr>
101
		<tr>
102
			<td class="setting_name"><?php echo $TEXT['POST_FOOTER']; ?>:</td>
103
			<td class="setting_value">
104
				<textarea name="post_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_footer'])); ?></textarea>
105
			</td>
106
		</tr>
107
		<tr>
108
			<td class="setting_name"><?php echo $TEXT['POSTS_PER_PAGE']; ?>:</td>
109
			<td class="setting_value">
110
				<select name="posts_per_page" style="width: 98%;">
111
					<option value=""><?php echo $TEXT['UNLIMITED']; ?></option>
112
					<?php
113
					for($i = 1; $i <= 20; $i++) {
114
						if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected'; } else { $selected = ''; }
115
						echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>';
116
					}
117
					?>
118
				</select>
119
			</td>
120
		</tr>
121
	</table>
122
	<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
123
		<tr>
124
			<td colspan="2"><strong><?php echo $TEXT['COMMENTS']; ?></strong></td>
125
		</tr>
126
		<tr>
127
			<td class="setting_name"><?php echo $TEXT['COMMENTING']; ?>:</td>
128
			<td class="setting_value">
129
				<select name="commenting" style="width: 98%;">
130
					<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
131
					<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
132
					<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
133
				</select>
134
			</td>
135
		</tr>
136
		<tr>
137
			<td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
138
			<td>
139
				<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($fetch_content['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
140
				<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
141
				<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($fetch_content['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
142
				<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
143
			</td>
144
		</tr>
145
		<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
146
		<tr>
147
			<td class="setting_name"><?php echo $TEXT['RESIZE_IMAGE_TO']; ?>:</td>
148
			<td class="setting_value">
149
				<select name="resize" style="width: 98%;">
150
					<option value=""><?php echo $TEXT['NONE']; ?></option>
151
					<?php
152
					$SIZES['50'] = '50x50px';
153
					$SIZES['75'] = '75x75px';
154
					$SIZES['100'] = '100x100px';
155
					$SIZES['125'] = '125x125px';
156
					$SIZES['150'] = '150x150px';
157
					foreach($SIZES AS $size => $size_name) {
158
						if($fetch_content['resize'] == $size) { $selected = ' selected'; } else { $selected = ''; }
159
						echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>';
160
					}
161
					?>
162
				</select>
163
			</td>
164
		</tr>
165
		<?php } ?>
166
		<tr>
167
			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td>
168
			<td class="setting_value">
169
				<textarea name="comments_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea>
170
			</td>
171
		</tr>
172
		<tr>
173
			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td>
174
			<td class="setting_value">
175
				<textarea name="comments_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea>
176
			</td>
177
		</tr>
178
		<tr>
179
			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td>
180
			<td class="setting_value">
181
				<textarea name="comments_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea>
182
			</td>
183
		</tr>
184
		<tr>
185
			<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td>
186
			<td class="setting_value">
187
				<textarea name="comments_page" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea>
188
			</td>
189
		</tr>
190
	</table>
191
	<table cellpadding="0" cellspacing="0" border="0" width="100%">
192
		<tr>
193
			<td align="left">
194
				<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
195
			</td>
196
			<td align="right">
197
				<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;" />
198
			</td>
199
		</tr>
200
	</table>
201
</form>
202

    
203
<?php
204

    
205
// Print admin footer
206
$admin->print_footer();
207

    
208
?>
(19-19/30)