1
|
<?php
|
2
|
|
3
|
// $Id: modify_post.php 643 2008-01-29 22:34:29Z thorn $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2008, 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
|
// Get id
|
29
|
if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id'])) {
|
30
|
header("Location: ".ADMIN_URL."/pages/index.php");
|
31
|
exit(0);
|
32
|
} else {
|
33
|
$post_id = $_GET['post_id'];
|
34
|
}
|
35
|
|
36
|
// Include WB admin wrapper script
|
37
|
require(WB_PATH.'/modules/admin.php');
|
38
|
|
39
|
// Get header and footer
|
40
|
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
|
41
|
$fetch_content = $query_content->fetchRow();
|
42
|
|
43
|
if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
|
44
|
function show_wysiwyg_editor($name,$id,$content,$width,$height) {
|
45
|
echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
|
46
|
}
|
47
|
} else {
|
48
|
$id_list=array("short","long");
|
49
|
require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
|
50
|
}
|
51
|
|
52
|
// include jscalendar-setup
|
53
|
$jscal_use_time = true; // whether to use a clock, too
|
54
|
require_once(WB_PATH."/include/jscalendar/wb-setup.php");
|
55
|
?>
|
56
|
<h2><?php echo $TEXT['ADD'].'/'.$TEXT['MODIFY'].' '.$TEXT['POST']; ?></h2>
|
57
|
|
58
|
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.php" method="post" style="margin: 0;">
|
59
|
|
60
|
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
|
61
|
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
|
62
|
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>">
|
63
|
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>">
|
64
|
|
65
|
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
|
66
|
<tr>
|
67
|
<td><?php echo $TEXT['TITLE']; ?>:</td>
|
68
|
<td width="80%">
|
69
|
<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 98%;" maxlength="255" />
|
70
|
</td>
|
71
|
</tr>
|
72
|
<tr>
|
73
|
<td><?php echo $TEXT['GROUP']; ?>:</td>
|
74
|
<td>
|
75
|
<select name="group" style="width: 100%;">
|
76
|
<option value="0"><?php echo $TEXT['NONE']; ?></option>
|
77
|
<?php
|
78
|
$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
|
79
|
if($query->numRows() > 0) {
|
80
|
// Loop through groups
|
81
|
while($group = $query->fetchRow()) {
|
82
|
?>
|
83
|
<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected'; } ?>><?php echo $group['title']; ?></option>
|
84
|
<?php
|
85
|
}
|
86
|
}
|
87
|
?>
|
88
|
</select>
|
89
|
</td>
|
90
|
</tr>
|
91
|
<tr>
|
92
|
<td><?php echo $TEXT['COMMENTING']; ?>:</td>
|
93
|
<td>
|
94
|
<select name="commenting" style="width: 100%;">
|
95
|
<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
|
96
|
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
|
97
|
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
|
98
|
</select>
|
99
|
</td>
|
100
|
</tr>
|
101
|
<tr>
|
102
|
<td><?php echo $TEXT['ACTIVE']; ?>:</td>
|
103
|
<td>
|
104
|
<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked'; } ?> />
|
105
|
<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
|
106
|
<?php echo $TEXT['YES']; ?>
|
107
|
</a>
|
108
|
|
109
|
<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked'; } ?> />
|
110
|
<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
|
111
|
<?php echo $TEXT['NO']; ?>
|
112
|
</a>
|
113
|
</td>
|
114
|
</tr>
|
115
|
<tr>
|
116
|
<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td>
|
117
|
<td>
|
118
|
<input type="text" id="publishdate" name="publishdate" value="<?php if($fetch_content['published_when']==0) print date($jscal_format, strtotime((date('Y-m-d')))); else print date($jscal_format, $fetch_content['published_when']);?>" style="width: 120px;" />
|
119
|
<img src="<?php echo ADMIN_URL ?>/images/clock_16.png" id="publishdate_trigger" style="cursor: pointer;" title="Calendar" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
|
120
|
<img src="<?php echo ADMIN_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="delete date" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.publishdate.value=''" />
|
121
|
</td>
|
122
|
</tr>
|
123
|
<tr>
|
124
|
<td><?php echo $TEXT['PUBL_END_DATE']; ?>:</td>
|
125
|
<td>
|
126
|
<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;" />
|
127
|
<img src="<?php echo ADMIN_URL ?>/images/clock_16.png" id="enddate_trigger" style="cursor: pointer;" title="Calendar" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" />
|
128
|
<img src="<?php echo ADMIN_URL ?>/images/clock_del_16.png" style="cursor: pointer;" title="delete date" onmouseover="this.style.background='lightgrey';" onmouseout="this.style.background=''" onclick="document.modify.enddate.value=''" />
|
129
|
</td>
|
130
|
</tr>
|
131
|
</table>
|
132
|
|
133
|
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
|
134
|
<tr>
|
135
|
<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td>
|
136
|
</tr>
|
137
|
<tr>
|
138
|
<td>
|
139
|
<?php
|
140
|
show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","135px");
|
141
|
?>
|
142
|
</td>
|
143
|
</tr>
|
144
|
<tr>
|
145
|
<td valign="top"><?php echo $TEXT['LONG']; ?>:</td>
|
146
|
</tr>
|
147
|
<tr>
|
148
|
<td>
|
149
|
<?php
|
150
|
show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","300px");
|
151
|
?>
|
152
|
</td>
|
153
|
</tr>
|
154
|
</table>
|
155
|
|
156
|
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
157
|
<tr>
|
158
|
<td align="left">
|
159
|
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>
|
160
|
</td>
|
161
|
<td align="right">
|
162
|
<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;" />
|
163
|
</td>
|
164
|
</tr>
|
165
|
</table>
|
166
|
|
167
|
<script type="text/javascript">
|
168
|
Calendar.setup(
|
169
|
{
|
170
|
inputField : "publishdate",
|
171
|
ifFormat : "<?php echo $jscal_ifformat ?>",
|
172
|
button : "publishdate_trigger",
|
173
|
firstDay : <?php echo $jscal_firstday ?>,
|
174
|
<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
|
175
|
showsTime : "true",
|
176
|
timeFormat : "24",
|
177
|
<?php } ?>
|
178
|
date : "<?php echo $jscal_today ?>",
|
179
|
range : [1970, 2037],
|
180
|
step : 1
|
181
|
}
|
182
|
);
|
183
|
Calendar.setup(
|
184
|
{
|
185
|
inputField : "enddate",
|
186
|
ifFormat : "<?php echo $jscal_ifformat ?>",
|
187
|
button : "enddate_trigger",
|
188
|
firstDay : <?php echo $jscal_firstday ?>,
|
189
|
<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
|
190
|
showsTime : "true",
|
191
|
timeFormat : "24",
|
192
|
<?php } ?>
|
193
|
date : "<?php echo $jscal_today ?>",
|
194
|
range : [1970, 2037],
|
195
|
step : 1
|
196
|
}
|
197
|
);
|
198
|
</script>
|
199
|
|
200
|
<br />
|
201
|
|
202
|
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['COMMENT']; ?></h2>
|
203
|
|
204
|
<?php
|
205
|
|
206
|
// Loop through existing posts
|
207
|
$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");
|
208
|
if($query_comments->numRows() > 0) {
|
209
|
$row = 'a';
|
210
|
?>
|
211
|
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
212
|
<?php
|
213
|
while($comment = $query_comments->fetchRow()) {
|
214
|
?>
|
215
|
<tr class="row_<?php echo $row; ?>" height="20">
|
216
|
<td width="20" style="padding-left: 5px;">
|
217
|
<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
|
218
|
<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="^" />
|
219
|
</a>
|
220
|
</td>
|
221
|
<td>
|
222
|
<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>">
|
223
|
<?php echo $comment['title']; ?>
|
224
|
</a>
|
225
|
</td>
|
226
|
<td width="20">
|
227
|
<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; ?>§ion_id=<?php echo $section_id; ?>&post_id=<?php echo $post_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
228
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
229
|
</a>
|
230
|
</td>
|
231
|
</tr>
|
232
|
<?php
|
233
|
// Alternate row color
|
234
|
if($row == 'a') {
|
235
|
$row = 'b';
|
236
|
} else {
|
237
|
$row = 'a';
|
238
|
}
|
239
|
}
|
240
|
?>
|
241
|
</table>
|
242
|
<?php
|
243
|
} else {
|
244
|
echo $TEXT['NONE_FOUND'];
|
245
|
}
|
246
|
|
247
|
?>
|
248
|
|
249
|
|
250
|
|
251
|
<?php
|
252
|
|
253
|
// Print admin footer
|
254
|
$admin->print_footer();
|
255
|
|
256
|
?>
|