Project

General

Profile

1
<?php
2

    
3
// $Id: modify_post.php 519 2007-12-23 14:37:02Z Ruebenwurzel $
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
?>
53
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.php" method="post" style="margin: 0;">
54

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

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

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

    
142
<br />
143

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

    
146
<?php
147

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

    
189
?>
190

    
191

    
192

    
193
<?php
194

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

    
198
?>
(16-16/28)