Revision 1157
Added by Dietmar about 15 years ago
branches/2.8.x/CHANGELOG | ||
---|---|---|
12 | 12 |
! = Update/Change |
13 | 13 |
|
14 | 14 |
------------------------------------- 2.8.1 ------------------------------------- |
15 |
09-Oct-2009 Dietmar Woellbrink |
|
16 |
# Ticket #770, #785, #792, #807, #809, |
|
17 |
# fixes and recoded news module |
|
18 |
09-Oct-2009 Dietmar Woellbrink |
|
19 |
# Ticket #815 Fix Warning: open_basedir restriction in effect. File is in wrong directory in load_module |
|
20 |
# same fix to load_template |
|
15 | 21 |
07-Oct-2009 Dietrich Roland Pehlke |
16 | 22 |
# Missing contiue inside search.php to avoid access to an non-object if the query fails. (ticket #793). Thanks to Thorn. |
17 | 23 |
06-Oct-2009 Dietmar Woellbrink |
branches/2.8.x/wb/modules/news/info.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
$module_directory = 'news'; |
|
27 |
$module_name = 'News';
|
|
28 |
$module_function = 'page'; |
|
29 |
$module_version = '2.8';
|
|
30 |
$module_platform = '2.8'; |
|
31 |
$module_author = 'Ryan Djurovich, Rob Smith'; |
|
32 |
$module_license = 'GNU General Public License'; |
|
33 |
$module_description = 'This page type is designed for making a news page.'; |
|
34 |
|
|
1 |
<?php
|
|
2 |
|
|
3 |
// $Id$
|
|
4 |
|
|
5 |
/*
|
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/>
|
|
8 |
Copyright (C) 2004-2009, 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 |
$module_directory = 'news';
|
|
27 |
$module_name = 'News v3.1';
|
|
28 |
$module_function = 'page';
|
|
29 |
$module_version = '3.1';
|
|
30 |
$module_platform = '2.8';
|
|
31 |
$module_author = 'Ryan Djurovich, Rob Smith';
|
|
32 |
$module_license = 'GNU General Public License';
|
|
33 |
$module_description = 'This page type is designed for making a news page.';
|
|
34 |
|
|
35 | 35 |
?> |
branches/2.8.x/wb/modules/news/modify_post.php | ||
---|---|---|
46 | 46 |
} |
47 | 47 |
} else { |
48 | 48 |
$id_list=array("short","long"); |
49 |
require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
|
|
49 |
require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php'); |
|
50 | 50 |
} |
51 | 51 |
|
52 | 52 |
// include jscalendar-setup |
... | ... | |
62 | 62 |
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>" /> |
63 | 63 |
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>" /> |
64 | 64 |
|
65 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
|
|
65 |
<table class="row_a" cellpadding="2" cellspacing="0" width="100%"> |
|
66 | 66 |
<tr> |
67 | 67 |
<td><?php echo $TEXT['TITLE']; ?>:</td> |
68 | 68 |
<td width="80%"> |
... | ... | |
80 | 80 |
// Loop through groups |
81 | 81 |
while($group = $query->fetchRow()) { |
82 | 82 |
?> |
83 |
<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected'; } ?>><?php echo $group['title']; ?></option> |
|
83 |
<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected="selected"'; } ?>><?php echo $group['title']; ?></option>
|
|
84 | 84 |
<?php |
85 | 85 |
} |
86 | 86 |
} |
... | ... | |
93 | 93 |
<td> |
94 | 94 |
<select name="commenting" style="width: 100%;"> |
95 | 95 |
<option value="none"><?php echo $TEXT['DISABLED']; ?></option> |
96 |
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
|
|
97 |
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
|
|
96 |
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
|
|
97 |
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
|
|
98 | 98 |
</select> |
99 | 99 |
</td> |
100 | 100 |
</tr> |
... | ... | |
137 | 137 |
<tr> |
138 | 138 |
<td> |
139 | 139 |
<?php |
140 |
show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","135px");
|
|
140 |
show_wysiwyg_editor("short","short",htmlspecialchars($fetch_content['content_short']),"100%","150px");
|
|
141 | 141 |
?> |
142 | 142 |
</td> |
143 | 143 |
</tr> |
... | ... | |
147 | 147 |
<tr> |
148 | 148 |
<td> |
149 | 149 |
<?php |
150 |
show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","300px");
|
|
150 |
show_wysiwyg_editor("long","long",htmlspecialchars($fetch_content['content_long']),"100%","350px");
|
|
151 | 151 |
?> |
152 | 152 |
</td> |
153 | 153 |
</tr> |
... | ... | |
172 | 172 |
ifFormat : "<?php echo $jscal_ifformat ?>", |
173 | 173 |
button : "publishdate_trigger", |
174 | 174 |
firstDay : <?php echo $jscal_firstday ?>, |
175 |
<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?> |
|
175 |
<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) |
|
176 |
{ ?> |
|
176 | 177 |
showsTime : "true", |
177 | 178 |
timeFormat : "24", |
178 |
<?php } ?> |
|
179 |
<?php |
|
180 |
} ?> |
|
179 | 181 |
date : "<?php echo $jscal_today ?>", |
180 | 182 |
range : [1970, 2037], |
181 | 183 |
step : 1 |
... | ... | |
187 | 189 |
ifFormat : "<?php echo $jscal_ifformat ?>", |
188 | 190 |
button : "enddate_trigger", |
189 | 191 |
firstDay : <?php echo $jscal_firstday ?>, |
190 |
<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) { ?> |
|
192 |
<?php if(isset($jscal_use_time) && $jscal_use_time==TRUE) |
|
193 |
{ ?> |
|
191 | 194 |
showsTime : "true", |
192 | 195 |
timeFormat : "24", |
193 |
<?php } ?> |
|
196 |
<?php |
|
197 |
} ?> |
|
194 | 198 |
date : "<?php echo $jscal_today ?>", |
195 | 199 |
range : [1970, 2037], |
196 | 200 |
step : 1 |
... | ... | |
215 | 219 |
?> |
216 | 220 |
<tr class="row_<?php echo $row; ?>" > |
217 | 221 |
<td width="20" style="padding-left: 5px;"> |
218 |
<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
|
|
222 |
<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']; ?>">
|
|
219 | 223 |
<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="^" /> |
220 | 224 |
</a> |
221 | 225 |
</td> |
222 | 226 |
<td> |
223 |
<a href="<?php echo WB_URL; ?>/modules/news/modify_comment.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>">
|
|
227 |
<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']; ?>">
|
|
224 | 228 |
<?php echo $comment['title']; ?> |
225 | 229 |
</a> |
226 | 230 |
</td> |
227 | 231 |
<td width="20"> |
228 |
<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; ?>§ion_id=<?php echo $section_id; ?>&post_id=<?php echo $post_id; ?>&comment_id=<?php echo $comment['comment_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
|
232 |
<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']; ?>">
|
|
229 | 233 |
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" /> |
230 | 234 |
</a> |
231 | 235 |
</td> |
... | ... | |
245 | 249 |
echo $TEXT['NONE_FOUND']; |
246 | 250 |
} |
247 | 251 |
|
248 |
?> |
|
249 | 252 |
|
250 |
|
|
251 |
|
|
252 |
<?php |
|
253 |
|
|
254 | 253 |
// Print admin footer |
255 | 254 |
$admin->print_footer(); |
256 | 255 |
|
branches/2.8.x/wb/modules/news/comment_page.php | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
|
26 | 26 |
// Make sure page cannot be accessed directly |
27 |
if(!defined('WB_URL')) {
|
|
27 |
if(!defined('WB_URL')) { |
|
28 | 28 |
header('Location: ../index.php'); |
29 | 29 |
exit(0); |
30 | 30 |
} |
31 | 31 |
|
32 |
//overwrite php.ini on Apache servers for valid SESSION ID Separator |
|
33 |
if(function_exists('ini_set')) { |
|
34 |
ini_set('arg_separator.output', '&'); |
|
35 |
} |
|
36 |
|
|
37 |
// check if frontend.css file needs to be included into the <body></body> of page |
|
32 |
/* check if frontend.css file needs to be included into the <body></body> of page */ |
|
38 | 33 |
if ( (!function_exists('register_frontend_modfiles') || !defined('MOD_FRONTEND_CSS_REGISTERED')) && file_exists(WB_PATH .'/modules/news/frontend.css')) { |
39 | 34 |
echo '<style type="text/css">'; |
40 | 35 |
include(WB_PATH .'/modules/news/frontend.css'); |
... | ... | |
42 | 37 |
} |
43 | 38 |
|
44 | 39 |
// check if module language file exists for the language set by the user (e.g. DE, EN) |
45 |
if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) { |
|
40 |
if(!file_exists(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php')) |
|
41 |
{ |
|
46 | 42 |
// no module language file exists for the language set by the user, include default module language file EN.php |
47 | 43 |
require_once(WB_PATH .'/modules/news/languages/EN.php'); |
48 |
} else { |
|
44 |
} |
|
45 |
else |
|
46 |
{ |
|
49 | 47 |
// a module language file exists for the language defined by the user, load it |
50 | 48 |
require_once(WB_PATH .'/modules/news/languages/'.LANGUAGE .'.php'); |
51 | 49 |
} |
... | ... | |
54 | 52 |
|
55 | 53 |
// Get comments page template details from db |
56 | 54 |
$query_settings = $database->query("SELECT comments_page,use_captcha,commenting FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'"); |
57 |
if($query_settings->numRows() == 0) { |
|
55 |
if($query_settings->numRows() == 0) |
|
56 |
{ |
|
58 | 57 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
59 |
exit(0); |
|
60 |
} else { |
|
58 |
exit( 0 ); |
|
59 |
} |
|
60 |
else |
|
61 |
{ |
|
61 | 62 |
$settings = $query_settings->fetchRow(); |
62 | 63 |
|
63 | 64 |
// Print comments page |
... | ... | |
93 | 94 |
?>: |
94 | 95 |
<br /> |
95 | 96 |
<?php if(ENABLED_ASP) { ?> |
96 |
<textarea name="c0mment_<?php echo date('W'); ?>" rows="10" cols="1" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
|
|
97 |
<textarea name="comment_<?php echo date('W'); ?>" rows="10" cols="1" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
|
|
97 | 98 |
<?php } else { ?> |
98 | 99 |
<textarea name="comment" rows="10" cols="1" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea> |
99 | 100 |
<?php } ?> |
... | ... | |
110 | 111 |
<tr> |
111 | 112 |
<td><?php echo $TEXT['VERIFICATION']; ?>:</td> |
112 | 113 |
<td><?php call_captcha(); ?></td> |
113 |
</tr></table>
|
|
114 |
<br />
|
|
114 |
</tr> |
|
115 |
</table>
|
|
115 | 116 |
<?php |
116 | 117 |
if(isset($_SESSION['captcha_error'])) { |
117 | 118 |
unset($_SESSION['captcha_error']); |
... | ... | |
120 | 121 |
<?php |
121 | 122 |
} |
122 | 123 |
?> |
123 |
<input type="submit" name="submit" value="<?php echo $MOD_NEWS['TEXT_ADD_COMMENT']; ?>" /> |
|
124 |
</form> |
|
124 |
<table class="news-table"> |
|
125 |
<tr> |
|
126 |
<td> |
|
127 |
<input type="submit" name="submit" value="<?php echo $MOD_NEWS['TEXT_ADD_COMMENT']; ?>" /> |
|
128 |
</td> |
|
129 |
<td> |
|
130 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="history.go(-1)" /> |
|
131 |
</td> |
|
132 |
</tr> |
|
133 |
</table> |
|
134 |
</form> |
|
125 | 135 |
<?php |
126 | 136 |
} |
127 | 137 |
|
branches/2.8.x/wb/modules/news/comment.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
// Include config file |
|
27 |
require('../../config.php'); |
|
28 |
|
|
29 |
// Check if there is a post id |
|
30 |
if(!isset($_GET['id']) OR !is_numeric($_GET['id']) OR !isset($_GET['sid']) OR !is_numeric($_GET['sid'])) { |
|
31 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
32 |
exit(0); |
|
33 |
} |
|
34 |
$post_id = $_GET['id']; |
|
35 |
$section_id = $_GET['sid']; |
|
36 |
|
|
37 |
// Query post for page id |
|
38 |
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'"); |
|
39 |
if($query_post->numRows() == 0) { |
|
40 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
41 |
exit(0); |
|
42 |
} else { |
|
43 |
$fetch_post = $query_post->fetchRow(); |
|
44 |
$page_id = $fetch_post['page_id']; |
|
45 |
$section_id = $fetch_post['section_id']; |
|
46 |
$post_id = $fetch_post['post_id']; |
|
47 |
$post_title = $fetch_post['title']; |
|
48 |
define('SECTION_ID', $section_id); |
|
49 |
define('POST_ID', $post_id); |
|
50 |
define('POST_TITLE', $post_title); |
|
51 |
|
|
52 |
// don't allow commenting if its disabled, or if post or group is inactive |
|
53 |
$t = time(); |
|
54 |
$table_posts = TABLE_PREFIX."mod_news_posts"; |
|
55 |
$table_groups = TABLE_PREFIX."mod_news_groups"; |
|
56 |
$query = $database->query(" |
|
57 |
SELECT p.post_id |
|
58 |
FROM $table_posts AS p LEFT OUTER JOIN $table_groups AS g ON p.group_id = g.group_id |
|
59 |
WHERE p.post_id='$post_id' AND p.commenting != 'none' AND p.active = '1' AND ( g.active IS NULL OR g.active = '1' ) |
|
60 |
AND (p.published_when = '0' OR p.published_when <= $t) AND (p.published_until = 0 OR p.published_until >= $t) |
|
61 |
"); |
|
62 |
if($query->numRows() == 0) { |
|
63 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
64 |
exit(0); |
|
65 |
} |
|
66 |
|
|
67 |
// don't allow commenting if ASP enabled and user doesn't comes from the right view.php |
|
68 |
if(ENABLED_ASP && (!isset($_SESSION['comes_from_view']) OR $_SESSION['comes_from_view']!=POST_ID)) { |
|
69 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
70 |
exit(0); |
|
71 |
} |
|
72 |
|
|
73 |
// Get page details |
|
74 |
$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
75 |
if($query_page->numRows() == 0) { |
|
76 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
77 |
exit(0); |
|
78 |
} else { |
|
79 |
$page = $query_page->fetchRow(); |
|
80 |
// Required page details |
|
81 |
define('PAGE_CONTENT', WB_PATH.'/modules/news/comment_page.php'); |
|
82 |
// Include index (wrapper) file |
|
83 |
require(WB_PATH.'/index.php'); |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
87 |
?> |
|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
// Include config file |
|
27 |
require('../../config.php'); |
|
28 |
|
|
29 |
// Check if there is a post id |
|
30 |
if(!isset($_GET['post_id']) OR !is_numeric($_GET['post_id']) |
|
31 |
OR !isset($_GET['section_id']) OR !is_numeric($_GET['section_id'])) |
|
32 |
{ |
|
33 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
34 |
exit( 0 ); |
|
35 |
} |
|
36 |
$post_id = $_GET['post_id']; |
|
37 |
$section_id = $_GET['section_id']; |
|
38 |
|
|
39 |
// Query post for page id |
|
40 |
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'"); |
|
41 |
if($query_post->numRows() == 0) |
|
42 |
{ |
|
43 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
44 |
exit( 0 ); |
|
45 |
} |
|
46 |
else |
|
47 |
{ |
|
48 |
$fetch_post = $query_post->fetchRow(); |
|
49 |
$page_id = $fetch_post['page_id']; |
|
50 |
$section_id = $fetch_post['section_id']; |
|
51 |
$post_id = $fetch_post['post_id']; |
|
52 |
$post_title = $fetch_post['title']; |
|
53 |
define('SECTION_ID', $section_id); |
|
54 |
define('POST_ID', $post_id); |
|
55 |
define('POST_TITLE', $post_title); |
|
56 |
|
|
57 |
// don't allow commenting if its disabled, or if post or group is inactive |
|
58 |
$t = time(); |
|
59 |
$table_posts = TABLE_PREFIX."mod_news_posts"; |
|
60 |
$table_groups = TABLE_PREFIX."mod_news_groups"; |
|
61 |
$query = $database->query(" |
|
62 |
SELECT p.post_id |
|
63 |
FROM $table_posts AS p LEFT OUTER JOIN $table_groups AS g ON p.group_id = g.group_id |
|
64 |
WHERE p.post_id='$post_id' AND p.commenting != 'none' AND p.active = '1' AND ( g.active IS NULL OR g.active = '1' ) |
|
65 |
AND (p.published_when = '0' OR p.published_when <= $t) AND (p.published_until = 0 OR p.published_until >= $t) |
|
66 |
"); |
|
67 |
if($query->numRows() == 0) |
|
68 |
{ |
|
69 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
70 |
exit( 0 ); |
|
71 |
} |
|
72 |
|
|
73 |
// don't allow commenting if ASP enabled and user doesn't comes from the right view.php |
|
74 |
if(ENABLED_ASP && (!isset($_SESSION['comes_from_view']) OR $_SESSION['comes_from_view']!=POST_ID)) |
|
75 |
{ |
|
76 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
77 |
exit( 0 ); |
|
78 |
} |
|
79 |
|
|
80 |
// Get page details |
|
81 |
$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
82 |
if($query_page->numRows() == 0) |
|
83 |
{ |
|
84 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
85 |
exit( 0 ); |
|
86 |
} |
|
87 |
else |
|
88 |
{ |
|
89 |
$page = $query_page->fetchRow(); |
|
90 |
// Required page details |
|
91 |
define('PAGE_CONTENT', WB_PATH.'/modules/news/comment_page.php'); |
|
92 |
// Include index (wrapper) file |
|
93 |
require(WB_PATH.'/index.php'); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
?> |
branches/2.8.x/wb/modules/news/delete.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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') == false) { exit("Cannot access this file directly"); } |
|
28 |
|
|
29 |
//get and remove all php files created for the news section |
|
30 |
$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'"); |
|
31 |
if($query_details->numRows() > 0) { |
|
32 |
while($link = $query_details->fetchRow()) { |
|
33 |
if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) { |
|
34 |
unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION); |
|
35 |
} |
|
36 |
} |
|
37 |
} |
|
38 |
//check to see if any other sections are part of the news page, if only 1 news is there delete it |
|
39 |
$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id'"); |
|
40 |
if($query_details->numRows() == 1) { |
|
41 |
$query_details2 = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
42 |
$link = $query_details2->fetchRow(); |
|
43 |
if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) { |
|
44 |
unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION); |
|
45 |
} |
|
46 |
} |
|
47 |
|
|
48 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'"); |
|
49 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id'"); |
|
50 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments WHERE section_id = '$section_id'"); |
|
51 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'"); |
|
52 |
|
|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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') == false) |
|
28 |
{ |
|
29 |
exit("Cannot access this file directly"); |
|
30 |
} |
|
31 |
|
|
32 |
//get and remove all php files created for the news section |
|
33 |
$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'"); |
|
34 |
if($query_details->numRows() > 0) { |
|
35 |
while($link = $query_details->fetchRow()) { |
|
36 |
if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) { |
|
37 |
unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION); |
|
38 |
} |
|
39 |
} |
|
40 |
} |
|
41 |
//check to see if any other sections are part of the news page, if only 1 news is there delete it |
|
42 |
$query_details = $database->query("SELECT * FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id'"); |
|
43 |
if($query_details->numRows() == 1) { |
|
44 |
$query_details2 = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
45 |
$link = $query_details2->fetchRow(); |
|
46 |
if(is_writable(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION)) { |
|
47 |
unlink(WB_PATH.PAGES_DIRECTORY.$link['link'].PAGE_EXTENSION); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id'"); |
|
52 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id'"); |
|
53 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_comments WHERE section_id = '$section_id'"); |
|
54 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'"); |
|
55 |
|
|
53 | 56 |
?> |
branches/2.8.x/wb/modules/news/save_post.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php"); |
|
29 |
|
|
30 |
// Get id |
|
31 |
if(!isset($_POST['post_id']) OR !is_numeric($_POST['post_id'])) { |
|
32 |
header("Location: ".ADMIN_URL."/pages/index.php"); |
|
33 |
exit(0); |
|
34 |
} else { |
|
35 |
$id = $_POST['post_id']; |
|
36 |
$post_id = $id; |
|
37 |
} |
|
38 |
|
|
39 |
// Include WB admin wrapper script |
|
40 |
$update_when_modified = true; // Tells script to update when this page was last updated |
|
41 |
require(WB_PATH.'/modules/admin.php'); |
|
42 |
|
|
43 |
// Validate all fields |
|
44 |
if($admin->get_post('title') == '' AND $admin->get_post('url') == '') { |
|
45 |
$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'§ion_id='.$section_id.'&post_id='.$id); |
|
46 |
} else { |
|
47 |
$title = $admin->get_post_escaped('title'); |
|
48 |
$short = $admin->get_post_escaped('short'); |
|
49 |
$long = $admin->get_post_escaped('long'); |
|
50 |
$commenting = $admin->get_post_escaped('commenting'); |
|
51 |
$active = $admin->get_post_escaped('active'); |
|
52 |
$old_link = $admin->get_post_escaped('link'); |
|
53 |
$group_id = $admin->get_post_escaped('group'); |
|
54 |
} |
|
55 |
|
|
56 |
// Get page link URL |
|
57 |
$query_page = $database->query("SELECT level,link FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
58 |
$page = $query_page->fetchRow(); |
|
59 |
$page_level = $page['level']; |
|
60 |
$page_link = $page['link']; |
|
61 |
|
|
62 |
// Include WB functions file |
|
63 |
require(WB_PATH.'/framework/functions.php'); |
|
64 |
|
|
65 |
// Work-out what the link should be |
|
66 |
$post_link = '/posts/'.page_filename($title).PAGE_SPACER.$post_id; |
|
67 |
|
|
68 |
// Make sure the post link is set and exists |
|
69 |
// Make news post access files dir |
|
70 |
make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/'); |
|
71 |
if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/posts/')) { |
|
72 |
$admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE']); |
|
73 |
} elseif($old_link != $post_link OR !file_exists(WB_PATH.PAGES_DIRECTORY.$post_link.PAGE_EXTENSION)) { |
|
74 |
// We need to create a new file |
|
75 |
// First, delete old file if it exists |
|
76 |
if(file_exists(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION)) { |
|
77 |
unlink(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION); |
|
78 |
} |
|
79 |
// Specify the filename |
|
80 |
$filename = WB_PATH.PAGES_DIRECTORY.'/'.$post_link.PAGE_EXTENSION; |
|
81 |
// The depth of the page directory in the directory hierarchy |
|
82 |
// '/pages' is at depth 1 |
|
83 |
$pages_dir_depth=count(explode('/',PAGES_DIRECTORY))-1; |
|
84 |
// Work-out how many ../'s we need to get to the index page |
|
85 |
$index_location = '../'; |
|
86 |
for($i = 0; $i < $pages_dir_depth; $i++) { |
|
87 |
$index_location .= '../'; |
|
88 |
} |
|
89 |
// Write to the filename |
|
90 |
$content = ''. |
|
91 |
'<?php |
|
92 |
$page_id = '.$page_id.'; |
|
93 |
$section_id = '.$section_id.'; |
|
94 |
$post_id = '.$post_id.'; |
|
95 |
define("POST_ID", $post_id); |
|
96 |
require("'.$index_location.'config.php"); |
|
97 |
require(WB_PATH."/index.php"); |
|
98 |
?>'; |
|
99 |
$handle = fopen($filename, 'w'); |
|
100 |
fwrite($handle, $content); |
|
101 |
fclose($handle); |
|
102 |
change_mode($filename); |
|
103 |
} |
|
104 |
|
|
105 |
// get publisedwhen and publisheduntil |
|
106 |
$publishedwhen = jscalendar_to_timestamp($admin->get_post_escaped('publishdate')); |
|
107 |
if($publishedwhen == '' || $publishedwhen < 1) |
|
108 |
$publishedwhen=0; |
|
109 |
$publisheduntil = jscalendar_to_timestamp($admin->get_post_escaped('enddate'), $publishedwhen); |
|
110 |
if($publisheduntil == '' || $publisheduntil < 1) |
|
111 |
$publisheduntil=0; |
|
112 |
|
|
113 |
// Update row |
|
114 |
$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', published_when = '$publishedwhen', published_until = '$publisheduntil', posted_when = '".time()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'"); |
|
115 |
|
|
116 |
// Check if there is a db error, otherwise say successful |
|
117 |
if($database->is_error()) { |
|
118 |
$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'§ion_id='.$section_id.'&post_id='.$id); |
|
119 |
} else { |
|
120 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
121 |
} |
|
122 |
|
|
123 |
// Print admin footer |
|
124 |
$admin->print_footer(); |
|
125 |
|
|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php"); |
|
29 |
|
|
30 |
// Get id |
|
31 |
if(!isset($_POST['post_id']) OR !is_numeric($_POST['post_id'])) |
|
32 |
{ |
|
33 |
header("Location: ".ADMIN_URL."/pages/index.php"); |
|
34 |
exit( 0 ); |
|
35 |
} |
|
36 |
else |
|
37 |
{ |
|
38 |
$id = $_POST['post_id']; |
|
39 |
$post_id = $id; |
|
40 |
} |
|
41 |
|
|
42 |
function create_file($filename, $filetime=NULL ) |
|
43 |
{ |
|
44 |
global $page_id, $section_id, $post_id; |
|
45 |
|
|
46 |
// We need to create a new file |
|
47 |
// First, delete old file if it exists |
|
48 |
if(file_exists(WB_PATH.PAGES_DIRECTORY.$filename.PAGE_EXTENSION)) |
|
49 |
{ |
|
50 |
$filetime = isset($filetime) ? $filetime : filectime($filename); |
|
51 |
unlink(WB_PATH.PAGES_DIRECTORY.$filename.PAGE_EXTENSION); |
|
52 |
} |
|
53 |
else { |
|
54 |
$filetime = isset($filetime) ? $filetime : time(); |
|
55 |
} |
|
56 |
// The depth of the page directory in the directory hierarchy |
|
57 |
// '/pages' is at depth 1 |
|
58 |
$pages_dir_depth = count(explode('/',PAGES_DIRECTORY))-1; |
|
59 |
// Work-out how many ../'s we need to get to the index page |
|
60 |
$index_location = '../'; |
|
61 |
for($i = 0; $i < $pages_dir_depth; $i++) |
|
62 |
{ |
|
63 |
$index_location .= '../'; |
|
64 |
} |
|
65 |
|
|
66 |
// Write to the filename |
|
67 |
$content = ''. |
|
68 |
'<?php |
|
69 |
$page_id = '.$page_id.'; |
|
70 |
$section_id = '.$section_id.'; |
|
71 |
$post_id = '.$post_id.'; |
|
72 |
define("POST_SECTION", $section_id); |
|
73 |
define("POST_ID", $post_id); |
|
74 |
require("'.$index_location.'config.php"); |
|
75 |
require(WB_PATH."/index.php"); |
|
76 |
?>'; |
|
77 |
if($handle = fopen($filename, 'w+')) |
|
78 |
{ |
|
79 |
fwrite($handle, $content); |
|
80 |
fclose($handle); |
|
81 |
if($filetime) |
|
82 |
{ |
|
83 |
touch($filename, $filetime); |
|
84 |
} |
|
85 |
change_mode($filename); |
|
86 |
} |
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
// Include WB admin wrapper script |
|
91 |
$update_when_modified = true; // Tells script to update when this page was last updated |
|
92 |
require(WB_PATH.'/modules/admin.php'); |
|
93 |
|
|
94 |
// Validate all fields |
|
95 |
if($admin->get_post('title') == '' AND $admin->get_post('url') == '') |
|
96 |
{ |
|
97 |
$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'§ion_id='.$section_id.'&post_id='.$id); |
|
98 |
} |
|
99 |
else |
|
100 |
{ |
|
101 |
$title = $admin->get_post_escaped('title'); |
|
102 |
$short = $admin->get_post_escaped('short'); |
|
103 |
$long = $admin->get_post_escaped('long'); |
|
104 |
$commenting = $admin->get_post_escaped('commenting'); |
|
105 |
$active = $admin->get_post_escaped('active'); |
|
106 |
$old_link = $admin->get_post_escaped('link'); |
|
107 |
$group_id = $admin->get_post_escaped('group'); |
|
108 |
} |
|
109 |
|
|
110 |
// Get page link URL |
|
111 |
$query_page = $database->query("SELECT level,link FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
112 |
$page = $query_page->fetchRow(); |
|
113 |
$page_level = $page['level']; |
|
114 |
$page_link = $page['link']; |
|
115 |
|
|
116 |
// Include WB functions file |
|
117 |
require(WB_PATH.'/framework/functions.php'); |
|
118 |
|
|
119 |
// Work-out what the link should be |
|
120 |
$post_link = '/posts/'.page_filename($title).PAGE_SPACER.$post_id; |
|
121 |
|
|
122 |
// Make sure the post link is set and exists |
|
123 |
// Make news post access files dir |
|
124 |
make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/'); |
|
125 |
$file_create_time = ''; |
|
126 |
if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/posts/')) |
|
127 |
{ |
|
128 |
$admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE']); |
|
129 |
} |
|
130 |
elseif($old_link != $post_link OR !file_exists(WB_PATH.PAGES_DIRECTORY.$post_link.PAGE_EXTENSION)) |
|
131 |
{ |
|
132 |
// We need to create a new file |
|
133 |
// First, delete old file if it exists |
|
134 |
if(file_exists(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION)) |
|
135 |
{ |
|
136 |
$file_create_time = filectime($old_link); |
|
137 |
unlink(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION); |
|
138 |
} |
|
139 |
|
|
140 |
// Specify the filename |
|
141 |
$filename = WB_PATH.PAGES_DIRECTORY.'/'.$post_link.PAGE_EXTENSION; |
|
142 |
create_file($filename, $file_create_time); |
|
143 |
} |
|
144 |
|
|
145 |
|
|
146 |
// get publisedwhen and publisheduntil |
|
147 |
$publishedwhen = jscalendar_to_timestamp($admin->get_post_escaped('publishdate')); |
|
148 |
if($publishedwhen == '' || $publishedwhen < 1) |
|
149 |
$publishedwhen=0; |
|
150 |
$publisheduntil = jscalendar_to_timestamp($admin->get_post_escaped('enddate'), $publishedwhen); |
|
151 |
if($publisheduntil == '' || $publisheduntil < 1) |
|
152 |
$publisheduntil=0; |
|
153 |
|
|
154 |
// Update row |
|
155 |
$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', published_when = '$publishedwhen', published_until = '$publisheduntil', posted_when = '".time()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'"); |
|
156 |
|
|
157 |
// Check if there is a db error, otherwise say successful |
|
158 |
if($database->is_error()) |
|
159 |
{ |
|
160 |
$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'§ion_id='.$section_id.'&post_id='.$id); |
|
161 |
} |
|
162 |
else |
|
163 |
{ |
|
164 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
165 |
} |
|
166 |
|
|
167 |
// Print admin footer |
|
168 |
$admin->print_footer(); |
|
169 |
|
|
126 | 170 |
?> |
branches/2.8.x/wb/modules/news/install.php | ||
---|---|---|
25 | 25 |
|
26 | 26 |
if(defined('WB_URL')) { |
27 | 27 |
|
28 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_posts`"); |
|
29 |
$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_posts` ( ' |
|
28 |
// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_posts`");
|
|
29 |
$mod_news = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_news_posts` ( '
|
|
30 | 30 |
. '`post_id` INT NOT NULL AUTO_INCREMENT,' |
31 | 31 |
. '`section_id` INT NOT NULL DEFAULT \'0\',' |
32 | 32 |
. '`page_id` INT NOT NULL DEFAULT \'0\',' |
... | ... | |
46 | 46 |
. ' )'; |
47 | 47 |
$database->query($mod_news); |
48 | 48 |
|
49 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_groups`"); |
|
50 |
$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_groups` ( ' |
|
49 |
// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_groups`");
|
|
50 |
$mod_news = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_news_groups` ( '
|
|
51 | 51 |
. '`group_id` INT NOT NULL AUTO_INCREMENT,' |
52 | 52 |
. '`section_id` INT NOT NULL DEFAULT \'0\',' |
53 | 53 |
. '`page_id` INT NOT NULL DEFAULT \'0\',' |
... | ... | |
58 | 58 |
. ' )'; |
59 | 59 |
$database->query($mod_news); |
60 | 60 |
|
61 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_comments`"); |
|
62 |
$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_comments` ( ' |
|
61 |
// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_comments`");
|
|
62 |
$mod_news = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_news_comments` ( '
|
|
63 | 63 |
. '`comment_id` INT NOT NULL AUTO_INCREMENT,' |
64 | 64 |
. '`section_id` INT NOT NULL DEFAULT \'0\',' |
65 | 65 |
. '`page_id` INT NOT NULL DEFAULT \'0\',' |
... | ... | |
72 | 72 |
. ' )'; |
73 | 73 |
$database->query($mod_news); |
74 | 74 |
|
75 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_settings`"); |
|
76 |
$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_settings` ( ' |
|
75 |
// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_settings`");
|
|
76 |
$mod_news = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_news_settings` ( '
|
|
77 | 77 |
. '`section_id` INT NOT NULL DEFAULT \'0\',' |
78 | 78 |
. '`page_id` INT NOT NULL DEFAULT \'0\',' |
79 | 79 |
. '`header` TEXT NOT NULL ,' |
... | ... | |
93 | 93 |
. ' )'; |
94 | 94 |
$database->query($mod_news); |
95 | 95 |
|
96 |
// Insert info into the search table |
|
97 |
// Module query info |
|
98 |
$field_info = array(); |
|
99 |
$field_info['page_id'] = 'page_id'; |
|
100 |
$field_info['title'] = 'page_title'; |
|
101 |
$field_info['link'] = 'link'; |
|
102 |
$field_info['description'] = 'description'; |
|
103 |
$field_info['modified_when'] = 'modified_when'; |
|
104 |
$field_info['modified_by'] = 'modified_by'; |
|
105 |
$field_info = serialize($field_info); |
|
106 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'news', '$field_info')"); |
|
107 |
// Query start |
|
108 |
$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title, [TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by FROM [TP]mod_news_posts, [TP]mod_news_groups, [TP]mod_news_comments, [TP]mod_news_settings, [TP]pages WHERE "; |
|
109 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'news')"); |
|
110 |
// Query body |
|
111 |
$query_body_code = " |
|
112 |
[TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.title LIKE \'%[STRING]%\' |
|
113 |
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_short LIKE \'%[STRING]%\' |
|
114 |
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_long LIKE \'%[STRING]%\' |
|
115 |
OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.title LIKE \'%[STRING]%\' |
|
116 |
OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.comment LIKE \'%[STRING]%\' |
|
117 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.header LIKE \'%[STRING]%\' |
|
118 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.footer LIKE \'%[STRING]%\' |
|
119 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_header LIKE \'%[STRING]%\' |
|
120 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_footer LIKE \'%[STRING]%\' |
|
121 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_header LIKE \'%[STRING]%\' |
|
122 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_footer LIKE \'%[STRING]%\'"; |
|
123 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'news')"); |
|
124 |
// Query end |
|
125 |
$query_end_code = ""; |
|
126 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'news')"); |
|
127 |
|
|
128 |
// Insert blank row (there needs to be at least on row for the search to work) |
|
129 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id) VALUES ('0', '0')"); |
|
130 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id) VALUES ('0', '0')"); |
|
131 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id) VALUES ('0', '0')"); |
|
132 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id) VALUES ('0', '0')"); |
|
133 |
|
|
96 |
$mod_search = "SELECT * FROM ".TABLE_PREFIX."search WHERE value = 'mod_wysiwyg_query'"; |
|
97 |
$database->query($mod_search); |
|
98 |
$insert_search = $database->is_error(); |
|
99 |
|
|
100 |
if( $insert_search ) |
|
101 |
{ |
|
102 |
// Insert info into the search table |
|
103 |
// Module query info |
|
104 |
$field_info = array(); |
|
105 |
$field_info['page_id'] = 'page_id'; |
|
106 |
$field_info['title'] = 'page_title'; |
|
107 |
$field_info['link'] = 'link'; |
|
108 |
$field_info['description'] = 'description'; |
|
109 |
$field_info['modified_when'] = 'modified_when'; |
|
110 |
$field_info['modified_by'] = 'modified_by'; |
|
111 |
$field_info = serialize($field_info); |
|
112 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'news', '$field_info')"); |
|
113 |
// Query start |
|
114 |
$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title, [TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by FROM [TP]mod_news_posts, [TP]mod_news_groups, [TP]mod_news_comments, [TP]mod_news_settings, [TP]pages WHERE "; |
|
115 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'news')"); |
|
116 |
// Query body |
|
117 |
$query_body_code = " |
|
118 |
[TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.title LIKE \'%[STRING]%\' |
|
119 |
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_short LIKE \'%[STRING]%\' |
|
120 |
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_long LIKE \'%[STRING]%\' |
|
121 |
OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.title LIKE \'%[STRING]%\' |
|
122 |
OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.comment LIKE \'%[STRING]%\' |
|
123 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.header LIKE \'%[STRING]%\' |
|
124 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.footer LIKE \'%[STRING]%\' |
|
125 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_header LIKE \'%[STRING]%\' |
|
126 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_footer LIKE \'%[STRING]%\' |
|
127 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_header LIKE \'%[STRING]%\' |
|
128 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_footer LIKE \'%[STRING]%\'"; |
|
129 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'news')"); |
|
130 |
// Query end |
|
131 |
$query_end_code = ""; |
|
132 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'news')"); |
|
133 |
|
|
134 |
// Insert blank row (there needs to be at least on row for the search to work) |
|
135 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id) VALUES ('0', '0')"); |
|
136 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id) VALUES ('0', '0')"); |
|
137 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id) VALUES ('0', '0')"); |
|
138 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id) VALUES ('0', '0')"); |
|
139 |
} |
|
140 |
|
|
134 | 141 |
// Make news post access files dir |
135 | 142 |
require_once(WB_PATH.'/framework/functions.php'); |
136 | 143 |
if(make_dir(WB_PATH.PAGES_DIRECTORY.'/posts')) { |
branches/2.8.x/wb/modules/news/rss.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
// Check that GET values have been supplied |
|
27 |
if(isset($_GET['page_id']) AND is_numeric($_GET['page_id'])) { |
|
28 |
$page_id = $_GET['page_id']; |
|
29 |
define('PAGE_ID', $page_id); |
|
30 |
} else { |
|
31 |
header('Location: '.WB_URL); |
|
32 |
exit(0); |
|
33 |
} |
|
34 |
if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) { |
|
35 |
$group_id = $_GET['group_id']; |
|
36 |
define('GROUP_ID', $group_id); |
|
37 |
} |
|
38 |
|
|
39 |
// Include WB files |
|
40 |
require_once('../../config.php'); |
|
41 |
require_once(WB_PATH.'/framework/class.frontend.php'); |
|
42 |
$database = new database(); |
|
43 |
$wb = new frontend(); |
|
44 |
$wb->page_id = $page_id; |
|
45 |
$wb->get_page_details(); |
|
46 |
$wb->get_website_settings(); |
|
47 |
|
|
48 |
//checkout if a charset is defined otherwise use UTF-8 |
|
49 |
if(defined('DEFAULT_CHARSET')) { |
|
50 |
$charset=DEFAULT_CHARSET; |
|
51 |
} else { |
|
52 |
$charset='utf-8'; |
|
53 |
} |
|
54 |
|
|
55 |
// Sending XML header |
|
56 |
header("Content-type: text/xml; charset=$charset" ); |
|
57 |
|
|
58 |
// Header info |
|
59 |
// Required by CSS 2.0 |
|
60 |
echo '<?xml version="1.0" encoding="'.$charset.'"?>'; |
|
61 |
?> |
|
62 |
<rss version="2.0"> |
|
63 |
<channel> |
|
64 |
<title><?php echo PAGE_TITLE; ?></title> |
|
65 |
<link>http://<?php echo $_SERVER['SERVER_NAME']; ?></link> |
|
66 |
<description> <?php echo PAGE_DESCRIPTION; ?></description> |
|
67 |
<?php |
|
68 |
// Optional header info |
|
69 |
?> |
|
70 |
<language><?php echo strtolower(DEFAULT_LANGUAGE); ?></language> |
|
71 |
<copyright><?php $thedate = date('Y'); $websitetitle = WEBSITE_TITLE; echo "Copyright {$thedate}, {$websitetitle}"; ?></copyright> |
|
72 |
<managingEditor><?php echo SERVER_EMAIL; ?></managingEditor> |
|
73 |
<webMaster><?php echo SERVER_EMAIL; ?></webMaster> |
|
74 |
<category><?php echo WEBSITE_TITLE; ?></category> |
|
75 |
<generator>Website Baker Content Management System</generator> |
|
76 |
|
|
77 |
<?php |
|
78 |
// Get news items from database |
|
79 |
$t = TIME(); |
|
80 |
$time_check_str= "(published_when = '0' OR published_when <= ".$t.") AND (published_until = 0 OR published_until >= ".$t.")"; |
|
81 |
//Query |
|
82 |
if(isset($group_id)) { |
|
83 |
$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id=".$group_id." AND page_id = ".$page_id." AND active=1 AND ".$time_check_str." ORDER BY posted_when DESC"; |
|
84 |
} else { |
|
85 |
$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 AND ".$time_check_str." ORDER BY posted_when DESC"; |
|
86 |
} |
|
87 |
$result = $database->query($query); |
|
88 |
|
|
89 |
//Generating the news items |
|
90 |
while($item = $result->fetchRow($result)){ ?> |
|
91 |
|
|
92 |
<item> |
|
93 |
<title><![CDATA[<?php echo stripslashes($item["title"]); ?>]]></title> |
|
94 |
<description><![CDATA[<?php echo stripslashes($item["content_short"]); ?>]]></description> |
|
95 |
<guid><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></guid> |
|
96 |
<link><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></link> |
|
97 |
</item> |
|
98 |
|
|
99 |
<?php } ?> |
|
100 |
|
|
101 |
</channel> |
|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
// Check that GET values have been supplied |
|
27 |
if(isset($_GET['page_id']) AND is_numeric($_GET['page_id'])) |
|
28 |
{ |
|
29 |
$page_id = $_GET['page_id']; |
|
30 |
define('PAGE_ID', $page_id); |
|
31 |
} |
|
32 |
else |
|
33 |
{ |
|
34 |
header('Location: '.WB_URL); |
|
35 |
exit( 0 ); |
|
36 |
} |
|
37 |
if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) { |
|
38 |
$group_id = $_GET['group_id']; |
|
39 |
define('GROUP_ID', $group_id); |
|
40 |
} |
|
41 |
|
|
42 |
// Include WB files |
|
43 |
require_once('../../config.php'); |
|
44 |
require_once(WB_PATH.'/framework/class.frontend.php'); |
|
45 |
$database = new database(); |
|
46 |
$wb = new frontend(); |
|
47 |
$wb->page_id = $page_id; |
|
48 |
$wb->get_page_details(); |
|
49 |
$wb->get_website_settings(); |
|
50 |
|
|
51 |
//checkout if a charset is defined otherwise use UTF-8 |
|
52 |
if(defined('DEFAULT_CHARSET')) { |
|
53 |
$charset=DEFAULT_CHARSET; |
|
54 |
} else { |
|
55 |
$charset='utf-8'; |
|
56 |
} |
|
57 |
|
|
58 |
// Sending XML header |
|
59 |
header("Content-type: text/xml; charset=$charset" ); |
|
60 |
|
|
61 |
// Header info |
|
62 |
// Required by CSS 2.0 |
|
63 |
echo '<?xml version="1.0" encoding="'.$charset.'"?>'; |
|
64 |
?> |
|
65 |
<rss version="2.0"> |
|
66 |
<channel> |
|
67 |
<title><?php echo PAGE_TITLE; ?></title> |
|
68 |
<link>http://<?php echo $_SERVER['SERVER_NAME']; ?></link> |
|
69 |
<description> <?php echo PAGE_DESCRIPTION; ?></description> |
|
70 |
<?php |
|
71 |
// Optional header info |
|
72 |
?> |
|
73 |
<language><?php echo strtolower(DEFAULT_LANGUAGE); ?></language> |
|
74 |
<copyright><?php $thedate = date('Y'); $websitetitle = WEBSITE_TITLE; echo "Copyright {$thedate}, {$websitetitle}"; ?></copyright> |
|
75 |
<managingEditor><?php echo SERVER_EMAIL; ?></managingEditor> |
|
76 |
<webMaster><?php echo SERVER_EMAIL; ?></webMaster> |
|
77 |
<category><?php echo WEBSITE_TITLE; ?></category> |
|
78 |
<generator>Website Baker Content Management System</generator> |
|
79 |
|
|
80 |
<?php |
|
81 |
// Get news items from database |
|
82 |
$t = TIME(); |
|
83 |
$time_check_str= "(published_when = '0' OR published_when <= ".$t.") AND (published_until = 0 OR published_until >= ".$t.")"; |
|
84 |
//Query |
|
85 |
if(isset($group_id)) { |
|
86 |
$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id=".$group_id." AND page_id = ".$page_id." AND active=1 AND ".$time_check_str." ORDER BY posted_when DESC"; |
|
87 |
} else { |
|
88 |
$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 AND ".$time_check_str." ORDER BY posted_when DESC"; |
|
89 |
} |
|
90 |
$result = $database->query($query); |
|
91 |
|
|
92 |
//Generating the news items |
|
93 |
while($item = $result->fetchRow($result)){ ?> |
|
94 |
|
|
95 |
<item> |
|
96 |
<title><![CDATA[<?php echo stripslashes($item["title"]); ?>]]></title> |
|
97 |
<description><![CDATA[<?php echo stripslashes($item["content_short"]); ?>]]></description> |
|
98 |
<guid><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></guid> |
|
99 |
<link><?php echo WB_URL.PAGES_DIRECTORY.$item["link"].PAGE_EXTENSION; ?></link> |
|
100 |
</item> |
|
101 |
|
|
102 |
<?php } ?> |
|
103 |
|
|
104 |
</channel> |
|
102 | 105 |
</rss> |
branches/2.8.x/wb/modules/news/modify_settings.php | ||
---|---|---|
61 | 61 |
// include the button to edit the optional module CSS files (function added with WB 2.7) |
62 | 62 |
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css") |
63 | 63 |
// Place this call outside of any <form></form> construct!!! |
64 |
if(function_exists('edit_module_css')) { |
|
64 |
if(function_exists('edit_module_css')) |
|
65 |
{ |
|
65 | 66 |
edit_module_css('news'); |
66 | 67 |
} |
67 | 68 |
?> |
68 | 69 |
|
69 | 70 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_settings.php" method="post" style="margin: 0;"> |
70 | 71 |
|
71 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
|
72 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
|
72 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
|
|
73 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
|
|
73 | 74 |
|
74 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
|
|
75 |
<table class="row_a" cellpadding="2" cellspacing="0" width="100%"> |
|
75 | 76 |
<tr> |
76 | 77 |
<td colspan="2"><strong><?php echo $HEADING['GENERAL_SETTINGS']; ?></strong></td> |
78 |
</tr> |
|
77 | 79 |
<tr> |
78 | 80 |
<td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td> |
79 | 81 |
<td class="setting_value"> |
... | ... | |
111 | 113 |
<option value=""><?php echo $TEXT['UNLIMITED']; ?></option> |
112 | 114 |
<?php |
113 | 115 |
for($i = 1; $i <= 20; $i++) { |
114 |
if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected'; } else { $selected = ''; } |
|
116 |
if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected="selected"'; } else { $selected = ''; }
|
|
115 | 117 |
echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>'; |
116 | 118 |
} |
117 | 119 |
?> |
... | ... | |
119 | 121 |
</td> |
120 | 122 |
</tr> |
121 | 123 |
</table> |
122 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%" style="margin-top: 3px;">
|
|
124 |
<table class="row_a" cellpadding="2" cellspacing="0" width="100%" style="margin-top: 3px;"> |
|
123 | 125 |
<tr> |
124 | 126 |
<td colspan="2"><strong><?php echo $TEXT['COMMENTS']; ?></strong></td> |
125 | 127 |
</tr> |
... | ... | |
128 | 130 |
<td class="setting_value"> |
129 | 131 |
<select name="commenting" style="width: 98%;"> |
130 | 132 |
<option value="none"><?php echo $TEXT['DISABLED']; ?></option> |
131 |
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
|
|
132 |
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option> |
|
133 |
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
|
|
134 |
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
|
|
133 | 135 |
</select> |
134 | 136 |
</td> |
135 | 137 |
</tr> |
... | ... | |
155 | 157 |
$SIZES['125'] = '125x125px'; |
156 | 158 |
$SIZES['150'] = '150x150px'; |
157 | 159 |
foreach($SIZES AS $size => $size_name) { |
158 |
if($fetch_content['resize'] == $size) { $selected = ' selected'; } else { $selected = ''; } |
|
160 |
if($fetch_content['resize'] == $size) { $selected = ' selected="selected"'; } else { $selected = ''; }
|
|
159 | 161 |
echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>'; |
160 | 162 |
} |
161 | 163 |
?> |
branches/2.8.x/wb/modules/news/modify_comment.php | ||
---|---|---|
46 | 46 |
|
47 | 47 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_comment.php" method="post" style="margin: 0;"> |
48 | 48 |
|
49 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
|
50 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
|
51 |
<input type="hidden" name="post_id" value="<?php echo $fetch_content['post_id']; ?>"> |
|
52 |
<input type="hidden" name="comment_id" value="<?php echo $comment_id; ?>"> |
|
49 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
|
|
50 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
|
|
51 |
<input type="hidden" name="post_id" value="<?php echo $fetch_content['post_id']; ?>" />
|
|
52 |
<input type="hidden" name="comment_id" value="<?php echo $comment_id; ?>" />
|
|
53 | 53 |
|
54 | 54 |
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%"> |
55 | 55 |
<tr> |
... | ... | |
69 | 69 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
70 | 70 |
<tr> |
71 | 71 |
<td align="left"> |
72 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>
|
|
72 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
|
|
73 | 73 |
</td> |
74 | 74 |
<td align="right"> |
75 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/news/modify_post.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section_id; ?>&post_id=<?php echo $fetch_content['post_id']; ?>';" style="width: 100px; margin-top: 5px;" />
|
|
75 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?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 $fetch_content['post_id']; ?>';" style="width: 100px; margin-top: 5px;" />
|
|
76 | 76 |
</td> |
77 | 77 |
</tr> |
78 | 78 |
</table> |
79 |
</form> |
|
79 | 80 |
|
80 |
|
|
81 | 81 |
<?php |
82 | 82 |
|
83 | 83 |
// Print admin footer |
branches/2.8.x/wb/modules/news/move_up.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
if(!isset($_GET['group_id']) OR !is_numeric($_GET['group_id'])) { |
|
31 |
header("Location: index.php"); |
|
32 |
exit(0); |
|
33 |
} else { |
|
34 |
$id = $_GET['group_id']; |
|
35 |
$id_field = 'group_id'; |
|
36 |
$table = TABLE_PREFIX.'mod_news_groups'; |
|
37 |
} |
|
38 |
} else { |
|
39 |
$id = $_GET['post_id']; |
|
40 |
$id_field = 'post_id'; |
|
41 |
$table = TABLE_PREFIX.'mod_news_posts'; |
|
42 |
} |
|
43 |
|
|
44 |
// Include WB admin wrapper script |
|
45 |
require(WB_PATH.'/modules/admin.php'); |
|
46 |
|
|
47 |
// Include the ordering class |
|
48 |
require(WB_PATH.'/framework/class.order.php'); |
|
49 |
|
|
50 |
// Create new order object an reorder |
|
51 |
$order = new order($table, 'position', $id_field, 'section_id'); |
|
52 |
if($order->move_up($id)) { |
|
53 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
54 |
} else { |
|
55 |
$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
56 |
} |
|
57 |
|
|
58 |
// Print admin footer |
|
59 |
$admin->print_footer(); |
|
60 |
|
|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
if(!isset($_GET['group_id']) OR !is_numeric($_GET['group_id'])) { |
|
31 |
|
|
32 |
header("Location: index.php"); |
|
33 |
exit( 0 ); |
|
34 |
} else { |
|
35 |
$id = $_GET['group_id']; |
|
36 |
$id_field = 'group_id'; |
|
37 |
$table = TABLE_PREFIX.'mod_news_groups'; |
|
38 |
} |
|
39 |
} else { |
|
40 |
$id = $_GET['post_id']; |
|
41 |
$id_field = 'post_id'; |
|
42 |
$table = TABLE_PREFIX.'mod_news_posts'; |
|
43 |
} |
|
44 |
|
|
45 |
// Include WB admin wrapper script |
|
46 |
require(WB_PATH.'/modules/admin.php'); |
|
47 |
|
|
48 |
// Include the ordering class |
|
49 |
require(WB_PATH.'/framework/class.order.php'); |
|
50 |
|
|
51 |
// Create new order object an reorder |
|
52 |
$order = new order($table, 'position', $id_field, 'section_id'); |
|
53 |
if($order->move_up($id)) { |
|
54 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
55 |
} else { |
|
56 |
$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
57 |
} |
|
58 |
|
|
59 |
// Print admin footer |
|
60 |
$admin->print_footer(); |
|
61 |
|
Also available in: Unified diff
Ticket #770, #785, #792, #807, #809, fixes and recoded the news module