Revision 1425
Added by Dietmar almost 14 years ago
comment.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* |
|
4 |
* @category modules |
|
5 |
* @package news |
|
6 |
* @author WebsiteBaker Project |
|
7 |
* @copyright 2004-2009, Ryan Djurovich |
|
8 |
* @copyright 2009-2011, 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 5.2.2 and higher |
|
13 |
* @version $Id$ |
|
14 |
* @filesource $HeadURL$ |
|
15 |
* @lastmodified $Date$ |
|
16 |
* |
|
17 |
*/ |
|
18 |
|
|
19 |
// Include config file |
|
20 |
require('../../config.php'); |
|
21 |
require_once(WB_PATH.'/framework/class.wb.php'); |
|
22 |
$wb = new wb; |
|
23 |
|
|
24 |
// Check if there is a post id |
|
25 |
$post_id = $wb->checkIDKEY('post_id', false, 'GET'); |
|
26 |
if (!$post_id OR !isset($_GET['section_id']) OR !is_numeric($_GET['section_id'])) { |
|
27 |
$wb->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL); |
|
28 |
exit(); |
|
29 |
} |
|
30 |
$section_id = $_GET['section_id']; |
|
31 |
|
|
32 |
// Query post for page id |
|
33 |
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'"); |
|
34 |
if($query_post->numRows() == 0) |
|
35 |
{ |
|
36 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
37 |
exit( 0 ); |
|
38 |
} |
|
39 |
else |
|
40 |
{ |
|
41 |
$fetch_post = $query_post->fetchRow(); |
|
42 |
$page_id = $fetch_post['page_id']; |
|
43 |
$section_id = $fetch_post['section_id']; |
|
44 |
$post_id = $fetch_post['post_id']; |
|
45 |
$post_title = $fetch_post['title']; |
|
46 |
define('SECTION_ID', $section_id); |
|
47 |
define('POST_ID', $post_id); |
|
48 |
define('POST_TITLE', $post_title); |
|
49 |
|
|
50 |
// don't allow commenting if its disabled, or if post or group is inactive |
|
51 |
$t = time(); |
|
52 |
$table_posts = TABLE_PREFIX."mod_news_posts"; |
|
53 |
$table_groups = TABLE_PREFIX."mod_news_groups"; |
|
54 |
$query = $database->query(" |
|
55 |
SELECT p.post_id |
|
56 |
FROM $table_posts AS p LEFT OUTER JOIN $table_groups AS g ON p.group_id = g.group_id |
|
57 |
WHERE p.post_id='$post_id' AND p.commenting != 'none' AND p.active = '1' AND ( g.active IS NULL OR g.active = '1' ) |
|
58 |
AND (p.published_when = '0' OR p.published_when <= $t) AND (p.published_until = 0 OR p.published_until >= $t) |
|
59 |
"); |
|
60 |
if($query->numRows() == 0) |
|
61 |
{ |
|
62 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
63 |
exit( 0 ); |
|
64 |
} |
|
65 |
|
|
66 |
// don't allow commenting if ASP enabled and user doesn't comes from the right view.php |
|
67 |
if(ENABLED_ASP && (!isset($_SESSION['comes_from_view']) OR $_SESSION['comes_from_view']!=POST_ID)) |
|
68 |
{ |
|
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 |
{ |
|
77 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
78 |
exit( 0 ); |
|
79 |
} |
|
80 |
else |
|
81 |
{ |
|
82 |
$page = $query_page->fetchRow(); |
|
83 |
// Required page details |
|
84 |
define('PAGE_CONTENT', WB_PATH.'/modules/news/comment_page.php'); |
|
85 |
// Include index (wrapper) file |
|
86 |
require(WB_PATH.'/index.php'); |
|
87 |
} |
|
88 |
} |
|
89 |
|
|
1 |
<?php |
|
2 |
/** |
|
3 |
* |
|
4 |
* @category modules |
|
5 |
* @package news |
|
6 |
* @author WebsiteBaker Project |
|
7 |
* @copyright 2004-2009, Ryan Djurovich |
|
8 |
* @copyright 2009-2011, 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 5.2.2 and higher |
|
13 |
* @version $Id$ |
|
14 |
* @filesource $HeadURL$ |
|
15 |
* @lastmodified $Date$ |
|
16 |
* |
|
17 |
*/ |
|
18 |
|
|
19 |
// Include config file |
|
20 |
require('../../config.php'); |
|
21 |
require_once(WB_PATH.'/framework/class.wb.php'); |
|
22 |
$wb = new wb; |
|
23 |
|
|
24 |
// Check if there is a post id |
|
25 |
// $post_id = $wb->checkIDKEY('post_id', false, 'GET'); |
|
26 |
|
|
27 |
$post_id = (int)$_GET['post_id']; |
|
28 |
$section_id = (int)$_GET['section_id']; |
|
29 |
|
|
30 |
if (!$post_id OR !isset($_GET['section_id']) OR !is_numeric($_GET['section_id'])) { |
|
31 |
$wb->print_error('ABORT::'.$MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL.PAGES_DIRECTORY ); |
|
32 |
exit(); |
|
33 |
} |
|
34 |
|
|
35 |
// Query post for page id |
|
36 |
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'"); |
|
37 |
if($query_post->numRows() == 0) |
|
38 |
{ |
|
39 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
40 |
exit( 0 ); |
|
41 |
} |
|
42 |
else |
|
43 |
{ |
|
44 |
$fetch_post = $query_post->fetchRow(); |
|
45 |
$page_id = $fetch_post['page_id']; |
|
46 |
$section_id = $fetch_post['section_id']; |
|
47 |
$post_id = $fetch_post['post_id']; |
|
48 |
$post_title = $fetch_post['title']; |
|
49 |
define('SECTION_ID', $section_id); |
|
50 |
define('POST_ID', $post_id); |
|
51 |
define('POST_TITLE', $post_title); |
|
52 |
|
|
53 |
// don't allow commenting if its disabled, or if post or group is inactive |
|
54 |
$t = time(); |
|
55 |
$table_posts = TABLE_PREFIX."mod_news_posts"; |
|
56 |
$table_groups = TABLE_PREFIX."mod_news_groups"; |
|
57 |
$query = $database->query(" |
|
58 |
SELECT p.post_id |
|
59 |
FROM $table_posts AS p LEFT OUTER JOIN $table_groups AS g ON p.group_id = g.group_id |
|
60 |
WHERE p.post_id='$post_id' AND p.commenting != 'none' AND p.active = '1' AND ( g.active IS NULL OR g.active = '1' ) |
|
61 |
AND (p.published_when = '0' OR p.published_when <= $t) AND (p.published_until = 0 OR p.published_until >= $t) |
|
62 |
"); |
|
63 |
if($query->numRows() == 0) |
|
64 |
{ |
|
65 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
66 |
exit( 0 ); |
|
67 |
} |
|
68 |
|
|
69 |
// don't allow commenting if ASP enabled and user doesn't comes from the right view.php |
|
70 |
if(ENABLED_ASP && (!isset($_SESSION['comes_from_view']) OR $_SESSION['comes_from_view']!=POST_ID)) |
|
71 |
{ |
|
72 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
73 |
exit( 0 ); |
|
74 |
} |
|
75 |
|
|
76 |
// Get page details |
|
77 |
$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
78 |
if($query_page->numRows() == 0) |
|
79 |
{ |
|
80 |
header("Location: ".WB_URL.PAGES_DIRECTORY.""); |
|
81 |
exit( 0 ); |
|
82 |
} |
|
83 |
else |
|
84 |
{ |
|
85 |
$page = $query_page->fetchRow(); |
|
86 |
// Required page details |
|
87 |
define('PAGE_CONTENT', WB_PATH.'/modules/news/comment_page.php'); |
|
88 |
// Include index (wrapper) file |
|
89 |
require(WB_PATH.'/index.php'); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
90 | 93 |
?> |
Also available in: Unified diff
redefined wrong admin backlinks