Project

General

Profile

1
<?php
2

    
3
// $Id: modify_post.php 239 2005-11-22 11:50:41Z stefan $
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
if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
43
	function show_wysiwyg_editor($name,$id,$content,$width,$height) {
44
		echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
45
	}
46
} else {
47
	$id_list=array("short","long");
48
			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
49
}
50

    
51
?>
52
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.php" method="post" style="margin: 0;">
53

    
54
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
55
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
56
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>">
57
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>">
58

    
59
<table cellpadding="4" cellspacing="0" border="0" width="100%">
60
<tr>
61
	<td width="80"><?php echo $TEXT['TITLE']; ?>:</td>
62
	<td width="100%">
63
		<input type="text" name="title" value="<?php echo (htmlspecialchars($fetch_content['title'])); ?>" style="width: 100%;" maxlength="255" />
64
	</td>
65
</tr>
66
<tr>
67
	<td><?php echo $TEXT['GROUP']; ?>:</td>
68
	<td>
69
		<select name="group" style="width: 100%;">
70
			<option value="0"><?php echo $TEXT['NONE']; ?></option>
71
			<?php
72
			$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC");
73
			if($query->numRows() > 0) {
74
				// Loop through groups
75
				while($group = $query->fetchRow()) {
76
					?>
77
					<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected'; } ?>><?php echo $group['title']; ?></option>
78
					<?php
79
				}
80
			}
81
			?>
82
		</select>
83
	</td>
84
</tr>
85
<tr>
86
	<td><?php echo $TEXT['COMMENTING']; ?>:</td>
87
	<td>
88
		<select name="commenting" style="width: 100%;">
89
			<option value="none"><?php echo $TEXT['DISABLED']; ?></option>
90
			<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
91
			<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
92
		</select>
93
	</td>
94
</tr>
95
<tr>
96
	<td><?php echo $TEXT['ACTIVE']; ?>:</td>
97
	<td>
98
		<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked'; } ?> />
99
		<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
100
		<?php echo $TEXT['YES']; ?>
101
		</a>
102
		&nbsp;
103
		<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked'; } ?> />
104
		<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
105
		<?php echo $TEXT['NO']; ?>
106
		</a>
107
	</td>
108
</tr>
109
<tr>
110
	<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td>
111
	<td>
112
	<?php
113
	show_wysiwyg_editor("short","short",$fetch_content['content_short'],"100%","135px");
114
	?>
115
	</td>
116
</tr>
117
<tr>
118
	<td valign="top"><?php echo $TEXT['LONG']; ?>:</td>
119
	<td>
120
	<?php
121
	show_wysiwyg_editor("long","long",$fetch_content['content_long'],"100%","300px");
122
	?>
123
	</td>
124
</tr>
125
</table>
126

    
127
<table cellpadding="0" cellspacing="0" border="0" width="100%">
128
<tr>
129
	<td width="90">
130
		&nbsp;
131
	</td>
132
	<td align="left">
133
		<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 200px; margin-top: 5px;"></form>
134
	</td>
135
	<td align="right">
136
		<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;" />
137
	</td>
138
</tr>
139
</table>
140

    
141
<br />
142

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

    
145
<?php
146

    
147
// Loop through existing posts
148
$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");
149
if($query_comments->numRows() > 0) {
150
	$row = 'a';
151
	?>
152
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
153
	<?php
154
	while($comment = $query_comments->fetchRow()) {
155
		?>
156
		<tr class="row_<?php echo $row; ?>" height="20">
157
			<td width="20" style="padding-left: 5px;">
158
				<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']; ?>">
159
					<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="^" />
160
				</a>
161
			</td>	
162
			<td>
163
				<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']; ?>">
164
					<?php echo $comment['title']; ?>
165
				</a>
166
			</td>
167
			<td width="20">
168
				<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']; ?>">
169
					<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
170
				</a>
171
			</td>
172
		</tr>
173
		<?php
174
		// Alternate row color
175
		if($row == 'a') {
176
			$row = 'b';
177
		} else {
178
			$row = 'a';
179
		}
180
	}
181
	?>
182
	</table>
183
	<?php
184
} else {
185
	echo $TEXT['NONE_FOUND'];
186
}
187

    
188
?>
189

    
190

    
191

    
192
<?php
193

    
194
// Print admin footer
195
$admin->print_footer();
196

    
197
?>
(16-16/27)