Project

General

Profile

1
<?php
2

    
3
// $Id: modify.php 310 2006-02-19 05:31:10Z ryan $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2006, 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
// Must include code to stop this file being access directly
27
if(!defined('WB_PATH')) { exit("Cannot access this file directly"); }
28

    
29
?>
30
<table cellpadding="0" cellspacing="0" border="0" width="100%">
31
<tr>
32
	<td align="left" width="33%">
33
		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['POST']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/add_post.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
34
	</td>
35
	<td align="left" width="33%">
36
		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['GROUP']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/add_group.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
37
	</td>
38
	<td align="right" width="33%">
39
		<input type="button" value="<?php echo $TEXT['SETTINGS']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_settings.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
40
	</td>
41
</tr>
42
</table>
43

    
44
<br />
45

    
46
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['POST']; ?></h2>
47

    
48
<?php
49

    
50
// Loop through existing posts
51
$query_posts = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_posts` WHERE section_id = '$section_id' ORDER BY position DESC");
52
if($query_posts->numRows() > 0) {
53
	$num_posts = $query_posts->numRows();
54
	$row = 'a';
55
	?>
56
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
57
	<?php
58
	while($post = $query_posts->fetchRow()) {
59
		?>
60
		<tr class="row_<?php echo $row; ?>" height="20">
61
			<td width="20" style="padding-left: 5px;">
62
				<a href="<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post['post_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
63
					<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
64
				</a>
65
			</td>
66
			<td>
67
				<a href="<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post['post_id']; ?>">
68
					<?php echo ($post['title']); ?>
69
				</a>
70
			</td>
71
			<td width="180">
72
				<?php echo $TEXT['GROUP'].': ';
73
				// Get group title
74
				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '".$post['group_id']."'");
75
				if($query_title->numRows() > 0) {
76
					$fetch_title = $query_title->fetchRow();
77
					echo ($fetch_title['title']);
78
				} else {
79
					echo $TEXT['NONE'];
80
				}
81
				?>
82
			</td>
83
			<td width="80">
84
				<?php echo $TEXT['COMMENTS'].': ';
85
				// Get number of comments
86
				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".$post['post_id']."'");
87
				echo $query_title->numRows();
88
				?>
89
			</td>
90
			<td width="80">
91
				<?php echo $TEXT['ACTIVE'].': '; if($post['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
92
			</td>
93
			<td width="20">
94
			<?php if($post['position'] != $num_posts) { ?>
95
				<a href="<?php echo WB_URL; ?>/modules/news/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post['post_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
96
					<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
97
				</a>
98
			<?php } ?>
99
			</td>
100
			<td width="20">
101
			<?php if($post['position'] != 1) { ?>
102
				<a href="<?php echo WB_URL; ?>/modules/news/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post['post_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
103
					<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
104
				</a>
105
			<?php } ?>
106
			</td>
107
			<td width="20">
108
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_post.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&post_id=<?php echo $post['post_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
109
					<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
110
				</a>
111
			</td>
112
		</tr>
113
		<?php
114
		// Alternate row color
115
		if($row == 'a') {
116
			$row = 'b';
117
		} else {
118
			$row = 'a';
119
		}
120
	}
121
	?>
122
	</table>
123
	<?php
124
} else {
125
	echo $TEXT['NONE_FOUND'];
126
}
127

    
128
?>
129

    
130
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['GROUP']; ?></h2>
131

    
132
<?php
133

    
134
// Loop through existing groups
135
$query_groups = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_groups` WHERE section_id = '$section_id' ORDER BY position ASC");
136
if($query_groups->numRows() > 0) {
137
	$num_groups = $query_groups->numRows();
138
	$row = 'a';
139
	?>
140
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
141
	<?php
142
	while($group = $query_groups->fetchRow()) {
143
		?>
144
		<tr class="row_<?php echo $row; ?>" height="20">
145
			<td width="20" style="padding-left: 5px;">
146
				<a href="<?php echo WB_URL; ?>/modules/news/modify_group.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
147
					<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
148
				</a>
149
			</td>		
150
			<td>
151
				<a href="<?php echo WB_URL; ?>/modules/news/modify_group.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&group_id=<?php echo $group['group_id']; ?>">
152
					<?php echo $group['title']; ?>
153
				</a>
154
			</td>
155
			<td width="80">
156
				<?php echo $TEXT['ACTIVE'].': '; if($group['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
157
			</td>
158
			<td width="20">
159
			<?php if($group['position'] != 1) { ?>
160
				<a href="<?php echo WB_URL; ?>/modules/news/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
161
					<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
162
				</a>
163
			<?php } ?>
164
			</td>
165
			<td width="20">
166
			<?php if($group['position'] != $num_groups) { ?>
167
				<a href="<?php echo WB_URL; ?>/modules/news/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&group_id=<?php echo $group['group_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
168
					<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
169
				</a>
170
			<?php } ?>
171
			</td>
172
			<td width="20">
173
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/news/delete_group.php?page_id=<?php echo $page_id; ?>&group_id=<?php echo $group['group_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
174
					<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
175
				</a>
176
			</td>
177
		</tr>
178
		<?php
179
		// Alternate row color
180
		if($row == 'a') {
181
			$row = 'b';
182
		} else {
183
			$row = 'a';
184
		}
185
	}
186
	?>
187
	</table>
188
	<?php
189
} else {
190
	echo $TEXT['NONE_FOUND'];
191
}
192
?>
(13-13/27)