Project

General

Profile

1
<?php
2
/*
3
*
4
*                       About WebsiteBaker
5
*
6
* Website Baker is a PHP-based Content Management System (CMS)
7
* designed with one goal in mind: to enable its users to produce websites
8
* with ease.
9
*
10
*                       LICENSE INFORMATION
11
*
12
* WebsiteBaker is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU General Public License
14
* as published by the Free Software Foundation; either version 2
15
* of the License, or (at your option) any later version.
16
*
17
* WebsiteBaker is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
* See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
*
26
*                   WebsiteBaker Extra Information
27
*
28
*
29
*/
30
/**
31
 *
32
 * @category        modules
33
 * @package         news
34
 * @author          Ryan Djurovich
35
 * @copyright       2004-2009, Ryan Djurovich
36
 * @copyright       2009-2010, Website Baker Org. e.V.
37
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/news/modify_post.php $
38
 * @author          Ryan Djurovich
39
 * @copyright       2004-2009, Ryan Djurovich
40
 *
41
 * @author          WebsiteBaker Project
42
 * @link			http://www.websitebaker2.org/
43
 * @copyright       2009-2010, Website Baker Org. e.V.
44
 * @link			http://start.websitebaker2.org/impressum-datenschutz.php
45
 * @license         http://www.gnu.org/licenses/gpl.html
46
 * @version         $Id: modify_post.php 1258 2010-01-21 02:26:08Z Luisehahne $
47
 * @platform        WebsiteBaker 2.8.x
48
 * @requirements    PHP 4.3.4 and higher
49
 * @lastmodified    $Date: 2010-01-21 03:26:08 +0100 (Thu, 21 Jan 2010) $
50
 *
51
 */
52

    
53
require('../../config.php');
54

    
55
// Get id
56
if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id'])) {
57
	header("Location: ".ADMIN_URL."/pages/index.php");
58
	exit(0);
59
} else {
60
	$post_id = $_GET['post_id'];
61
}
62

    
63
// Include WB admin wrapper script
64
require(WB_PATH.'/modules/admin.php');
65

    
66
// Get header and footer
67
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
68
$fetch_content = $query_content->fetchRow();
69

    
70
if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
71
	function show_wysiwyg_editor($name,$id,$content,$width,$height) {
72
		echo '<textarea name="'.$name.'" id="'.$id.'" rows="10" cols="1" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
73
	}
74
} else {
75
	$id_list=array("short","long");
76
	require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
77
}
78

    
79
// include jscalendar-setup
80
$jscal_use_time = true; // whether to use a clock, too
81
require_once(WB_PATH."/include/jscalendar/wb-setup.php");
82
?>
83
<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['POST']; ?></h2>
84
<div class="jsadmin jcalendar hide"></div> 
85
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.php" method="post" style="margin: 0;">
86

    
87
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
88
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
89
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
90
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>" />
91

    
92
<table class="row_a" cellpadding="2" cellspacing="0" width="100%">
93
<tr>
94
	<td><?php echo $TEXT['TITLE']; ?>:</td>
95
	<td width="80%">
96
		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
97
	</td>
98
</tr>
99
<tr>
100
	<td><?php echo $TEXT['GROUP']; ?>:</td>
101
	<td>
102
		<select name="group" style="width: 100%;">
103
			<option value="0"><?php echo $TEXT['NONE']; ?></option>
104
			<?php
105
			$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
106
			if($query->numRows() > 0) {
107
				// Loop through groups
108
				while($group = $query->fetchRow()) {
109
					?>
110
					<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected="selected"'; } ?>><?php echo $group['title']; ?></option>
111
					<?php
112
				}
113
			}
114
			?>
115
		</select>
116
	</td>
117
</tr>
118
<tr>
119
	<td><?php echo $TEXT['COMMENTING']; ?>:</td>
120
	<td>
121
		<select name="commenting" style="width: 100%;">
122
			<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
123
			<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
124
			<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
125
		</select>
126
	</td>
127
</tr>
128
<tr>
129
	<td><?php echo $TEXT['ACTIVE']; ?>:</td>
130
	<td>
131
		<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked="checked"'; } ?> />
132
		<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
133
		<?php echo $TEXT['YES']; ?>
134
		</a>
135
		&nbsp;
136
		<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked="checked"'; } ?> />
137
		<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
138
		<?php echo $TEXT['NO']; ?>
139
		</a>
140
	</td>
141
</tr>
142
<tr>
143
	<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td>
144
	<td>
145
	<input type="text" id="publishdate" name="publishdate" value="<?php if($fetch_content['published_when']==0) print date($jscal_format, strtotime((date('Y-m-d H:i')))); else print date($jscal_format, $fetch_content['published_when']);?>" style="width: 120px;" />
146
	<img src="<?php echo THEME_URL ?>/images/clock_16.png" id="publishdate_trigger" style="cursor: pointer;" title="<?php echo $TEXT['CALENDAR']; ?>" alt="<?php echo $TEXT['CALENDAR']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
147
	<img src="<?php echo THEME_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="<?php echo $TEXT['DELETE_DATE']; ?>" alt="<?php echo $TEXT['DELETE_DATE']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.publishdate.value=''" />
148
	</td>
149
</tr>
150
<tr>
151
	<td><?php echo $TEXT['PUBL_END_DATE']; ?>:</td>
152
	<td>
153
	<input type="text" id="enddate" name="enddate" value="<?php if($fetch_content['published_until']==0) print ""; else print date($jscal_format, $fetch_content['published_until'])?>" style="width: 120px;" />
154
	<img src="<?php echo THEME_URL ?>/images/clock_16.png" id="enddate_trigger" style="cursor: pointer;" title="<?php echo $TEXT['CALENDAR']; ?>" alt="<?php echo $TEXT['CALENDAR']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
155
	<img src="<?php echo THEME_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="<?php echo $TEXT['DELETE_DATE']; ?>" alt="<?php echo $TEXT['DELETE_DATE']; ?>" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.enddate.value=''" />
156
	</td>
157
</tr>
158
</table>
159

    
160
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
161
<tr>
162
	<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td>
163
</tr>
164
<tr>
165
	<td>
166
	<?php
167
	show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","200px");
168
	?>
169
	</td>
170
</tr>
171
<tr>
172
	<td valign="top"><?php echo $TEXT['LONG']; ?>:</td>
173
</tr>
174
<tr>
175
	<td>
176
	<?php
177
	show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","650px");
178
	?>
179
	</td>
180
</tr>
181
</table>
182

    
183
<table cellpadding="2" cellspacing="0" border="0" width="100%">
184
<tr>
185
	<td align="left">
186
		<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
187
	</td>
188
	<td align="right">
189
		<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;" />
190
	</td>
191
</tr>
192
</table>
193
</form>
194

    
195
<script type="text/javascript">
196
	Calendar.setup(
197
		{
198
			inputField  : "publishdate",
199
			ifFormat    : "<?php echo $jscal_ifformat ?>",
200
			button      : "publishdate_trigger",
201
			firstDay    : <?php echo $jscal_firstday ?>,
202
			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE)
203
            { ?>
204
				showsTime   : "true",
205
				timeFormat  : "24",
206
			<?php
207
            } ?>
208
			date        : "<?php echo $jscal_today ?>",
209
			range       : [1970, 2037],
210
			step        : 1
211
		}
212
	);
213
	Calendar.setup(
214
		{
215
			inputField  : "enddate",
216
			ifFormat    : "<?php echo $jscal_ifformat ?>",
217
			button      : "enddate_trigger",
218
			firstDay    : <?php echo $jscal_firstday ?>,
219
			<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE)
220
            { ?>
221
				showsTime   : "true",
222
				timeFormat  : "24",
223
			<?php
224
            } ?>
225
			date        : "<?php echo $jscal_today ?>",
226
			range       : [1970, 2037],
227
			step        : 1
228
		}
229
	);
230
</script>
231

    
232
<br />
233

    
234
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['COMMENT']; ?></h2>
235

    
236
<?php
237

    
238
// Loop through existing posts
239
$query_comments = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_comments` WHERE section_id = '$section_id' AND post_id = '$post_id' ORDER BY commented_when DESC");
240
if($query_comments->numRows() > 0) {
241
	$row = 'a';
242
	?>
243
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
244
	<?php
245
	while($comment = $query_comments->fetchRow()) {
246
		?>
247
		<tr class="row_<?php echo $row; ?>" >
248
			<td width="20" style="padding-left: 5px;">
249
				<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;comment_id=<?php echo $comment['comment_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
250
					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="^" />
251
				</a>
252
			</td>	
253
			<td>
254
				<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;comment_id=<?php echo $comment['comment_id']; ?>">
255
					<?php echo $comment['title']; ?>
256
				</a>
257
			</td>
258
			<td width="20">
259
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_comment.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $post_id; ?>&amp;comment_id=<?php echo $comment['comment_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
260
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
261
				</a>
262
			</td>
263
		</tr>
264
		<?php
265
		// Alternate row color
266
		if($row == 'a') {
267
			$row = 'b';
268
		} else {
269
			$row = 'a';
270
		}
271
	}
272
	?>
273
	</table>
274
	<?php
275
} else {
276
	echo $TEXT['NONE_FOUND'];
277
}
278

    
279

    
280
// Print admin footer
281
$admin->print_footer();
282

    
283
?>
(18-18/31)