Project

General

Profile

1
<?php
2

    
3
// $Id: modify_settings.php 1157 2009-10-09 21:54:57Z Luisehahne $
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
{
66
	edit_module_css('news');
67
}
68
?>
69

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

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

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

    
205
<?php
206

    
207
// Print admin footer
208
$admin->print_footer();
209

    
210
?>
(19-19/31)