Revision 84
Added by ryan about 19 years ago
trunk/wb/modules/news/uninstall.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id: uninstall.php,v 1.3 2005/04/25 11:53:12 rdjurovich Exp $ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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 |
$database->query("DELETE FROM ".TABLE_PREFIX."search WHERE name = 'module' AND value = 'news'"); |
|
30 |
$database->query("DELETE FROM ".TABLE_PREFIX."search WHERE extra = 'news'"); |
|
31 |
$database->query("DROP TABLE ".TABLE_PREFIX."mod_news_posts"); |
|
32 |
$database->query("DROP TABLE ".TABLE_PREFIX."mod_news_groups"); |
|
33 |
$database->query("DROP TABLE ".TABLE_PREFIX."mod_news_comments"); |
|
34 |
$database->query("DROP TABLE ".TABLE_PREFIX."mod_news_settings"); |
|
35 |
require(WB_PATH.'/framework/functions.php'); |
|
36 |
rm_full_dir(WB_PATH.PAGES_DIRECTORY.'/posts'); |
|
37 |
|
|
38 |
?> |
|
39 | 0 |
trunk/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-2005, 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($_POST['post_id']) OR !is_numeric($_POST['post_id'])) { |
|
30 |
header("Location: ".ADMIN_URL."/pages/index.php"); |
|
31 |
} else { |
|
32 |
$id = $_POST['post_id']; |
|
33 |
$post_id = $id; |
|
34 |
} |
|
35 |
|
|
36 |
// Include WB admin wrapper script |
|
37 |
$update_when_modified = true; // Tells script to update when this page was last updated |
|
38 |
require(WB_PATH.'/modules/admin.php'); |
|
39 |
|
|
40 |
// Validate all fields |
|
41 |
if($admin->get_post('title') == '' AND $admin->get_post('url') == '') { |
|
42 |
$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); |
|
43 |
} else { |
|
44 |
$title = $admin->add_slashes($admin->get_post('title')); |
|
45 |
$short = $admin->add_slashes($admin->get_post('short')); |
|
46 |
$long = $admin->add_slashes($admin->get_post('long')); |
|
47 |
$commenting = $admin->get_post('commenting'); |
|
48 |
$active = $admin->get_post('active'); |
|
49 |
$old_link = $admin->get_post('link'); |
|
50 |
$group_id = $admin->get_post('group'); |
|
51 |
} |
|
52 |
|
|
53 |
// Get page link URL |
|
54 |
$query_page = $database->query("SELECT level,link FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
55 |
$page = $query_page->fetchRow(); |
|
56 |
$page_level = $page['level']; |
|
57 |
$page_link = $page['link']; |
|
58 |
|
|
59 |
// Include WB functions file |
|
60 |
require(WB_PATH.'/framework/functions.php'); |
|
61 |
|
|
62 |
// Work-out what the link should be |
|
63 |
$post_link = '/posts/'.page_filename($title).$post_id; |
|
64 |
|
|
65 |
// Make sure the post link is set and exists |
|
66 |
// Make news post access files dir |
|
67 |
make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/'); |
|
68 |
if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/posts/')) { |
|
69 |
$admin->print_error($MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE']); |
|
70 |
} elseif($old_link != $post_link OR !file_exists(WB_PATH.PAGES_DIRECTORY.$post_link.'.php')) { |
|
71 |
// We need to create a new file |
|
72 |
// First, delete old file if it exists |
|
73 |
if(file_exists(WB_PATH.$old_link.'.php')) { |
|
74 |
unlink(WB_PATH.$old_link.'.php'); |
|
75 |
} |
|
76 |
// Specify the filename |
|
77 |
$filename = WB_PATH.PAGES_DIRECTORY.'/'.$post_link.'.php'; |
|
78 |
// The depth of the page directory in the directory hierarchy |
|
79 |
// '/pages' is at depth 1 |
|
80 |
$pages_dir_depth=count(explode('/',PAGES_DIRECTORY))-1; |
|
81 |
// Work-out how many ../'s we need to get to the index page |
|
82 |
$index_location = '../'; |
|
83 |
for($i = 0; $i < $pages_dir_depth; $i++) { |
|
84 |
$index_location .= '../'; |
|
85 |
} |
|
86 |
// Write to the filename |
|
87 |
$content = ''. |
|
88 |
'<?php |
|
89 |
$page_id = '.$page_id.'; |
|
90 |
$section_id = '.$section_id.'; |
|
91 |
$post_id = '.$post_id.'; |
|
92 |
define("POST_ID", $post_id); |
|
93 |
require("'.$index_location.'config.php"); |
|
94 |
require(WB_PATH."/index.php"); |
|
95 |
?>'; |
|
96 |
$handle = fopen($filename, 'w'); |
|
97 |
fwrite($handle, $content); |
|
98 |
fclose($handle); |
|
99 |
change_mode($filename); |
|
100 |
} |
|
101 |
|
|
102 |
// Update row |
|
103 |
$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', posted_when = '".mktime()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'"); |
|
104 |
|
|
105 |
// Check if there is a db error, otherwise say successful |
|
106 |
if($database->is_error()) { |
|
107 |
$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_post.php?page_id='.$page_id.'§ion_id='.$section_id.'&post_id='.$id); |
|
108 |
} else { |
|
109 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
110 |
} |
|
111 |
|
|
112 |
// Print admin footer |
|
113 |
$admin->print_footer(); |
|
114 |
|
|
115 |
?> |
|
116 | 0 |
trunk/wb/modules/news/comment.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id: comment.php,v 1.2 2005/04/02 06:25:56 rdjurovich Exp $ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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'])) { |
|
31 |
if(!isset($_POST['post_id']) OR !is_numeric($_POST['post_id'])) { |
|
32 |
header('Location: '.WB_URL.'/pages/'); |
|
33 |
} else { |
|
34 |
$post_id = $_POST['post_id']; |
|
35 |
} |
|
36 |
} else { |
|
37 |
$post_id = $_GET['id']; |
|
38 |
} |
|
39 |
|
|
40 |
// Include database class |
|
41 |
require_once(WB_PATH.'/framework/class.database.php'); |
|
42 |
$database = new database(); |
|
43 |
|
|
44 |
// Query post for page id |
|
45 |
$query_post = $database->query("SELECT post_id,title,section_id,page_id FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'"); |
|
46 |
if($query_post->numRows() == 0) { |
|
47 |
header('Location: '.WB_URL.'/pages/'); |
|
48 |
} else { |
|
49 |
$fetch_post = $query_post->fetchRow(); |
|
50 |
$page_id = $fetch_post['page_id']; |
|
51 |
$section_id = $fetch_post['section_id']; |
|
52 |
$post_id = $fetch_post['post_id']; |
|
53 |
$post_title = $fetch_post['title']; |
|
54 |
define('SECTION_ID', $section_id); |
|
55 |
define('POST_ID', $post_id); |
|
56 |
define('POST_TITLE', $post_title); |
|
57 |
// Get page details |
|
58 |
$query_page = $database->query("SELECT parent,page_title,menu_title,keywords,description,visibility FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
59 |
if($query_page->numRows() == 0) { |
|
60 |
header('Location: '.WB_URL.'/pages/'); |
|
61 |
} else { |
|
62 |
$page = $query_page->fetchRow(); |
|
63 |
// Required page details |
|
64 |
define('PAGE_CONTENT', WB_PATH.'/modules/news/comment_page.php'); |
|
65 |
// Include index (wrapper) file |
|
66 |
require(WB_PATH.'/index.php'); |
|
67 |
} |
|
68 |
} |
|
69 |
|
|
70 |
|
|
71 |
?> |
|
72 | 0 |
trunk/wb/modules/news/install.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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 |
if(defined('WB_URL')) { |
|
27 |
|
|
28 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_posts`"); |
|
29 |
$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_posts` ( ' |
|
30 |
. '`post_id` INT NOT NULL AUTO_INCREMENT,' |
|
31 |
. '`section_id` INT NOT NULL,' |
|
32 |
. '`page_id` INT NOT NULL,' |
|
33 |
. '`group_id` INT NOT NULL,' |
|
34 |
. '`active` INT NOT NULL,' |
|
35 |
. '`position` INT NOT NULL,' |
|
36 |
. '`title` VARCHAR(255) NOT NULL,' |
|
37 |
. '`link` TEXT NOT NULL,' |
|
38 |
. '`content_short` TEXT NOT NULL,' |
|
39 |
. '`content_long` TEXT NOT NULL,' |
|
40 |
. '`commenting` VARCHAR(7) NOT NULL,' |
|
41 |
. '`posted_when` INT NOT NULL ,' |
|
42 |
. '`posted_by` INT NOT NULL ,' |
|
43 |
. 'PRIMARY KEY (post_id)' |
|
44 |
. ' )'; |
|
45 |
$database->query($mod_news); |
|
46 |
|
|
47 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_groups`"); |
|
48 |
$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_groups` ( ' |
|
49 |
. '`group_id` INT NOT NULL AUTO_INCREMENT,' |
|
50 |
. '`section_id` INT NOT NULL,' |
|
51 |
. '`page_id` INT NOT NULL,' |
|
52 |
. '`active` INT NOT NULL,' |
|
53 |
. '`position` INT NOT NULL,' |
|
54 |
. '`title` VARCHAR(255) NOT NULL,' |
|
55 |
. 'PRIMARY KEY (group_id)' |
|
56 |
. ' )'; |
|
57 |
$database->query($mod_news); |
|
58 |
|
|
59 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_comments`"); |
|
60 |
$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_comments` ( ' |
|
61 |
. '`comment_id` INT NOT NULL AUTO_INCREMENT,' |
|
62 |
. '`section_id` INT NOT NULL,' |
|
63 |
. '`page_id` INT NOT NULL,' |
|
64 |
. '`post_id` INT NOT NULL,' |
|
65 |
. '`title` VARCHAR(255) NOT NULL,' |
|
66 |
. '`comment` TEXT NOT NULL,' |
|
67 |
. '`commented_when` INT NOT NULL ,' |
|
68 |
. '`commented_by` INT NOT NULL ,' |
|
69 |
. 'PRIMARY KEY (comment_id)' |
|
70 |
. ' )'; |
|
71 |
$database->query($mod_news); |
|
72 |
|
|
73 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_news_settings`"); |
|
74 |
$mod_news = 'CREATE TABLE `'.TABLE_PREFIX.'mod_news_settings` ( ' |
|
75 |
. '`section_id` INT NOT NULL,' |
|
76 |
. '`page_id` INT NOT NULL,' |
|
77 |
. '`header` TEXT NOT NULL,' |
|
78 |
. '`post_loop` TEXT NOT NULL,' |
|
79 |
. '`footer` TEXT NOT NULL,' |
|
80 |
. '`posts_per_page` INT NOT NULL,' |
|
81 |
. '`post_header` TEXT NOT NULL,' |
|
82 |
. '`post_footer` TEXT NOT NULL,' |
|
83 |
. '`comments_header` TEXT NOT NULL,' |
|
84 |
. '`comments_loop` TEXT NOT NULL,' |
|
85 |
. '`comments_footer` TEXT NOT NULL,' |
|
86 |
. '`comments_page` TEXT NOT NULL,' |
|
87 |
. '`commenting` VARCHAR(7) NOT NULL,' |
|
88 |
. '`resize` INT NOT NULL,' |
|
89 |
. 'PRIMARY KEY (section_id)' |
|
90 |
. ' )'; |
|
91 |
$database->query($mod_news); |
|
92 |
|
|
93 |
// Insert info into the search table |
|
94 |
// Module query info |
|
95 |
$field_info = array(); |
|
96 |
$field_info['page_id'] = 'page_id'; |
|
97 |
$field_info['title'] = 'page_title'; |
|
98 |
$field_info['link'] = 'link'; |
|
99 |
$field_info['description'] = 'description'; |
|
100 |
$field_info['modified_when'] = 'modified_when'; |
|
101 |
$field_info['modified_by'] = 'modified_by'; |
|
102 |
$field_info = serialize($field_info); |
|
103 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'news', '$field_info')"); |
|
104 |
// Query start |
|
105 |
$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 "; |
|
106 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'news')"); |
|
107 |
// Query body |
|
108 |
$query_body_code = " |
|
109 |
[TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.title LIKE \'%[STRING]%\' |
|
110 |
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_short LIKE \'%[STRING]%\' |
|
111 |
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_long LIKE \'%[STRING]%\' |
|
112 |
OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.title LIKE \'%[STRING]%\' |
|
113 |
OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.comment LIKE \'%[STRING]%\' |
|
114 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.header LIKE \'%[STRING]%\' |
|
115 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.footer LIKE \'%[STRING]%\' |
|
116 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_header LIKE \'%[STRING]%\' |
|
117 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_footer LIKE \'%[STRING]%\' |
|
118 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_header LIKE \'%[STRING]%\' |
|
119 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_footer LIKE \'%[STRING]%\' |
|
120 |
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_footer LIKE \'%[STRING]%\'"; |
|
121 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'news')"); |
|
122 |
// Query end |
|
123 |
$query_end_code = ""; |
|
124 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'news')"); |
|
125 |
|
|
126 |
// Insert blank row (there needs to be at least on row for the search to work) |
|
127 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id) VALUES ('0', '0')"); |
|
128 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id) VALUES ('0', '0')"); |
|
129 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id) VALUES ('0', '0')"); |
|
130 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id) VALUES ('0', '0')"); |
|
131 |
|
|
132 |
// Make news post access files dir |
|
133 |
make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/'); - |
|
134 |
} |
|
135 |
|
|
136 |
?> |
|
137 | 0 |
trunk/wb/modules/news/modify_settings.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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 |
// Include WB admin wrapper script |
|
29 |
require(WB_PATH.'/modules/admin.php'); |
|
30 |
|
|
31 |
// Get header and footer |
|
32 |
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'"); |
|
33 |
$fetch_content = $query_content->fetchRow(); |
|
34 |
|
|
35 |
// Set raw html <'s and >'s to be replace by friendly html code |
|
36 |
$raw = array('<', '>'); |
|
37 |
$friendly = array('<', '>'); |
|
38 |
|
|
39 |
?> |
|
40 |
|
|
41 |
<style type="text/css"> |
|
42 |
.setting_name { |
|
43 |
vertical-align: top; |
|
44 |
} |
|
45 |
</style> |
|
46 |
|
|
47 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_settings.php" method="post" style="margin: 0;"> |
|
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 |
|
|
52 |
<table cellpadding="2" cellspacing="0" border="0" width="100%"> |
|
53 |
<tr> |
|
54 |
<td class="setting_name" width="100"><?php echo $TEXT['HEADER']; ?>:</td> |
|
55 |
<td class="setting_name"> |
|
56 |
<textarea name="header" style="width: 100%; height: 80px;"><?php echo $admin->strip_slashes_dummy($fetch_content['header']); ?></textarea> |
|
57 |
</td> |
|
58 |
</tr> |
|
59 |
<tr> |
|
60 |
<td class="setting_name"><?php echo $TEXT['POST'].' '.$TEXT['LOOP']; ?>:</td> |
|
61 |
<td class="setting_name"> |
|
62 |
<textarea name="post_loop" style="width: 100%; height: 60px;"><?php echo $admin->strip_slashes_dummy($fetch_content['post_loop']); ?></textarea> |
|
63 |
</td> |
|
64 |
</tr> |
|
65 |
<tr> |
|
66 |
<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td> |
|
67 |
<td class="setting_name"> |
|
68 |
<textarea name="footer" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($fetch_content['footer'])); ?></textarea> |
|
69 |
</td> |
|
70 |
</tr> |
|
71 |
<tr> |
|
72 |
<td class="setting_name"><?php echo $TEXT['POST_HEADER']; ?>:</td> |
|
73 |
<td class="setting_name"> |
|
74 |
<textarea name="post_header" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($fetch_content['post_header'])); ?></textarea> |
|
75 |
</td> |
|
76 |
</tr> |
|
77 |
<tr> |
|
78 |
<td class="setting_name"><?php echo $TEXT['POST_FOOTER']; ?>:</td> |
|
79 |
<td class="setting_name"> |
|
80 |
<textarea name="post_footer" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($fetch_content['post_footer'])); ?></textarea> |
|
81 |
</td> |
|
82 |
</tr> |
|
83 |
<tr> |
|
84 |
<td class="setting_name"><?php echo $TEXT['POSTS_PER_PAGE']; ?>:</td> |
|
85 |
<td class="setting_name"> |
|
86 |
<select name="posts_per_page" style="width: 100%;"> |
|
87 |
<option value=""><?php echo $TEXT['UNLIMITED']; ?></option> |
|
88 |
<?php |
|
89 |
for($i = 1; $i <= 20; $i++) { |
|
90 |
if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected'; } else { $selected = ''; } |
|
91 |
echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>'; |
|
92 |
} |
|
93 |
?> |
|
94 |
</select> |
|
95 |
</td> |
|
96 |
</tr> |
|
97 |
<tr> |
|
98 |
<td><?php echo $TEXT['COMMENTING']; ?>:</td> |
|
99 |
<td> |
|
100 |
<select name="commenting" style="width: 100%;"> |
|
101 |
<option value="none"><?php echo $TEXT['DISABLED']; ?></option> |
|
102 |
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option> |
|
103 |
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option> |
|
104 |
</select> |
|
105 |
</td> |
|
106 |
</tr> |
|
107 |
<?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?> |
|
108 |
<tr> |
|
109 |
<td> |
|
110 |
<?php echo $TEXT['RESIZE_IMAGE_TO']; ?>: |
|
111 |
</td> |
|
112 |
<td> |
|
113 |
<select name="resize" style="width: 100%;"> |
|
114 |
<option value=""><?php echo $TEXT['NONE']; ?></option> |
|
115 |
<?php |
|
116 |
$SIZES['50'] = '50x50px'; |
|
117 |
$SIZES['75'] = '75x75px'; |
|
118 |
$SIZES['100'] = '100x100px'; |
|
119 |
$SIZES['125'] = '125x125px'; |
|
120 |
$SIZES['150'] = '150x150px'; |
|
121 |
foreach($SIZES AS $size => $size_name) { |
|
122 |
if($fetch_content['resize'] == $size) { $selected = ' selected'; } else { $selected = ''; } |
|
123 |
echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>'; |
|
124 |
} |
|
125 |
?> |
|
126 |
</select> |
|
127 |
</td> |
|
128 |
</tr> |
|
129 |
<?php } ?> |
|
130 |
<tr> |
|
131 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td> |
|
132 |
<td class="setting_name"> |
|
133 |
<textarea name="comments_header" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($fetch_content['comments_header'])); ?></textarea> |
|
134 |
</td> |
|
135 |
</tr> |
|
136 |
<tr> |
|
137 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td> |
|
138 |
<td class="setting_name"> |
|
139 |
<textarea name="comments_loop" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($fetch_content['comments_loop'])); ?></textarea> |
|
140 |
</td> |
|
141 |
</tr> |
|
142 |
<tr> |
|
143 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td> |
|
144 |
<td class="setting_name"> |
|
145 |
<textarea name="comments_footer" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($fetch_content['comments_footer'])); ?></textarea> |
|
146 |
</td> |
|
147 |
</tr> |
|
148 |
<tr> |
|
149 |
<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td> |
|
150 |
<td class="setting_name"> |
|
151 |
<textarea name="comments_page" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($fetch_content['comments_page'])); ?></textarea> |
|
152 |
</td> |
|
153 |
</tr> |
|
154 |
</table> |
|
155 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
156 |
<tr> |
|
157 |
<td width="105"> </td> |
|
158 |
<td align="left"> |
|
159 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE'].' '.$TEXT['SETTINGS']; ?>" style="width: 200px; margin-top: 5px;"></form> |
|
160 |
</td> |
|
161 |
<td align="right"> |
|
162 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
|
163 |
</td> |
|
164 |
</tr> |
|
165 |
</table> |
|
166 |
|
|
167 |
|
|
168 |
<?php |
|
169 |
|
|
170 |
// Print admin footer |
|
171 |
$admin->print_footer(); |
|
172 |
|
|
173 |
?> |
|
174 | 0 |
trunk/wb/modules/news/modify_group.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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['group_id']) OR !is_numeric($_GET['group_id'])) { |
|
30 |
header("Location: ".ADMIN_URL."/pages/index.php"); |
|
31 |
} else { |
|
32 |
$group_id = $_GET['group_id']; |
|
33 |
} |
|
34 |
|
|
35 |
// Include WB admin wrapper script |
|
36 |
require(WB_PATH.'/modules/admin.php'); |
|
37 |
|
|
38 |
// Get header and footer |
|
39 |
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_groups WHERE group_id = '$group_id'"); |
|
40 |
$fetch_content = $query_content->fetchRow(); |
|
41 |
|
|
42 |
?> |
|
43 |
|
|
44 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_group.php" method="post" enctype="multipart/form-data" style="margin: 0;"> |
|
45 |
|
|
46 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
|
47 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
|
48 |
<input type="hidden" name="group_id" value="<?php echo $group_id; ?>"> |
|
49 |
|
|
50 |
<table cellpadding="4" cellspacing="0" border="0" width="100%"> |
|
51 |
<tr> |
|
52 |
<td width="80"><?php echo $TEXT['TITLE']; ?>:</td> |
|
53 |
<td> |
|
54 |
<input type="text" name="title" value="<?php echo $admin->strip_slashes_dummy(htmlspecialchars($fetch_content['title'])); ?>" style="width: 100%;" maxlength="255" /> |
|
55 |
</td> |
|
56 |
</tr> |
|
57 |
<tr> |
|
58 |
<td><?php echo $TEXT['IMAGE']; ?>:</td> |
|
59 |
<?php if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) { ?> |
|
60 |
<td> |
|
61 |
<a href="<?php echo WB_URL.MEDIA_DIRECTORY; ?>/.news/image<?php echo $group_id; ?>.jpg" target="_blank">View</a> |
|
62 |
|
|
63 |
<input type="checkbox" name="delete_image" id="delete_image" value="true" /> |
|
64 |
<a href="javascript: toggle_checkbox('delete_image');">Delete</a> |
|
65 |
</td> |
|
66 |
<?php } else { ?> |
|
67 |
<td> |
|
68 |
<input type="file" name="image" /> |
|
69 |
</td> |
|
70 |
<?php } ?> |
|
71 |
</tr> |
|
72 |
<tr> |
|
73 |
<td><?php echo $TEXT['ACTIVE']; ?>:</td> |
|
74 |
<td> |
|
75 |
<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked'; } ?> /> |
|
76 |
<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;"> |
|
77 |
<?php echo $TEXT['YES']; ?> |
|
78 |
</a> |
|
79 |
- |
|
80 |
<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked'; } ?> /> |
|
81 |
<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;"> |
|
82 |
<?php echo $TEXT['NO']; ?> |
|
83 |
</a> |
|
84 |
</td> |
|
85 |
</tr> |
|
86 |
</table> |
|
87 |
|
|
88 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
89 |
<tr> |
|
90 |
<td align="left"> |
|
91 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 200px; margin-top: 5px;"></form> |
|
92 |
</td> |
|
93 |
<td align="right"> |
|
94 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
|
95 |
</td> |
|
96 |
</tr> |
|
97 |
</table> |
|
98 |
|
|
99 |
|
|
100 |
<?php |
|
101 |
|
|
102 |
// Print admin footer |
|
103 |
$admin->print_footer(); |
|
104 |
|
|
105 |
?> |
|
106 | 0 |
trunk/wb/modules/news/save_settings.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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 |
// Include WB admin wrapper script |
|
29 |
$update_when_modified = true; // Tells script to update when this page was last updated |
|
30 |
require(WB_PATH.'/modules/admin.php'); |
|
31 |
|
|
32 |
// This code removes any <?php tags and adds slashes |
|
33 |
$friendly = array('<', '>', '?php'); |
|
34 |
$raw = array('<', '>', ''); |
|
35 |
$header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['header'])); |
|
36 |
$post_loop = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_loop'])); |
|
37 |
$footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['footer'])); |
|
38 |
$post_header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_header'])); |
|
39 |
$post_footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['post_footer'])); |
|
40 |
$comments_header = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_header'])); |
|
41 |
$comments_loop = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_loop'])); |
|
42 |
$comments_footer = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_footer'])); |
|
43 |
$comments_page = $admin->add_slashes(str_replace($friendly, $raw, $_POST['comments_page'])); |
|
44 |
$commenting = $_POST['commenting']; |
|
45 |
$posts_per_page = $_POST['posts_per_page']; |
|
46 |
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { |
|
47 |
$resize = $_POST['resize']; |
|
48 |
} else { |
|
49 |
$resize = ''; |
|
50 |
} |
|
51 |
|
|
52 |
// Update settings |
|
53 |
$database->query("UPDATE ".TABLE_PREFIX."mod_news_settings SET header = '$header', post_loop = '$post_loop', footer = '$footer', posts_per_page = '$posts_per_page', post_header = '$post_header', post_footer = '$post_footer', comments_header = '$comments_header', comments_loop = '$comments_loop', comments_footer = '$comments_footer', comments_page = '$comments_page', commenting = '$commenting', resize = '$resize' WHERE section_id = '$section_id'"); |
|
54 |
|
|
55 |
// Check if there is a db error, otherwise say successful |
|
56 |
if($database->is_error()) { |
|
57 |
$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
58 |
} else { |
|
59 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
60 |
} |
|
61 |
|
|
62 |
// Print admin footer |
|
63 |
$admin->print_footer(); |
|
64 |
|
|
65 |
?> |
|
66 | 0 |
trunk/wb/modules/news/modify_post.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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 |
header("Location: ".ADMIN_URL."/pages/index.php"); |
|
31 |
} else { |
|
32 |
$post_id = $_GET['post_id']; |
|
33 |
} |
|
34 |
|
|
35 |
// Include WB admin wrapper script |
|
36 |
require(WB_PATH.'/modules/admin.php'); |
|
37 |
|
|
38 |
// Get header and footer |
|
39 |
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'"); |
|
40 |
$fetch_content = $query_content->fetchRow(); |
|
41 |
|
|
42 |
if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) { |
|
43 |
function show_wysiwyg_editor($name,$id,$content,$width,$height) { |
|
44 |
echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>'; |
|
45 |
} |
|
46 |
} else { |
|
47 |
$id_list=array("short","long"); |
|
48 |
require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php'); |
|
49 |
} |
|
50 |
|
|
51 |
?> |
|
52 |
<form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_post.php" method="post" style="margin: 0;"> |
|
53 |
|
|
54 |
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>"> |
|
55 |
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>"> |
|
56 |
<input type="hidden" name="post_id" value="<?php echo $post_id; ?>"> |
|
57 |
<input type="hidden" name="link" value="<?php echo $fetch_content['link']; ?>"> |
|
58 |
|
|
59 |
<table cellpadding="4" cellspacing="0" border="0" width="100%"> |
|
60 |
<tr> |
|
61 |
<td width="80"><?php echo $TEXT['TITLE']; ?>:</td> |
|
62 |
<td> |
|
63 |
<input type="text" name="title" value="<?php echo $admin->strip_slashes_dummy(htmlspecialchars($fetch_content['title'])); ?>" style="width: 100%;" maxlength="255" /> |
|
64 |
</td> |
|
65 |
</tr> |
|
66 |
<tr> |
|
67 |
<td><?php echo $TEXT['GROUP']; ?>:</td> |
|
68 |
<td> |
|
69 |
<select name="group" style="width: 100%;"> |
|
70 |
<option value="0"><?php echo $TEXT['NONE']; ?></option> |
|
71 |
<?php |
|
72 |
$query = $database->query("SELECT group_id,title FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC"); |
|
73 |
if($query->numRows() > 0) { |
|
74 |
// Loop through groups |
|
75 |
while($group = $query->fetchRow()) { |
|
76 |
?> |
|
77 |
<option value="<?php echo $group['group_id']; ?>"<?php if($fetch_content['group_id'] == $group['group_id']) { echo ' selected'; } ?>><?php echo $group['title']; ?></option> |
|
78 |
<?php |
|
79 |
} |
|
80 |
} |
|
81 |
?> |
|
82 |
</select> |
|
83 |
</td> |
|
84 |
</tr> |
|
85 |
<tr> |
|
86 |
<td><?php echo $TEXT['COMMENTING']; ?>:</td> |
|
87 |
<td> |
|
88 |
<select name="commenting" style="width: 100%;"> |
|
89 |
<option value="none"><?php echo $TEXT['DISABLED']; ?></option> |
|
90 |
<option value="public" <?php if($fetch_content['commenting'] == 'public') { echo 'selected'; } ?>><?php echo $TEXT['PUBLIC']; ?></option> |
|
91 |
<option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected'; } ?>><?php echo $TEXT['PRIVATE']; ?></option> |
|
92 |
</select> |
|
93 |
</td> |
|
94 |
</tr> |
|
95 |
<tr> |
|
96 |
<td><?php echo $TEXT['ACTIVE']; ?>:</td> |
|
97 |
<td> |
|
98 |
<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked'; } ?> /> |
|
99 |
<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;"> |
|
100 |
<?php echo $TEXT['YES']; ?> |
|
101 |
</a> |
|
102 |
|
|
103 |
<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked'; } ?> /> |
|
104 |
<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;"> |
|
105 |
<?php echo $TEXT['NO']; ?> |
|
106 |
</a> |
|
107 |
</td> |
|
108 |
</tr> |
|
109 |
<tr> |
|
110 |
<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td> |
|
111 |
<td> |
|
112 |
<?php |
|
113 |
show_wysiwyg_editor("short","short",$fetch_content['content_short'],"100%","135px"); |
|
114 |
?> |
|
115 |
</td> |
|
116 |
</tr> |
|
117 |
<tr> |
|
118 |
<td valign="top"><?php echo $TEXT['LONG']; ?>:</td> |
|
119 |
<td> |
|
120 |
<?php |
|
121 |
show_wysiwyg_editor("long","long",$fetch_content['content_long'],"100%","300px"); |
|
122 |
?> |
|
123 |
</td> |
|
124 |
</tr> |
|
125 |
</table> |
|
126 |
|
|
127 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
128 |
<tr> |
|
129 |
<td width="90"> |
|
130 |
|
|
131 |
</td> |
|
132 |
<td align="left"> |
|
133 |
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 200px; margin-top: 5px;"></form> |
|
134 |
</td> |
|
135 |
<td align="right"> |
|
136 |
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" /> |
|
137 |
</td> |
|
138 |
</tr> |
|
139 |
</table> |
|
140 |
|
|
141 |
<br /> |
|
142 |
|
|
143 |
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['COMMENT']; ?></h2> |
|
144 |
|
|
145 |
<?php |
|
146 |
|
|
147 |
// Loop through existing posts |
|
148 |
$query_comments = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_comments` WHERE section_id = '$section_id' AND post_id = '$post_id' ORDER BY commented_when DESC"); |
|
149 |
if($query_comments->numRows() > 0) { |
|
150 |
$row = 'a'; |
|
151 |
?> |
|
152 |
<table cellpadding="2" cellspacing="0" border="0" width="100%"> |
|
153 |
<?php |
|
154 |
while($comment = $query_comments->fetchRow()) { |
|
155 |
?> |
|
156 |
<tr class="row_<?php echo $row; ?>" height="20"> |
|
157 |
<td width="20" style="padding-left: 5px;"> |
|
158 |
<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']; ?>"> |
|
159 |
<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="^" /> |
|
160 |
</a> |
|
161 |
</td> |
|
162 |
<td> |
|
163 |
<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']; ?>"> |
|
164 |
<?php echo $comment['title']; ?> |
|
165 |
</a> |
|
166 |
</td> |
|
167 |
<td width="20"> |
|
168 |
<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']; ?>"> |
|
169 |
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" /> |
|
170 |
</a> |
|
171 |
</td> |
|
172 |
</tr> |
|
173 |
<?php |
|
174 |
// Alternate row color |
|
175 |
if($row == 'a') { |
|
176 |
$row = 'b'; |
|
177 |
} else { |
|
178 |
$row = 'a'; |
|
179 |
} |
|
180 |
} |
|
181 |
?> |
|
182 |
</table> |
|
183 |
<?php |
|
184 |
} else { |
|
185 |
echo $TEXT['NONE_FOUND']; |
|
186 |
} |
|
187 |
|
|
188 |
?> |
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
<?php |
|
193 |
|
|
194 |
// Print admin footer |
|
195 |
$admin->print_footer(); |
|
196 |
|
|
197 |
?> |
|
198 | 0 |
trunk/wb/modules/news/move_up.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id: move_up.php,v 1.1.1.1 2005/01/30 10:32:20 rdjurovich Exp $ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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 |
} else { |
|
33 |
$id = $_GET['group_id']; |
|
34 |
$id_field = 'group_id'; |
|
35 |
$table = TABLE_PREFIX.'mod_news_groups'; |
|
36 |
} |
|
37 |
} else { |
|
38 |
$id = $_GET['post_id']; |
|
39 |
$id_field = 'post_id'; |
|
40 |
$table = TABLE_PREFIX.'mod_news_posts'; |
|
41 |
} |
|
42 |
|
|
43 |
// Include WB admin wrapper script |
|
44 |
require(WB_PATH.'/modules/admin.php'); |
|
45 |
|
|
46 |
// Include the ordering class |
|
47 |
require(WB_PATH.'/framework/class.order.php'); |
|
48 |
|
|
49 |
// Create new order object an reorder |
|
50 |
$order = new order($table, 'position', $id_field, 'section_id'); |
|
51 |
if($order->move_up($id)) { |
|
52 |
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
53 |
} else { |
|
54 |
$admin->print_error($TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
55 |
} |
|
56 |
|
|
57 |
// Print admin footer |
|
58 |
$admin->print_footer(); |
|
59 |
|
|
60 |
?> |
|
61 | 0 |
trunk/wb/modules/news/add_group.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id: add_group.php,v 1.1.1.1 2005/01/30 10:32:22 rdjurovich Exp $ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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 |
// Include WB admin wrapper script |
|
29 |
require(WB_PATH.'/modules/admin.php'); |
|
30 |
|
|
31 |
// Include the ordering class |
|
32 |
require(WB_PATH.'/framework/class.order.php'); |
|
33 |
// Get new order |
|
34 |
$order = new order(TABLE_PREFIX.'mod_news_groups', 'position', 'group_id', 'section_id'); |
|
35 |
$position = $order->get_new($section_id); |
|
36 |
|
|
37 |
// Insert new row into database |
|
38 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id,position,active) VALUES ('$section_id','$page_id','$position','1')"); |
|
39 |
|
|
40 |
// Get the id |
|
41 |
$group_id = $database->get_one("SELECT LAST_INSERT_ID()"); |
|
42 |
|
|
43 |
// Say that a new record has been added, then redirect to modify page |
|
44 |
if($database->is_error()) { |
|
45 |
$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'§ion_id='.$section_id.'&group_id='.$group_id); |
|
46 |
} else { |
|
47 |
$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'§ion_id='.$section_id.'&group_id='.$group_id); |
|
48 |
} |
|
49 |
|
|
50 |
// Print admin footer |
|
51 |
$admin->print_footer(); |
|
52 |
|
|
53 |
?> |
|
54 | 0 |
trunk/wb/modules/news/view.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2005, 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 |
// Check if there is a start point defined |
|
30 |
if(isset($_GET['p']) AND is_numeric($_GET['p']) AND $_GET['p'] >= 0) { |
|
31 |
$position = $_GET['p']; |
|
32 |
} else { |
|
33 |
$position = 0; |
|
34 |
} |
|
35 |
|
|
36 |
// Get user's username, display name, email, and id - needed for insertion into post info |
|
37 |
$users = array(); |
|
38 |
$query_users = $database->query("SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users"); |
|
39 |
if($query_users->numRows() > 0) { |
|
40 |
while($user = $query_users->fetchRow()) { |
|
41 |
// Insert user info into users array |
|
42 |
$user_id = $user['user_id']; |
|
43 |
$users[$user_id]['username'] = $user['username']; |
|
44 |
$users[$user_id]['display_name'] = $user['display_name']; |
|
45 |
$users[$user_id]['email'] = $user['email']; |
|
46 |
} |
|
47 |
} |
|
48 |
|
|
49 |
// Get groups (title, if they are active, and their image [if one has been uploaded]) |
|
50 |
$groups[0]['title'] = ''; |
|
51 |
$groups[0]['active'] = true; |
|
52 |
$groups[0]['image'] = ''; |
|
53 |
$query_users = $database->query("SELECT group_id,title,active FROM ".TABLE_PREFIX."mod_news_groups WHERE section_id = '$section_id' ORDER BY position ASC"); |
|
54 |
if($query_users->numRows() > 0) { |
|
55 |
while($group = $query_users->fetchRow()) { |
|
56 |
// Insert user info into users array |
|
57 |
$group_id = $group['group_id']; |
|
58 |
$groups[$group_id]['title'] = $this->strip_slashes_dummy($group['title']); |
|
59 |
$groups[$group_id]['active'] = $group['active']; |
|
60 |
if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) { |
|
61 |
$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg'; |
|
62 |
} else { |
|
63 |
$groups[$group_id]['image'] = ''; |
|
64 |
} |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
// Check if we should show the main page or a post itself |
|
69 |
if(!defined('POST_ID') OR !is_numeric(POST_ID)) { |
|
70 |
|
|
71 |
// Check if we should only list posts from a certain group |
|
72 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) { |
|
73 |
$query_extra = " AND group_id = '".$_GET['g']."'"; |
|
74 |
?> |
|
75 |
<style type="text/css">.selected_group_title { font-size: 14px; text-align: center; }</style> |
|
76 |
<?php |
|
77 |
} else { |
|
78 |
$query_extra = ''; |
|
79 |
} |
|
80 |
|
|
81 |
// Get settings |
|
82 |
$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'"); |
|
83 |
if($query_settings->numRows() > 0) { |
|
84 |
$fetch_settings = $query_settings->fetchRow(); |
|
85 |
$setting_header = $this->strip_slashes_dummy($fetch_settings['header']); |
|
86 |
$setting_post_loop = $this->strip_slashes_dummy($fetch_settings['post_loop']); |
|
87 |
$setting_footer = $this->strip_slashes_dummy($fetch_settings['footer']); |
|
88 |
$setting_posts_per_page = $fetch_settings['posts_per_page']; |
|
89 |
} else { |
|
90 |
$setting_header = ''; |
|
91 |
$setting_post_loop = ''; |
|
92 |
$setting_footer = ''; |
|
93 |
$setting_posts_per_page = ''; |
|
94 |
} |
|
95 |
|
|
96 |
// Get total number of posts |
|
97 |
$query_total_num = $database->query("SELECT post_id FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra"); |
|
98 |
$total_num = $query_total_num->numRows(); |
|
99 |
|
|
100 |
// Work-out if we need to add limit code to sql |
|
101 |
if($setting_posts_per_page != 0) { |
|
102 |
$limit_sql = " LIMIT $position,$setting_posts_per_page"; |
|
103 |
} else { |
|
104 |
$limit_sql = ""; |
|
105 |
} |
|
106 |
|
|
107 |
// Query posts (for this page) |
|
108 |
$query_posts = $database->query("SELECT group_id,post_id,title,link,content_short,posted_by,posted_when FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra ORDER BY position DESC".$limit_sql); |
|
109 |
$num_posts = $query_posts->numRows(); |
|
110 |
|
|
111 |
// Create previous and next links |
|
112 |
if($setting_posts_per_page != 0) { |
|
113 |
if($position > 0) { |
|
114 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) { |
|
115 |
$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'&g='.$_GET['g'].'"><< '; |
|
116 |
} else { |
|
117 |
$pl_prepend = '<a href="?p='.($position-$setting_posts_per_page).'"><< '; |
|
118 |
} |
|
119 |
$pl_append = '</a>'; |
|
120 |
$previous_link = $pl_prepend.$TEXT['PREVIOUS'].$pl_append; |
|
121 |
$previous_page_link = $pl_prepend.$TEXT['PREVIOUS_PAGE'].$pl_append; |
|
122 |
} else { |
|
123 |
$previous_link = ''; |
|
124 |
$previous_page_link = ''; |
|
125 |
} |
|
126 |
if($position+$setting_posts_per_page >= $total_num) { |
|
127 |
$next_link = ''; |
|
128 |
$next_page_link = ''; |
|
129 |
} else { |
|
130 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) { |
|
131 |
$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'&g='.$_GET['g'].'"> '; |
|
132 |
} else { |
|
133 |
$nl_prepend = '<a href="?p='.($position+$setting_posts_per_page).'"> '; |
|
134 |
} |
|
135 |
$nl_append = ' >></a>'; |
|
136 |
$next_link = $nl_prepend.$TEXT['NEXT'].$nl_append; |
|
137 |
$next_page_link = $nl_prepend.$TEXT['NEXT_PAGE'].$nl_append; |
|
138 |
} |
|
139 |
if($position+$setting_posts_per_page > $total_num) { |
|
140 |
$num_of = $position+$num_posts; |
|
141 |
} else { |
|
142 |
$num_of = $position+$setting_posts_per_page; |
|
143 |
} |
|
144 |
$out_of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OUT_OF']).' '.$total_num; |
|
145 |
$of = ($position+1).'-'.$num_of.' '.strtolower($TEXT['OF']).' '.$total_num; |
|
146 |
$display_previous_next_links = ''; |
|
147 |
} else { |
|
148 |
$display_previous_next_links = 'none'; |
|
149 |
} |
|
150 |
|
|
151 |
// Print header |
|
152 |
if($display_previous_next_links == 'none') { |
|
153 |
echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_header); |
|
154 |
} else { |
|
155 |
echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_header); |
|
156 |
} |
|
157 |
|
|
158 |
if($num_posts > 0) { |
|
159 |
if($query_extra != '') { |
|
160 |
?> |
|
161 |
<div class="selected_group_title"> |
|
162 |
<?php echo '<a href="'.$_SERVER['PHP_SELF'].'">'.PAGE_TITLE.'</a> >> '.$groups[$_GET['g']]['title']; ?> |
|
163 |
</div> |
|
164 |
<?php |
|
165 |
} |
|
166 |
while($post = $query_posts->fetchRow()) { |
|
167 |
if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active |
|
168 |
$uid = $post['posted_by']; // User who last modified the post |
|
169 |
// Workout date and time of last modified post |
|
170 |
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE); |
|
171 |
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE); |
|
172 |
// Work-out the post link |
|
173 |
$post_link = page_link($post['link']); |
|
174 |
if(isset($_GET['p']) AND $position > 0) { |
|
175 |
$post_link .= '?p='.$position; |
|
176 |
} |
|
177 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) { |
|
178 |
if(isset($_GET['p']) AND $position > 0) { $post_link .= '&'; } else { $post_link .= '?'; } |
|
179 |
$post_link .= 'g='.$_GET['g']; |
|
180 |
} |
|
181 |
// Get group id, title, and image |
|
182 |
$group_id = $post['group_id']; |
|
183 |
$group_title = $groups[$group_id]['title']; |
|
184 |
$group_image = $groups[$group_id]['image']; |
|
185 |
if($group_image == '') { $display_image = 'none'; } else { $display_image = ''; } |
|
186 |
if($group_id == 0) { $display_group = 'none'; } else { $display_group = ''; } |
|
187 |
// Replace [wblink--PAGE_ID--] with real link |
|
188 |
$short = $this->strip_slashes_dummy($post['content_short']); |
|
189 |
$this->preprocess($short); |
|
190 |
// Replace vars with values |
|
191 |
$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[LINK]', '[DATE]', '[TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]', '[TEXT_READ_MORE]'); |
|
192 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') { |
|
193 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $this->strip_slashes_dummy($post['title']), $short, $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $TEXT['READ_MORE']); |
|
194 |
} else { |
|
195 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $this->strip_slashes_dummy($post['title']), $short, $post_link, $post_date, $post_time, '', '', '', '', $TEXT['READ_MORE']); |
|
196 |
} |
|
197 |
echo str_replace($vars, $values, $setting_post_loop); |
|
198 |
} |
|
199 |
} |
|
200 |
} |
|
201 |
|
|
202 |
// Print footer |
|
203 |
if($display_previous_next_links == 'none') { |
|
204 |
echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array('','','','','','', $display_previous_next_links), $setting_footer); |
|
205 |
} else { |
|
206 |
echo str_replace(array('[NEXT_PAGE_LINK]','[NEXT_LINK]','[PREVIOUS_PAGE_LINK]','[PREVIOUS_LINK]','[OUT_OF]','[OF]','[DISPLAY_PREVIOUS_NEXT_LINKS]'), array($next_page_link, $next_link, $previous_page_link, $previous_link, $out_of, $of, $display_previous_next_links), $setting_footer); |
|
207 |
} |
|
208 |
|
|
209 |
} elseif(defined('POST_ID') AND is_numeric(POST_ID)) { |
|
210 |
|
|
211 |
// Get settings |
|
212 |
$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'"); |
|
213 |
if($query_settings->numRows() > 0) { |
|
214 |
$fetch_settings = $query_settings->fetchRow(); |
|
215 |
$setting_post_header = $this->strip_slashes_dummy($fetch_settings['post_header']); |
|
216 |
$setting_post_footer = $this->strip_slashes_dummy($fetch_settings['post_footer']); |
|
217 |
$setting_comments_header = $this->strip_slashes_dummy($fetch_settings['comments_header']); |
|
218 |
$setting_comments_loop = $this->strip_slashes_dummy($fetch_settings['comments_loop']); |
|
219 |
$setting_comments_footer = $this->strip_slashes_dummy($fetch_settings['comments_footer']); |
|
220 |
} else { |
|
221 |
$setting_post_header = ''; |
|
222 |
$setting_post_footer = ''; |
|
223 |
$setting_comments_header = ''; |
|
224 |
$setting_comments_loop = ''; |
|
225 |
$setting_comments_footer = ''; |
|
226 |
} |
|
227 |
|
|
228 |
// Get page info |
|
229 |
$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id = '".PAGE_ID."'"); |
|
230 |
if($query_page->numRows() > 0) { |
|
231 |
$page = $query_page->fetchRow(); |
|
232 |
$page_link = page_link($page['link']); |
|
233 |
if(isset($_GET['p']) AND $position > 0) { |
|
234 |
$page_link .= '?p='.$_GET['p']; |
|
235 |
} |
|
236 |
if(isset($_GET['g']) AND is_numeric($_GET['g'])) { |
|
237 |
if(isset($_GET['p']) AND $position > 0) { $page_link .= '&'; } else { $page_link .= '?'; } |
|
238 |
$page_link .= 'g='.$_GET['g']; |
|
239 |
} |
|
240 |
} else { |
|
241 |
exit('Page not found'); |
|
242 |
} |
|
243 |
|
|
244 |
// Get post info |
|
245 |
$query_post = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '".POST_ID."' AND active = '1'"); |
|
246 |
if($query_post->numRows() > 0) { |
|
247 |
$post = $query_post->fetchRow(); |
|
248 |
if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active |
|
249 |
$uid = $post['posted_by']; // User who last modified the post |
|
250 |
// Workout date and time of last modified post |
|
251 |
$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE); |
|
252 |
$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE); |
|
253 |
// Get group id, title, and image |
|
254 |
$group_id = $post['group_id']; |
|
255 |
$group_title = $groups[$group_id]['title']; |
|
256 |
$group_image = $groups[$group_id]['image']; |
|
257 |
if($group_image == '') { $display_image = 'none'; } else { $display_image = ''; } |
|
258 |
if($group_id == 0) { $display_group = 'none'; } else { $display_group = ''; } |
|
259 |
$vars = array('[PAGE_TITLE]', '[GROUP_ID]', '[GROUP_TITLE]', '[GROUP_IMAGE]', '[DISPLAY_GROUP]', '[DISPLAY_IMAGE]', '[TITLE]', '[SHORT]', '[BACK]', '[DATE]', '[TIME]', '[USER_ID]', '[USERNAME]', '[DISPLAY_NAME]', '[EMAIL]'); |
|
260 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') { |
|
261 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $this->strip_slashes_dummy($post['title']), $this->strip_slashes_dummy($post['content_short']), $page_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']); |
|
262 |
} else { |
|
263 |
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $this->strip_slashes_dummy($post['title']), $this->strip_slashes_dummy($post['content_short']), $page_link, $post_date, $post_time, '', '', '', ''); |
|
264 |
} |
|
265 |
$post_long = $this->strip_slashes_dummy($post['content_long']); |
|
266 |
} |
|
267 |
} else { |
|
268 |
header('Location: '.WB_URL.'/pages/'); |
|
269 |
} |
|
270 |
|
|
271 |
// Print post header |
|
272 |
echo str_replace($vars, $values, $setting_post_header); |
|
273 |
|
|
274 |
// Replace [wblink--PAGE_ID--] with real link |
|
275 |
$this->preprocess($postlong); |
|
276 |
// Print long |
|
277 |
echo $post_long; |
|
278 |
|
|
279 |
// Print post footer |
|
280 |
echo str_replace($vars, $values, $setting_post_footer); |
|
281 |
|
|
282 |
// Show comments section if we have to |
|
283 |
if($post['commenting'] == 'private' AND isset($admin) AND $admin->is_authenticated() == true OR $post['commenting'] == 'public') { |
|
284 |
|
|
285 |
// Print comments header |
|
286 |
echo str_replace('[ADD_COMMENT_URL]', WB_URL.'/modules/news/comment.php?id='.POST_ID, $setting_comments_header); |
|
287 |
|
|
288 |
// Query for comments |
|
289 |
$query_comments = $database->query("SELECT title,comment,commented_when,commented_by FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".POST_ID."' ORDER BY commented_when ASC"); |
|
290 |
if($query_comments->numRows() > 0) { |
|
291 |
while($comment = $query_comments->fetchRow()) { |
|
292 |
// Display Comments without slashes, but with new-line characters |
|
293 |
$comment['comment'] = nl2br($this->strip_slashes_dummy($comment['comment'])); |
|
294 |
$comment['title'] = $this->strip_slashes_dummy($comment['title']); |
|
295 |
// Print comments loop |
|
296 |
$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE); |
|
297 |
$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE); |
|
298 |
$uid = $comment['commented_by']; |
|
299 |
$vars = array('[TITLE]','[COMMENT]','[DATE]','[TIME]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]'); |
|
300 |
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') { |
|
301 |
$values = array($this->strip_slashes_dummy($comment['title']), $this->strip_slashes_dummy($comment['comment']), $commented_date, $commented_time, $uid, $this->strip_slashes_dummy($users[$uid]['username']), $this->strip_slashes_dummy($users[$uid]['display_name']), $this->strip_slashes_dummy($users[$uid]['email'])); |
|
302 |
} else { |
|
303 |
$values = array($this->strip_slashes_dummy($comment['title']), $this->strip_slashes_dummy($comment['comment']), $commented_date, $commented_time, '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], ''); |
|
304 |
} |
|
305 |
echo str_replace($vars, $values, $setting_comments_loop); |
|
306 |
} |
|
307 |
} else { |
|
308 |
// Say no comments found |
|
309 |
if(isset($TEXT['NONE_FOUND'])) { |
|
310 |
echo $TEXT['NONE_FOUND'].'<br />'; |
|
311 |
} else { |
|
312 |
echo 'None Found<br />'; |
|
313 |
} |
|
314 |
} |
|
315 |
|
Also available in: Unified diff
Moved News module