Revision 1157
Added by Dietmar about 15 years ago
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 |
?> |
Also available in: Unified diff
Ticket #770, #785, #792, #807, #809, fixes and recoded the news module