1 |
4
|
ryan
|
<?php
|
2 |
|
|
|
3 |
|
|
// $Id: modify_post.php,v 1.3 2005/06/21 09:11:44 rdjurovich Exp $
|
4 |
|
|
|
5 |
|
|
/*
|
6 |
|
|
|
7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
8 |
|
|
Copyright (C) 2004-2005, 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 |
|
|
} else {
|
32 |
|
|
$post_id = $_GET['post_id'];
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
// Include WB admin wrapper script
|
36 |
|
|
require(WB_PATH.'/modules/admin.php');
|
37 |
|
|
|
38 |
|
|
// Get header and footer
|
39 |
|
|
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
|
40 |
|
|
$fetch_content = $query_content->fetchRow();
|
41 |
|
|
|
42 |
|
|
?>
|
43 |
|
|
<script type="text/javascript">
|
44 |
|
|
_editor_url = "<?php echo WB_URL; ?>/include/htmlarea/";
|
45 |
|
|
_editor_lang = "en";
|
46 |
|
|
</script>
|
47 |
|
|
<script type="text/javascript" src="<?php echo WB_URL; ?>/include/htmlarea/htmlarea.js"></script>
|
48 |
|
|
<script type="text/javascript">
|
49 |
|
|
HTMLArea.loadPlugin("ContextMenu");
|
50 |
|
|
HTMLArea.loadPlugin("TableOperations");
|
51 |
|
|
function initEditor() {
|
52 |
|
|
var editor = new HTMLArea("short");
|
53 |
|
|
editor.registerPlugin(ContextMenu);
|
54 |
|
|
editor.config.pageStyle = "body { <?php echo stripslashes(WYSIWYG_STYLE); ?> }";
|
55 |
|
|
editor.generate();
|
56 |
|
|
var editor = new HTMLArea("long");
|
57 |
|
|
editor.registerPlugin(ContextMenu);
|
58 |
|
|
editor.registerPlugin(TableOperations);
|
59 |
|
|
editor.config.pageStyle = "body { <?php echo stripslashes(WYSIWYG_STYLE); ?> }";
|
60 |
|
|
editor.generate();
|
61 |
|
|
}
|
62 |
|
|
</script>
|
63 |
|
|
|
64 |
|
|
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.php" method="post" style="margin: 0;">
|
65 |
|
|
|
66 |
|
|
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
|
67 |
|
|
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
|
68 |
|
|
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>">
|
69 |
|
|
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>">
|
70 |
|
|
|
71 |
|
|
<table cellpadding="4" cellspacing="0" border="0" width="100%">
|
72 |
|
|
<tr>
|
73 |
|
|
<td width="80"><?php echo $TEXT['TITLE']; ?>:</td>
|
74 |
|
|
<td>
|
75 |
|
|
<input type="text" name="title" value="<?php echo stripslashes(htmlspecialchars($fetch_content['title'])); ?>" style="width: 100%;" maxlength="255" />
|
76 |
|
|
</td>
|
77 |
|
|
</tr>
|
78 |
|
|
<tr>
|
79 |
|
|
<td><?php echo $TEXT['GROUP']; ?>:</td>
|
80 |
|
|
<td>
|
81 |
|
|
<select name="group" style="width: 100%;">
|
82 |
|
|
<option value="0"><?php echo $TEXT['NONE']; ?></option>
|
83 |
|
|
<?php
|
84 |
|
|
$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
|
85 |
|
|
if($query->numRows() > 0) {
|
86 |
|
|
// Loop through groups
|
87 |
|
|
while($group = $query->fetchRow()) {
|
88 |
|
|
?>
|
89 |
|
|
<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected'; } ?>><?php echo $group['title']; ?></option>
|
90 |
|
|
<?php
|
91 |
|
|
}
|
92 |
|
|
}
|
93 |
|
|
?>
|
94 |
|
|
</select>
|
95 |
|
|
</td>
|
96 |
|
|
</tr>
|
97 |
|
|
<tr>
|
98 |
|
|
<td><?php echo $TEXT['COMMENTING']; ?>:</td>
|
99 |
|
|
<td>
|
100 |
|
|
<select name="commenting" style="width: 100%;">
|
101 |
|
|
<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
|
102 |
|
|
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
|
103 |
|
|
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
|
104 |
|
|
</select>
|
105 |
|
|
</td>
|
106 |
|
|
</tr>
|
107 |
|
|
<tr>
|
108 |
|
|
<td><?php echo $TEXT['ACTIVE']; ?>:</td>
|
109 |
|
|
<td>
|
110 |
|
|
<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked'; } ?> />
|
111 |
|
|
<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
|
112 |
|
|
<?php echo $TEXT['YES']; ?>
|
113 |
|
|
</a>
|
114 |
|
|
|
115 |
|
|
<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked'; } ?> />
|
116 |
|
|
<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
|
117 |
|
|
<?php echo $TEXT['NO']; ?>
|
118 |
|
|
</a>
|
119 |
|
|
</td>
|
120 |
|
|
</tr>
|
121 |
|
|
<tr>
|
122 |
|
|
<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td>
|
123 |
|
|
<td>
|
124 |
|
|
<textarea name="short" id="short" style="width: 100%; height: 135px;"><?php echo htmlspecialchars(stripslashes($fetch_content['short'])); ?></textarea>
|
125 |
|
|
</td>
|
126 |
|
|
</tr>
|
127 |
|
|
<tr>
|
128 |
|
|
<td valign="top"><?php echo $TEXT['LONG']; ?>:</td>
|
129 |
|
|
<td>
|
130 |
|
|
<textarea name="long" id="long" style="width: 100%; height: 300px;"><?php echo htmlspecialchars(stripslashes($fetch_content['long'])); ?></textarea>
|
131 |
|
|
</td>
|
132 |
|
|
</tr>
|
133 |
|
|
</table>
|
134 |
|
|
|
135 |
|
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
136 |
|
|
<tr>
|
137 |
|
|
<td width="90">
|
138 |
|
|
|
139 |
|
|
</td>
|
140 |
|
|
<td align="left">
|
141 |
|
|
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 200px; margin-top: 5px;"></form>
|
142 |
|
|
</td>
|
143 |
|
|
<td align="right">
|
144 |
|
|
<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;" />
|
145 |
|
|
</td>
|
146 |
|
|
</tr>
|
147 |
|
|
</table>
|
148 |
|
|
|
149 |
|
|
<br />
|
150 |
|
|
|
151 |
|
|
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['COMMENT']; ?></h2>
|
152 |
|
|
|
153 |
|
|
<?php
|
154 |
|
|
|
155 |
|
|
// Loop through existing posts
|
156 |
|
|
$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");
|
157 |
|
|
if($query_comments->numRows() > 0) {
|
158 |
|
|
$row = 'a';
|
159 |
|
|
?>
|
160 |
|
|
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
161 |
|
|
<?php
|
162 |
|
|
while($comment = $query_comments->fetchRow()) {
|
163 |
|
|
?>
|
164 |
|
|
<tr class="row_<?php echo $row; ?>" height="20">
|
165 |
|
|
<td width="20" style="padding-left: 5px;">
|
166 |
|
|
<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']; ?>">
|
167 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="^" />
|
168 |
|
|
</a>
|
169 |
|
|
</td>
|
170 |
|
|
<td>
|
171 |
|
|
<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']; ?>">
|
172 |
|
|
<?php echo $comment['title']; ?>
|
173 |
|
|
</a>
|
174 |
|
|
</td>
|
175 |
|
|
<td width="20">
|
176 |
|
|
<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']; ?>">
|
177 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
178 |
|
|
</a>
|
179 |
|
|
</td>
|
180 |
|
|
</tr>
|
181 |
|
|
<?php
|
182 |
|
|
// Alternate row color
|
183 |
|
|
if($row == 'a') {
|
184 |
|
|
$row = 'b';
|
185 |
|
|
} else {
|
186 |
|
|
$row = 'a';
|
187 |
|
|
}
|
188 |
|
|
}
|
189 |
|
|
?>
|
190 |
|
|
</table>
|
191 |
|
|
<?php
|
192 |
|
|
} else {
|
193 |
|
|
echo $TEXT['NONE_FOUND'];
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
?>
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
<?php
|
201 |
|
|
|
202 |
|
|
// Print admin footer
|
203 |
|
|
$admin->print_footer();
|
204 |
|
|
|
205 |
|
|
?>
|