1 |
1064
|
Ruebenwurz
|
<?php
|
2 |
|
|
|
3 |
|
|
// $Id$
|
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 |
|
|
// 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 |
1068
|
Ruebenwurz
|
<div class="jsadmin jcalendar hide"></div>
|
58 |
1064
|
Ruebenwurz
|
<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="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="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 H:i')))); else print date($jscal_format, $fetch_content['published_when']);?>" style="width: 120px;" />
|
119 |
|
|
<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=''" />
|
120 |
|
|
<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=''" />
|
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 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=''" />
|
128 |
|
|
<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=''" />
|
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;" />
|
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 |
|
|
</form>
|
167 |
|
|
|
168 |
|
|
<script type="text/javascript">
|
169 |
|
|
Calendar.setup(
|
170 |
|
|
{
|
171 |
|
|
inputField : "publishdate",
|
172 |
|
|
ifFormat : "<?php echo $jscal_ifformat ?>",
|
173 |
|
|
button : "publishdate_trigger",
|
174 |
|
|
firstDay : <?php echo $jscal_firstday ?>,
|
175 |
|
|
<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
|
176 |
|
|
showsTime : "true",
|
177 |
|
|
timeFormat : "24",
|
178 |
|
|
<?php } ?>
|
179 |
|
|
date : "<?php echo $jscal_today ?>",
|
180 |
|
|
range : [1970, 2037],
|
181 |
|
|
step : 1
|
182 |
|
|
}
|
183 |
|
|
);
|
184 |
|
|
Calendar.setup(
|
185 |
|
|
{
|
186 |
|
|
inputField : "enddate",
|
187 |
|
|
ifFormat : "<?php echo $jscal_ifformat ?>",
|
188 |
|
|
button : "enddate_trigger",
|
189 |
|
|
firstDay : <?php echo $jscal_firstday ?>,
|
190 |
|
|
<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?>
|
191 |
|
|
showsTime : "true",
|
192 |
|
|
timeFormat : "24",
|
193 |
|
|
<?php } ?>
|
194 |
|
|
date : "<?php echo $jscal_today ?>",
|
195 |
|
|
range : [1970, 2037],
|
196 |
|
|
step : 1
|
197 |
|
|
}
|
198 |
|
|
);
|
199 |
|
|
</script>
|
200 |
|
|
|
201 |
|
|
<br />
|
202 |
|
|
|
203 |
|
|
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['COMMENT']; ?></h2>
|
204 |
|
|
|
205 |
|
|
<?php
|
206 |
|
|
|
207 |
|
|
// Loop through existing posts
|
208 |
|
|
$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");
|
209 |
|
|
if($query_comments->numRows() > 0) {
|
210 |
|
|
$row = 'a';
|
211 |
|
|
?>
|
212 |
|
|
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
213 |
|
|
<?php
|
214 |
|
|
while($comment = $query_comments->fetchRow()) {
|
215 |
|
|
?>
|
216 |
|
|
<tr class="row_<?php echo $row; ?>" >
|
217 |
|
|
<td width="20" style="padding-left: 5px;">
|
218 |
|
|
<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']; ?>">
|
219 |
|
|
<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="^" />
|
220 |
|
|
</a>
|
221 |
|
|
</td>
|
222 |
|
|
<td>
|
223 |
|
|
<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']; ?>">
|
224 |
|
|
<?php echo $comment['title']; ?>
|
225 |
|
|
</a>
|
226 |
|
|
</td>
|
227 |
|
|
<td width="20">
|
228 |
|
|
<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']; ?>">
|
229 |
|
|
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
230 |
|
|
</a>
|
231 |
|
|
</td>
|
232 |
|
|
</tr>
|
233 |
|
|
<?php
|
234 |
|
|
// Alternate row color
|
235 |
|
|
if($row == 'a') {
|
236 |
|
|
$row = 'b';
|
237 |
|
|
} else {
|
238 |
|
|
$row = 'a';
|
239 |
|
|
}
|
240 |
|
|
}
|
241 |
|
|
?>
|
242 |
|
|
</table>
|
243 |
|
|
<?php
|
244 |
|
|
} else {
|
245 |
|
|
echo $TEXT['NONE_FOUND'];
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
?>
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
<?php
|
253 |
|
|
|
254 |
|
|
// Print admin footer
|
255 |
|
|
$admin->print_footer();
|
256 |
|
|
|
257 |
562
|
Ruebenwurz
|
?>
|