Project

General

Profile

1 1425 Luisehahne
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7 1718 Luisehahne
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 1425 Luisehahne
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15
 *
16
 */
17
18
// Must include code to stop this file being access directly
19 1538 Luisehahne
/* -------------------------------------------------------- */
20
if(defined('WB_PATH') == false)
21
{
22
	// Stop this file being access directly
23 1718 Luisehahne
		die('<h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2>');
24 1538 Luisehahne
}
25
/* -------------------------------------------------------- */
26 1718 Luisehahne
// fixed escaping malformed URI reference
27
$TEXT['ARE_YOU_SURE'] = str_replace(' ','%20',$TEXT['ARE_YOU_SURE']);
28
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''");
29
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''");
30 1425 Luisehahne
31
//overwrite php.ini on Apache servers for valid SESSION ID Separator
32
if(function_exists('ini_set')) {
33
	ini_set('arg_separator.output', '&amp;');
34
}
35
36
?>
37
<table cellpadding="0" cellspacing="0" border="0" width="100%">
38
<tr>
39
	<td align="left" width="33%">
40
		<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; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
41
	</td>
42
	<td align="left" width="33%">
43
		<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; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
44
	</td>
45
	<td align="right" width="33%">
46
		<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; ?>&amp;section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
47
	</td>
48
</tr>
49
</table>
50
51
<br />
52
53
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['POST']; ?></h2>
54
55
<?php
56
57
// Loop through existing posts
58
$query_posts = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_posts` WHERE section_id = '$section_id' ORDER BY position DESC");
59
if($query_posts->numRows() > 0) {
60
	$num_posts = $query_posts->numRows();
61
	$row = 'a';
62
	?>
63
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
64
	<?php
65
	while($post = $query_posts->fetchRow()) {
66
		$pid = $admin->getIDKEY($post['post_id']);
67
		?>
68
		<tr class="row_<?php echo $row; ?>">
69
			<td width="20" style="padding-left: 5px;">
70
				<a href="<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $pid; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
71
					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
72
				</a>
73
			</td>
74
			<td>
75
				<a href="<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $pid; ?>">
76
					<?php echo ($post['title']); ?>
77
				</a>
78
			</td>
79
			<td width="180">
80
				<?php echo $TEXT['GROUP'].': ';
81
				// Get group title
82
				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '".$post['group_id']."'");
83
				if($query_title->numRows() > 0) {
84
					$fetch_title = $query_title->fetchRow();
85
					echo ($fetch_title['title']);
86
				} else {
87
					echo $TEXT['NONE'];
88
				}
89
				?>
90
			</td>
91
			<td width="120">
92
				<?php echo $TEXT['COMMENTS'].': ';
93
				// Get number of comments
94
				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".$post['post_id']."'");
95
				echo $query_title->numRows();
96
				?>
97
			</td>
98
			<td width="80">
99
				<?php echo $TEXT['ACTIVE'].': '; if($post['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
100
			</td>
101
			<td width="20">
102
			<?php
103
			$start = $post['published_when'];
104
			$end = $post['published_until'];
105
			$t = time();
106
			$icon = '';
107
			if($start<=$t && $end==0)
108
				$icon=THEME_URL.'/images/noclock_16.png';
109
			elseif(($start<=$t || $start==0) && $end>=$t)
110
				$icon=THEME_URL.'/images/clock_16.png';
111
			else
112
				$icon=THEME_URL.'/images/clock_red_16.png';
113
			?>
114
			<a href="<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $pid; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
115
				<img src="<?php echo $icon; ?>" border="0" alt="" />
116
			</a>
117
			</td>
118
			<td width="20">
119
			<?php if($post['position'] != $num_posts) { ?>
120
				<a href="<?php echo WB_URL; ?>/modules/news/move_down.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $pid; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
121
					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
122
				</a>
123
			<?php } ?>
124
			</td>
125
			<td width="20">
126
			<?php if($post['position'] != 1) { ?>
127
				<a href="<?php echo WB_URL; ?>/modules/news/move_up.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $pid; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
128
					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
129
				</a>
130
			<?php } ?>
131
			</td>
132
			<td width="20">
133 1718 Luisehahne
				<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; ?>&amp;section_id=<?php echo $section_id; ?>&amp;post_id=<?php echo $pid; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
134 1425 Luisehahne
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
135
				</a>
136
			</td>
137
		</tr>
138
		<?php
139
		// Alternate row color
140
		if($row == 'a') {
141
			$row = 'b';
142
		} else {
143
			$row = 'a';
144
		}
145
	}
146
	?>
147
	</table>
148
	<?php
149
} else {
150
	echo $TEXT['NONE_FOUND'];
151
}
152
153
?>
154
155
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['GROUP']; ?></h2>
156
157
<?php
158
159
// Loop through existing groups
160
$query_groups = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_groups` WHERE section_id = '$section_id' ORDER BY position ASC");
161
if($query_groups->numRows() > 0) {
162
	$num_groups = $query_groups->numRows();
163
	$row = 'a';
164
	?>
165
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
166
	<?php
167
	while($group = $query_groups->fetchRow()) {
168
		$gid = $admin->getIDKEY($group['group_id']);
169
		?>
170
		<tr class="row_<?php echo $row; ?>">
171
			<td width="20" style="padding-left: 5px;">
172
				<a href="<?php echo WB_URL; ?>/modules/news/modify_group.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $gid; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
173
					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
174
				</a>
175 1718 Luisehahne
			</td>
176 1660 Luisehahne
			<td width="50" style="text-align: right;">
177
				<?php echo $group['group_id'] ?>
178
			</td>
179 1425 Luisehahne
			<td>
180
				<a href="<?php echo WB_URL; ?>/modules/news/modify_group.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $gid; ?>">
181
					<?php echo $group['title']; ?>
182
				</a>
183
			</td>
184
			<td width="80">
185
				<?php echo $TEXT['ACTIVE'].': '; if($group['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
186
			</td>
187
			<td width="20">
188
			<?php if($group['position'] != 1) { ?>
189
				<a href="<?php echo WB_URL; ?>/modules/news/move_up.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $gid; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
190
					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
191
				</a>
192
			<?php } ?>
193
			</td>
194
			<td width="20">
195
			<?php if($group['position'] != $num_groups) { ?>
196
				<a href="<?php echo WB_URL; ?>/modules/news/move_down.php?page_id=<?php echo $page_id; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $gid; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
197
					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
198
				</a>
199
			<?php } ?>
200
			</td>
201
			<td width="20">
202
				<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; ?>&amp;section_id=<?php echo $section_id; ?>&amp;group_id=<?php echo $gid; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
203
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
204
				</a>
205
			</td>
206
		</tr>
207
		<?php
208
		// Alternate row color
209
		if($row == 'a') {
210
			$row = 'b';
211
		} else {
212
			$row = 'a';
213
		}
214
	}
215
	?>
216
	</table>
217
	<?php
218
} else {
219
	echo $TEXT['NONE_FOUND'];
220
}