Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @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: modify.php 1538 2011-12-10 15:06:15Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/news/modify.php $
14
 * @lastmodified    $Date: 2011-12-10 16:06:15 +0100 (Sat, 10 Dec 2011) $
15
 *
16
 */
17

    
18
// Must include code to stop this file being access directly
19
/* -------------------------------------------------------- */
20
if(defined('WB_PATH') == false)
21
{
22
	// Stop this file being access directly
23
		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
24
}
25
/* -------------------------------------------------------- */
26

    
27
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''"); 
28
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups  WHERE page_id = '$page_id' and section_id = '$section_id' and title=''"); 
29

    
30
//overwrite php.ini on Apache servers for valid SESSION ID Separator
31
if(function_exists('ini_set')) {
32
	ini_set('arg_separator.output', '&amp;');
33
}
34

    
35
?>
36
<table cellpadding="0" cellspacing="0" border="0" width="100%">
37
<tr>
38
	<td align="left" width="33%">
39
		<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%;" />
40
	</td>
41
	<td align="left" width="33%">
42
		<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%;" />
43
	</td>
44
	<td align="right" width="33%">
45
		<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%;" />
46
	</td>
47
</tr>
48
</table>
49

    
50
<br />
51

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

    
54
<?php
55

    
56
// Loop through existing posts
57
$query_posts = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_posts` WHERE section_id = '$section_id' ORDER BY position DESC");
58
if($query_posts->numRows() > 0) {
59
	$num_posts = $query_posts->numRows();
60
	$row = 'a';
61
	?>
62
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
63
	<?php
64
	while($post = $query_posts->fetchRow()) {
65
		$pid = $admin->getIDKEY($post['post_id']);
66
		?>
67
		<tr class="row_<?php echo $row; ?>">
68
			<td width="20" style="padding-left: 5px;">
69
				<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']; ?>">
70
					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
71
				</a>
72
			</td>
73
			<td>
74
				<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; ?>">
75
					<?php echo ($post['title']); ?>
76
				</a>
77
			</td>
78
			<td width="180">
79
				<?php echo $TEXT['GROUP'].': ';
80
				// Get group title
81
				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '".$post['group_id']."'");
82
				if($query_title->numRows() > 0) {
83
					$fetch_title = $query_title->fetchRow();
84
					echo ($fetch_title['title']);
85
				} else {
86
					echo $TEXT['NONE'];
87
				}
88
				?>
89
			</td>
90
			<td width="120">
91
				<?php echo $TEXT['COMMENTS'].': ';
92
				// Get number of comments
93
				$query_title = $database->query("SELECT title FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".$post['post_id']."'");
94
				echo $query_title->numRows();
95
				?>
96
			</td>
97
			<td width="80">
98
				<?php echo $TEXT['ACTIVE'].': '; if($post['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
99
			</td>
100
			<td width="20">
101
			<?php
102
			$start = $post['published_when'];
103
			$end = $post['published_until'];
104
			$t = time();
105
			$icon = '';
106
			if($start<=$t && $end==0)
107
				$icon=THEME_URL.'/images/noclock_16.png';
108
			elseif(($start<=$t || $start==0) && $end>=$t)
109
				$icon=THEME_URL.'/images/clock_16.png';
110
			else
111
				$icon=THEME_URL.'/images/clock_red_16.png';
112
			?>
113
			<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']; ?>">
114
				<img src="<?php echo $icon; ?>" border="0" alt="" />
115
			</a>
116
			</td>
117
			<td width="20">
118
			<?php if($post['position'] != $num_posts) { ?>
119
				<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']; ?>">
120
					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
121
				</a>
122
			<?php } ?>
123
			</td>
124
			<td width="20">
125
			<?php if($post['position'] != 1) { ?>
126
				<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']; ?>">
127
					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
128
				</a>
129
			<?php } ?>
130
			</td>
131
			<td width="20">
132
				<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']; ?>">
133
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
134
				</a>
135
			</td>
136
		</tr>
137
		<?php
138
		// Alternate row color
139
		if($row == 'a') {
140
			$row = 'b';
141
		} else {
142
			$row = 'a';
143
		}
144
	}
145
	?>
146
	</table>
147
	<?php
148
} else {
149
	echo $TEXT['NONE_FOUND'];
150
}
151

    
152
?>
153

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

    
156
<?php
157

    
158
// Loop through existing groups
159
$query_groups = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_groups` WHERE section_id = '$section_id' ORDER BY position ASC");
160
if($query_groups->numRows() > 0) {
161
	$num_groups = $query_groups->numRows();
162
	$row = 'a';
163
	?>
164
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
165
	<?php
166
	while($group = $query_groups->fetchRow()) {
167
		$gid = $admin->getIDKEY($group['group_id']);
168
		?>
169
		<tr class="row_<?php echo $row; ?>">
170
			<td width="20" style="padding-left: 5px;">
171
				<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']; ?>">
172
					<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
173
				</a>
174
			</td>		
175
			<td>
176
				<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; ?>">
177
					<?php echo $group['title']; ?>
178
				</a>
179
			</td>
180
			<td width="80">
181
				<?php echo $TEXT['ACTIVE'].': '; if($group['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
182
			</td>
183
			<td width="20">
184
			<?php if($group['position'] != 1) { ?>
185
				<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']; ?>">
186
					<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
187
				</a>
188
			<?php } ?>
189
			</td>
190
			<td width="20">
191
			<?php if($group['position'] != $num_groups) { ?>
192
				<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']; ?>">
193
					<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
194
				</a>
195
			<?php } ?>
196
			</td>
197
			<td width="20">
198
				<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']; ?>">
199
					<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
200
				</a>
201
			</td>
202
		</tr>
203
		<?php
204
		// Alternate row color
205
		if($row == 'a') {
206
			$row = 'b';
207
		} else {
208
			$row = 'a';
209
		}
210
	}
211
	?>
212
	</table>
213
	<?php
214
} else {
215
	echo $TEXT['NONE_FOUND'];
216
}
(15-15/31)