1 |
1064
|
Ruebenwurz
|
<?php
|
2 |
1289
|
kweitzel
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category modules
|
5 |
|
|
* @package news
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright 2004-2009, Ryan Djurovich
|
8 |
|
|
* @copyright 2009-2010, Website Baker Org. e.V.
|
9 |
|
|
* @link http://www.websitebaker2.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.x
|
12 |
|
|
* @requirements PHP 4.3.4 and higher
|
13 |
|
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL$
|
15 |
|
|
* @lastmodified $Date$
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
1064
|
Ruebenwurz
|
|
19 |
|
|
// Must include code to stop this file being access directly
|
20 |
|
|
if(!defined('WB_PATH')) { exit("Cannot access this file directly"); }
|
21 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id = '$page_id' and section_id = '$section_id' and title=''");
|
22 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups WHERE page_id = '$page_id' and section_id = '$section_id' and title=''");
|
23 |
|
|
|
24 |
1079
|
Ruebenwurz
|
//overwrite php.ini on Apache servers for valid SESSION ID Separator
|
25 |
|
|
if(function_exists('ini_set')) {
|
26 |
|
|
ini_set('arg_separator.output', '&');
|
27 |
|
|
}
|
28 |
|
|
|
29 |
1064
|
Ruebenwurz
|
?>
|
30 |
|
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
31 |
|
|
<tr>
|
32 |
|
|
<td align="left" width="33%">
|
33 |
1079
|
Ruebenwurz
|
<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 |
1064
|
Ruebenwurz
|
</td>
|
35 |
|
|
<td align="left" width="33%">
|
36 |
1079
|
Ruebenwurz
|
<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 |
1064
|
Ruebenwurz
|
</td>
|
38 |
|
|
<td align="right" width="33%">
|
39 |
1079
|
Ruebenwurz
|
<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 |
1064
|
Ruebenwurz
|
</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; ?>">
|
61 |
|
|
<td width="20" style="padding-left: 5px;">
|
62 |
1079
|
Ruebenwurz
|
<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 |
1064
|
Ruebenwurz
|
<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
|
64 |
|
|
</a>
|
65 |
|
|
</td>
|
66 |
|
|
<td>
|
67 |
1079
|
Ruebenwurz
|
<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 |
1064
|
Ruebenwurz
|
<?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="120">
|
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
|
95 |
|
|
$start = $post['published_when'];
|
96 |
|
|
$end = $post['published_until'];
|
97 |
|
|
$t = time();
|
98 |
|
|
$icon = '';
|
99 |
|
|
if($start<=$t && $end==0)
|
100 |
|
|
$icon=THEME_URL.'/images/noclock_16.png';
|
101 |
|
|
elseif(($start<=$t || $start==0) && $end>=$t)
|
102 |
|
|
$icon=THEME_URL.'/images/clock_16.png';
|
103 |
|
|
else
|
104 |
|
|
$icon=THEME_URL.'/images/clock_red_16.png';
|
105 |
|
|
?>
|
106 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
107 |
1064
|
Ruebenwurz
|
<img src="<?php echo $icon; ?>" border="0" alt="" />
|
108 |
|
|
</a>
|
109 |
|
|
</td>
|
110 |
|
|
<td width="20">
|
111 |
|
|
<?php if($post['position'] != $num_posts) { ?>
|
112 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
113 |
1064
|
Ruebenwurz
|
<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
|
114 |
|
|
</a>
|
115 |
|
|
<?php } ?>
|
116 |
|
|
</td>
|
117 |
|
|
<td width="20">
|
118 |
|
|
<?php if($post['position'] != 1) { ?>
|
119 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
120 |
1064
|
Ruebenwurz
|
<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
|
121 |
|
|
</a>
|
122 |
|
|
<?php } ?>
|
123 |
|
|
</td>
|
124 |
|
|
<td width="20">
|
125 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
126 |
1064
|
Ruebenwurz
|
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
127 |
|
|
</a>
|
128 |
|
|
</td>
|
129 |
|
|
</tr>
|
130 |
|
|
<?php
|
131 |
|
|
// Alternate row color
|
132 |
|
|
if($row == 'a') {
|
133 |
|
|
$row = 'b';
|
134 |
|
|
} else {
|
135 |
|
|
$row = 'a';
|
136 |
|
|
}
|
137 |
|
|
}
|
138 |
|
|
?>
|
139 |
|
|
</table>
|
140 |
|
|
<?php
|
141 |
|
|
} else {
|
142 |
|
|
echo $TEXT['NONE_FOUND'];
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
?>
|
146 |
|
|
|
147 |
|
|
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['GROUP']; ?></h2>
|
148 |
|
|
|
149 |
|
|
<?php
|
150 |
|
|
|
151 |
|
|
// Loop through existing groups
|
152 |
|
|
$query_groups = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_groups` WHERE section_id = '$section_id' ORDER BY position ASC");
|
153 |
|
|
if($query_groups->numRows() > 0) {
|
154 |
|
|
$num_groups = $query_groups->numRows();
|
155 |
|
|
$row = 'a';
|
156 |
|
|
?>
|
157 |
|
|
<table cellpadding="2" cellspacing="0" border="0" width="100%">
|
158 |
|
|
<?php
|
159 |
|
|
while($group = $query_groups->fetchRow()) {
|
160 |
|
|
?>
|
161 |
|
|
<tr class="row_<?php echo $row; ?>">
|
162 |
|
|
<td width="20" style="padding-left: 5px;">
|
163 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
164 |
1064
|
Ruebenwurz
|
<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="Modify - " />
|
165 |
|
|
</a>
|
166 |
|
|
</td>
|
167 |
|
|
<td>
|
168 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
169 |
1064
|
Ruebenwurz
|
<?php echo $group['title']; ?>
|
170 |
|
|
</a>
|
171 |
|
|
</td>
|
172 |
|
|
<td width="80">
|
173 |
|
|
<?php echo $TEXT['ACTIVE'].': '; if($group['active'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; } ?>
|
174 |
|
|
</td>
|
175 |
|
|
<td width="20">
|
176 |
|
|
<?php if($group['position'] != 1) { ?>
|
177 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
178 |
1064
|
Ruebenwurz
|
<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
|
179 |
|
|
</a>
|
180 |
|
|
<?php } ?>
|
181 |
|
|
</td>
|
182 |
|
|
<td width="20">
|
183 |
|
|
<?php if($group['position'] != $num_groups) { ?>
|
184 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
185 |
1064
|
Ruebenwurz
|
<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
|
186 |
|
|
</a>
|
187 |
|
|
<?php } ?>
|
188 |
|
|
</td>
|
189 |
|
|
<td width="20">
|
190 |
1079
|
Ruebenwurz
|
<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']; ?>">
|
191 |
1064
|
Ruebenwurz
|
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
192 |
|
|
</a>
|
193 |
|
|
</td>
|
194 |
|
|
</tr>
|
195 |
|
|
<?php
|
196 |
|
|
// Alternate row color
|
197 |
|
|
if($row == 'a') {
|
198 |
|
|
$row = 'b';
|
199 |
|
|
} else {
|
200 |
|
|
$row = 'a';
|
201 |
|
|
}
|
202 |
|
|
}
|
203 |
|
|
?>
|
204 |
|
|
</table>
|
205 |
|
|
<?php
|
206 |
|
|
} else {
|
207 |
|
|
echo $TEXT['NONE_FOUND'];
|
208 |
|
|
}
|
209 |
562
|
Ruebenwurz
|
?>
|