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