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          WebsiteBaker Project
35
 * @copyright       2004-2009, Ryan Djurovich
36
 * @copyright       2009-2010, Website Baker Org. e.V.
37
 * @link			http://www.websitebaker2.org/
38
 * @license         http://www.gnu.org/licenses/gpl.html
39
 * @platform        WebsiteBaker 2.8.x
40
 * @requirements    PHP 4.3.4 and higher
41
 * @version         $Id: modify_post.php 1268 2010-01-22 17:21:02Z Luisehahne $
42
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/news/modify_post.php $
43
 * @lastmodified    $Date: 2010-01-22 18:21:02 +0100 (Fri, 22 Jan 2010) $
44
 *
45
 */
46

    
47
require('../../config.php');
48

    
49
// Get id
50
if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id'])) {
51
	header("Location: ".ADMIN_URL."/pages/index.php");
52
	exit(0);
53
} else {
54
	$post_id = $_GET['post_id'];
55
}
56

    
57
// Include WB admin wrapper script
58
require(WB_PATH.'/modules/admin.php');
59

    
60
// Get header and footer
61
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
62
$fetch_content = $query_content->fetchRow();
63

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

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

    
81
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
82
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
83
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
84
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>" />
85

    
86
<table class="row_a" cellpadding="2" cellspacing="0" width="100%">
87
<tr>
88
	<td><?php echo $TEXT['TITLE']; ?>:</td>
89
	<td width="80%">
90
		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
91
	</td>
92
</tr>
93
<tr>
94
	<td><?php echo $TEXT['GROUP']; ?>:</td>
95
	<td>
96
		<select name="group" style="width: 100%;">
97
			<option value="0"><?php echo $TEXT['NONE']; ?></option>
98
			<?php
99
			$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
100
			if($query->numRows() > 0) {
101
				// Loop through groups
102
				while($group = $query->fetchRow()) {
103
					?>
104
					<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected="selected"'; } ?>><?php echo $group['title']; ?></option>
105
					<?php
106
				}
107
			}
108
			?>
109
		</select>
110
	</td>
111
</tr>
112
<tr>
113
	<td><?php echo $TEXT['COMMENTING']; ?>:</td>
114
	<td>
115
		<select name="commenting" style="width: 100%;">
116
			<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
117
			<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
118
			<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
119
		</select>
120
	</td>
121
</tr>
122
<tr>
123
	<td><?php echo $TEXT['ACTIVE']; ?>:</td>
124
	<td>
125
		<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked="checked"'; } ?> />
126
		<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
127
		<?php echo $TEXT['YES']; ?>
128
		</a>
129
		&nbsp;
130
		<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked="checked"'; } ?> />
131
		<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
132
		<?php echo $TEXT['NO']; ?>
133
		</a>
134
	</td>
135
</tr>
136
<tr>
137
	<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td>
138
	<td>
139
	<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;" />
140
	<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=''" />
141
	<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=''" />
142
	</td>
143
</tr>
144
<tr>
145
	<td><?php echo $TEXT['PUBL_END_DATE']; ?>:</td>
146
	<td>
147
	<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;" />
148
	<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=''" />
149
	<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=''" />
150
	</td>
151
</tr>
152
</table>
153

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

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

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

    
226
<br />
227

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

    
230
<?php
231

    
232
// Loop through existing posts
233
$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");
234
if($query_comments->numRows() > 0) {
235
	$row = 'a';
236
	?>
237
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
238
	<?php
239
	while($comment = $query_comments->fetchRow()) {
240
		?>
241
		<tr class="row_<?php echo $row; ?>" >
242
			<td width="20" style="padding-left: 5px;">
243
				<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']; ?>">
244
					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="^" />
245
				</a>
246
			</td>	
247
			<td>
248
				<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']; ?>">
249
					<?php echo $comment['title']; ?>
250
				</a>
251
			</td>
252
			<td width="20">
253
				<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']; ?>">
254
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
255
				</a>
256
			</td>
257
		</tr>
258
		<?php
259
		// Alternate row color
260
		if($row == 'a') {
261
			$row = 'b';
262
		} else {
263
			$row = 'a';
264
		}
265
	}
266
	?>
267
	</table>
268
	<?php
269
} else {
270
	echo $TEXT['NONE_FOUND'];
271
}
272

    
273

    
274
// Print admin footer
275
$admin->print_footer();
276

    
277
?>
(18-18/31)