Project

General

Profile

« Previous | Next » 

Revision 274

Added by ryan almost 19 years ago

Creating 2.6.1 tag

View differences:

tags/2.6.1/CHANGELOG
1
Change Log
2
===============================================================================
3
Please note: This change log may not be accurate
4

  
5
$Id$
6

  
7
Legend:
8
+ = Added
9
- = Removed
10
# = Bugfix
11
! = Update/Change
12

  
13
------------------------------------- 2.6.1 -------------------------------------
14
12-Dec-2005 Ryan Djurovich
15
#	Fixed security vulnerability in class.login.php
16
#	Fixed typo in EN language file
17
#	Fixed captcha problems (when feature is disabled) in form module and sign-up
18
!	Added charset encoding to admin templates
19
!	Added extra code to check for selection of addon upon uninstalling
20
#	Fixed bugs in RSS news feeder
21
#	Fixed bug with PAGE_DESCRIPTION not being set on any page
22

  
23
------------------------------------- 2.6.0 -------------------------------------
24
28-Nov-2005 Ryan Djurovich
25
+	Added default charset option to (advanced) settings
26
#	Form module email fields now have email address validation
27
#	Fixed spacing in form submissions
28
27-Nov-2005 Ryan Djurovich
29
+	Added captcha verification to sign-up form
30
+	Added Captcha to News module
31
24-Nov-2005 Stefan Braunewell
32
!	Applied aportale's patch to use label instead of javascript toggle code
33
20-Nov-2005 Ryan Djurovich
34
!	News mod now hides read more link if no need for it (see ticket #56)
35
+	Added support for mailto: links in the menu link mod
36
#	Added direct-access redirection on some files (see ticket #37)
37
+	Added extra characters to convert.php (see ticket #64)
38
#	Fixed ticket #65 (last_reset check in account/forgot_form.php)
39
29-Sep-2005 Ryan Djurovich
40
!	Cleaned up form buttons in Settings
41
!	Moved some options into Advanced Settings
42
#	Semi-disabled "separate" page trash option
43
+	Created a backup module/tool for backing-up the database
44
	(thanks to John (pcwacht) for the original code)
45
+	Created new "blank template", which can be used in case where you don't
46
	want anything wrapping page-content.
47
19-Sep-2005 Ryan Djurovich
48
+	Added _license field for all add-ons to specify a license
49
!	Renamed _designed_for variables (for all addons) to _platform
50
+	Created addons table for faster internal referencing of installed addons
51
!	Fixed some links, including the "Help" button in Admin
52
#	Used nl2br to display body correctly when viewing form-submissions
53
15-Sep-2005 Stefan Braunewell
54
+	Added table module with columns 'name','type' and 'directory' as an
55
	index.
56
+	Added entry to settings table 'wb_version' which holds the version
57
	number and can be utilized in future upgrade scripts.
58
!	Added upgrade functionality also for templates and languages.
59
#/!	Template/modules installation now respects paths.
60
!	Moved updates from config.php to database.
61
	Created initialize.php (required by config.php) to read settings.
62
11-Sep-2005 Stefan Braunewell
63
!	HTMLArea is now a module instead of a core component. Files moved
64
	from "include" to "modules".
65
+	Implemented Installation of modules on top of an older version. This is 
66
	done via checking $module_version. Instead of install.php, upgrade.php
67
	is then called if it exists in the module package. 
68
	For module developers: $module_version and $new_module_version are 
69
	accessible in upgrade.php to find out what upgrade steps need to be taken.
70
!	Changed column names in mod_news_posts from short,long to content_short,
71
	content_long.
72
09-Sep-2005 Stefan Braunewell
73
+	Added new advanced setting "Rename Files On Upload". File extensions can be
74
	given so that respective files will have a ".txt" appended on media upload.
75
#	Fixed "None found" message bug when user has no top level page edit
76
	rights.
77
#	Fixed missing parent option 'none' - ticket #12 - and a minor scope bug.
78
+	Added breadcrumbs code. Call using $wb->breadcrumbs().
79
+	Added utf-8 character encoding meta tag into all stock templates.
80
#	Fixed bug when changing a page's parent
81
!	Changed the way blocks are treated. Added new frontend class attribute
82
	default_block_content that controls what is shown on pages such as
83
	search, login, etc. (Ticket #16)
84
+	Added support for WYSIWYG editor modules (wysiwygmod)
85
+	When trying to access a registered page, user is automatically redirected
86
	there on successful login.
87
#	Fixed various issues with system search (mainly related to stripslashes()
88
#	Removed stripslashes() in many places in the code. Added check for
89
	magic_quotes_gpc to new wb class method add_slashes(). Now database contest
90
	is independent of magic_quotes setting..
91
05-Sep-2005 Stefan Braunewell
92
#	Fixed bug concerning direct access of preferences page.
93
#	Reworked page visibility and menu item visibility code (frontend login
94
	problem).
95
#	Pages in link list in htmlarea popup are now correctly ordered.
96
#	Fixed bug where group with existing name can be added.
97
04-Sep-2005 Ryan Djurovich
98
+	Added and RSS newsfeed script to the News module
99
04-Sep-2005 Stefan Braunewell
100
!	Rewrote menu function. Parameters are now given as attributes to frontend class.
101
#	Fixed some occurrences of potential direct access path disclosure
102
#	Added directory check to browse.php to prevent xss exploit by trusted users.
103
!	Updated code to reflect move to Subversion repository system.
104
27-Aug-2005 Stefan Braunewell
105
#	Fixed bugs 4,5,6,8,9 in bug tracker
106
!	Removed 'USER_LANGUAGE' and 'GET_LANGUAGE' constants.
107
	A GET['lang'] now sets the session language variable.
108
26-Aug-2005 Stefan Braunewell
109
!	Moved redundant code into the new class functions. Created 
110
	'compatibility.php' for backward compatibility with
111
	modules and templates. Variables and functions can still be accessed
112
	in the old way.
113
!/+	Reorganized core frontend files, added new base class 'wb' from
114
	which 'admin' and the new 'frontend' class inherit. Moved all frontend
115
	function into new class. Completely rewrote core index.php.
116
	Now all variables and functions that are available to templates and
117
	modules are attributes and methods of the frontend and the wb classes
118
------------------------------------- 2.5.2 -------------------------------------
119
23-Jun-2005 Ryan Djurovich
120
!	create_access_file now creates all parent directories if needed
121
#	Fixed bug when moving page with subpages to another level
122
#	Fixed bug when saving "Settings" (in Admin) on Windows/IIS
123
#	Fixed bug where query was not setting error correctly in class.database.php
124
22-Jun-2005 Ryan Djurovich
125
#	Fixed bug where template permissions were not saved when a adding group
126
21-Jun-2005 Ryan Djurovich
127
#	Added htmlspecialchars for modifying WYSIWYG, news, etc. modules (Bug #78)
128
#	Fixed language problems in some area's of Admin. (Bug #70)
129
#	Added a space in website/page keywords (Bug #69)
130
#	Fixed bugs on settings2.php (Bug #52)
131
!	Links inserted with HTMLArea now use [wblink--PAGE_ID--] instead of raw URL
132
13-Jun-2005 Ryan Djurovich
133
#	Fixed bug (#88) with news module
134
!	Title of Administration login page now taken from language file (Bug #72)
135
#	Fixed redirection admin/home to admin/start on admin/index.php
136
#	Fixed bug with forgotten password page in admin (Bug #81)
137
25-Apr-2005 Ryan Djurovich
138
#	Fixed numerous bugs with module uninstallation
139
#	Fixed bug when uploading files in Administration -> Media
140
!	Installer no-longer requires you to accept the GNU GPL
141
------------------------------------- 2.5.1 -------------------------------------
142
16-Apr-2005 Ryan Djurovich
143
#	Fixed two bugs with account login/logout
144
------------------------------------- 2.5.1 -------------------------------------
145
15-Apr-2005 Ryan Djurovich
146
#	Fixed bug where non-english characters can get used in page filenames. Many
147
	measuers have been added (including a new file: wb/framework/convert.php),
148
	to prevent any possible errors that can occur in page filenames.
149
#	Fixed invalid meta tags in stock templates (meta tags were not closed)
150
#	Removed lines 401, 402, and 425 of wb/index.php - not needed
151
#	Fixed bug where search and account pages are shown in every block
152
	that is in a template
153
#	Fixed numerous bugs with media home directories feature
154
10-Apr-2005 Ryan Djurovich
155
#	Fixed bugs in account/login.php and logout.php where users
156
	gets redirected to /pages
157
------------------------------------- 2.5.0 -------------------------------------
158
08-Apr-2005 Ryan Djurovich
159
-	Removed section language feature
160
+	Added page language feature (replaces need for sections language feature)
161
#	Fixed bug where pages using menu_link module can have the URL changed
162
-	Page directory no longer stored in link field in pages table, it is now added
163
	when the page_link function is called - this makes changing the pages
164
	directory much easier and quicker
165
!	Pages with visibility of "none" are now no longer directly accessable
166
+	Added new visibility setting "hidden", acts exactly like none did previously
167
!	Template info file can now specify number of menu's available and relative names
168
!	Template info file can now specify number of blocks's available and relative names
169
------------------------------------- 2.4.3 -------------------------------------
170
07-Apr-2005 Ryan Djurovich
171
#	page_filename function has been rewritten using str_replace
172
	function, which should be faster and will allow characters
173
	from other languages into filenames
174
!	Created new media_filename function, which is now used
175
	by all media functions (create,upload,rename) to determine
176
	which characters should be removed from a desired filename
177
+	New button in Administration page list to view specific page
178
#	Updated the page_link function to now be compatible with menu link
179
	module when setting pages directory to root
180
#	Fixed bugs in search when using "Any Words" option
181
#	Fixed bug with news module when pages directory set to root
182
!	Changed URL of documentation website on Administration Start page
183
------------------------------------- 2.4.2 -------------------------------------
184
05-Apr-2005 Ryan Djurovich
185
#	Fixed bug where file could be renamed to nothing in Media
186
!	Optimised Media create folder, upload file, and rename functions
187
#	Fixed bug where stripslashes not run on news post titles in admin
188
05-Apr-2005 Stefan Braunewell
189
#	Fixed bug concerning usage of the private_sql variable
190
#	Fixed bug conerning sub-pages being displayed in menus incorrectly
191
------------------------------------- 2.4.1 -------------------------------------
192
04-Apr-2005 Ryan Djurovich
193
!	Pages with visibility of "none" are again directly accessable
194
#	Fixed bugs regarding renaming files and directories in Media section
195
!	When home folders disabled, all folders now visible in Media section
196
------------------------------------- 2.4.0 -------------------------------------
197
03-Apr-2005 Ryan Djurovich
198
-	Removed recently added visibility setting of "heading", and relative config vars
199
+	Added new "menu" field to pages table, and new setting "multiple menus"
200
	which replaces the need for the menu headings feature
201
+	Added links to top of groups and users sections, linking to each other
202
!	Change menu width in "Round" template to 170px (was 150px)
203
#	Change page "are you sure" deletion message to mention that it will delete
204
	all sub-pages as well
205
#	Fixed many bugs with news module when viewing posts by group
206
!	Pages with visibility of "none" are now no longer directly accessable
207
02-Apr-2005 Ryan Djurovich
208
-	Removed need to specify DB_URL when calling database class
209
#	Stopped fields without a type specified from being shown in form mod
210
#	Changed '/media' to MEDIA_DIRECTORY on HTMLArea popup windows
211
	for insert link and insert image
212
+	Added setting which allows you to specify the default WYSIWYG style
213
+	Added "Server Email" option, to specify what is used in "From" field when
214
	sending emails using the PHP mail function. Default is admins email address.
215
#	Search now excludes pages which have a visibility of none or heading
216
!	Pages are now given modified_when and modified_by when added
217
01-Apr-2005 Ryan Djurovich
218
+	Added option to News module to specify how many posts should be listed
219
	per page (by default it is set to unlimited, which functions like previous version)
220
#	Added stripslashes when display page titles in search
221
+	Page descriptions and last updated date now shown in search by default
222
30-Mar-2005 Ryan Djurovich
223
+	Added new feature for Media home folders, where a folder can be specified
224
	for a specific user or group of users only
225
!	Changed URL of Help button to http://www.websitebaker.org/docs/
226
+	Added new feature for "Page Trash" - two modes available: inline and separate
227
!	When pages are deleted, all sub-pages are now deleted (instead of being moved
228
	up a level)
229
29-Mar-2005 Ryan Djurovich
230
-	Removed Database Settings from Administration Settings (options will not be
231
	available in 3.x, so trying to match interface with WB 3.x plans
232
!	Changed the name of Path Settings to Filesystem Settings in Administration
233
	Settings, and removed ability to change path/url options - matching interface
234
	plans for WB 3.x
235
+	Added same options for OS and file permissions as installer to Settings
236
!	Sessions now named with APP_NAME.'_session_id' (e.g. default is wb_session_id)
237
28-Mar-2005 Ryan Djurovich
238
+	New functions available to templates to simplify creation of them. This aims
239
	to "future-proof" templates for WB 3.x plans.
240
!	Default templates updated to support some of the new functions
241
+	Added field to pages table "page_trail" which stores a list of the pages
242
	parents. This field was needed by the new page_menu function
243
+	Added option for page visibility "heading" to enabled support for multiple
244
	menu's. Also, this helps to "future-proof" templates for WB 3.x plans
245
+	Added option for page visibility "registered", which acts a little like
246
	private, but is still shown in the menu (although users need to log in to view
247
	the pages content)
248
+	Form module submissions now saved to database, and feature now added to
249
	limit number of submissions per hour to prevent spamming
250
+	New field for Form module: email. Allows you to specify their email in
251
	"from" field on module settings.
252
#	Fixed bug when displaying comments in News module (WB Bug #14)
253
+	New "under contruction" message if no pages exist
254
!	Cleaned-up wb/index.php
255
27-Mar-2005 Ryan Djurovich
256
+	Created advanced mkdir and chmod functions
257
#	Fixed bug in media where wrong file/folder is deleted
258
+	Complete overhall of installer - now only one step! It has been greatly
259
	simplified in many ways, has much better validation, reports error much more
260
	nicely, and automatically logs the user into the Administrations
261
+	Must now specify OS type - allows for customizable file permission settings
262
+	Sections can now have a language code assigned to them
263
+	Sections can now have a block name/id assigned to them
264
!	Home section of Administration renamed to Start, to save confusion with saying
265
	Homepage (because this term could either mean the main website or Home section
266
	in	Administration). Also, this aims to unify the interface with WB 3.x plans
267
!	Moved Users and Groups sections under Access section. This aims to unify the
268
	interface with WB 3.x plans, which help to unclutter the menu
269
!	Interface for Settings section has been imporved for usability purposes
270
#	Fixed HTMLArea where no scrollbar for "insert link" and "insert image" dialogs
271
	by placing media list inside an iframe
272
#	Fixed stripslashes problem for viewing news comments
273
!	Added code from Formesque module (an advanced version of the original Form
274
	module, modified by Rudolph Lartey from www.carbonect.com), and made further
275
	interface improvements for select box/checkbox group/radio group options.
276
#	Possibly fixed bugs where an S appears before file and dir modes
277
#	Fixed bug where users can be added with same emails (in Administration)
278
-	Removed support for PEAR, as it was deemed an unnecessary addition which only
279
	makes code more bulky, and removing it will decrease package size a lot
280
+	New "homepage redirect" option so first page is included and not redirected to
281
#	Fixed text not being shown when module uninstalled
282
!	Imporved interface for basic group permissions
283
26-Mar-2005 Stefan Braunewell
284
#	Fixed bug with front-end logins
285
#	Fixed bug when saving intro page 
286
+	Added check on sign-up if e-mail exists (thanks to P. Melief)
287
#	Fixed bugs concerning moving/deleting pages
288
#	Fixed list of parents in page settings
289
#	Fixed mkdir without mode parameter
290
#	Added a check on install to ensure PHP 4.1.x compatibility (thanks to Wanderer)
291
+	Added support for PAGES_DIRECTORY set to root
292
+	Search form now supports quotes (thanks to Manafta)
293
#	Fixed page section ordering
294
#	News items are displayed with name of poster instead of "Unknown"
295
#	Deletion confirmation popup window in media section now shows correct file name
296
------------------------------------- 2.3.1 -------------------------------------
297
03-Fed-2005 Ryan Djurovich
298
+	Now there is two types of "filesystem modes", one for directories and one
299
	for files. Having different settings is very common for most servers, so
300
	this addition should fix many problems people had with 2.3.0.
301
-	Removed filesystem mode options from installation
302
!	Removed duplicate text on installation step 3 for timezone
303
!	All "access files" for the news module now stored in pages/posts instead
304
	of a sub-dir relative to the page (this fixes many bugs)
305
#	Fixed major bugs when deleting pages with sub-pages
306
!	Removed the restrictions that prevent a user for changing a pages level
307
#	Fixed bug with "toggle" plus/minus in IE for pages list
308
#	Fixed some bugs where /pages was not replaced with PAGES_DIRECTORY constant
309
------------------------------------- 2.3.0 -------------------------------------
310
26-Jan-2005 Ryan Djurovich
311
#	Fixed bug in framework/functions.php that made root parent always equal 8
312
#	Added missing braces in lines 182 and 208 of admin/pages/settings2.php
313
#	Fixed SQL-query on line 172, placing a / after $old_link
314
#	Added eregi checks for PAGES_DIRECTORY on lines 140 and 150 of
315
	admin/pages/settings2.php
316
#	Added ordering cleaning to delete_post.php on line 53 for news module
317
!	GMT option is selected for "Default Timezone" in the installer, instead
318
	of the old "Please select" message (which had the same value as GMT)
319
28-Jan-2005 Ryan Djurovich
320
!	Ability to specify the chmod number when WB uploads files, etc.
321
!	Modified file headers (copyright/license notice) so they now look almost the
322
	same, independant of font. Also, it now covers copyright for 2005.
323
30-Jan-2005 Ryan Djurovich
324
#	Added code on wb/admin/pages/delete.php to remove sections from the sections
325
	table when a page is deleted.
326
+	New 'Smart Login' prevents users from using external password managers,
327
	and can be set to remember the users password using cookies.
328
!	SourceForge CVS module now called websitebaker2 (instead of just
329
	websitebaker). Also, all file versions have been reset.
330
01-Fed-2005 Ryan Djurovich
331
!	Added code to prevent from changing a pages level (it simply disables
332
	the select box), to prevent many possible bugs.
333
------------------------------------- 2.2.4 -------------------------------------
334
23-Dec-2004 Ryan Djurovich
335
!	Change 'EXACT_PHRASE' to 'EXACT_MATCH' on line 261 of wb/languages/EN.php
336
#	Fixed multi-language support in search
337
+	Added more detailed options to list of PHP error reporting level's
338
-	Removed ability to change language and PHP error reporting level
339
	on installation to make things easier for newbie's
340
+	Ability to select custom spacer for page filename's
341
!	Changed the way a language code is found on language installation
342
+	Added template permissions to groups
343
#	Fixed bug when trying to change email from Preferences (admin and frontend)
344
#	Fixed bug with auto-selection of "System Default" for Preferences
345
!	News module now use's WYSIWYG for modifying news posts
346
+	Ability to specify both the pages and media target directories
347
------------------------------------ 2.2.3-c ------------------------------------
348
22-Dec-2004 Ryan Djurovich
349
#	Fixed problem with DB password being reset if Settings saved in basic mode
350
------------------------------------ 2.2.3-b ------------------------------------
351
21-Dec-2004 Ryan Djurovich
352
#	Fixed minor bug on admin templates section
353
#	Fixed bug on rename.php and rename2.php in admin media section
354
------------------------------------- 2.2.3 -------------------------------------
355
20-Dec-2004 Ryan Djurovich
356
+	Added WB release version in Administration (top right corner)
357
!	New option to prevent users from adding level 0 pages
358
#	Fixed bug when deleting post's in News module
359
+	Added new field in pages table for "root" parent (level 0 parent), for
360
	extra flexability in creating templates
361
!	Round template now supports unlimited page levels
362
------------------------------------- 2.2.2 -------------------------------------
363
18-Dec-2004 Ryan Djurovich
364
+	New option under Search Settings for selecting custom template for search
365
+	New option when changing page settings to set the target
366
#	Fixed error when saving a user after editing
367
!	Users can now modify sub-page if they dont have permissions on the parent
368
------------------------------------- 2.2.1 -------------------------------------
369
15-Dec-2004 Ryan Djurovich
370
#	Fixed bug when changing password on preferences form (front-end)
371
#	Fixed bug when retrieving user details (administration)
372
#	Added check to see if module, template, or language is in use when deleting
373
#	Fixed up email that is sent to user from a submitted form
374
#	Fixed major problem with module permissions which stopped it from working
375
------------------------------------- 2.2.0 -------------------------------------
376
14-Dec-2004 (Correct date[s] unkown) Ryan Djurovich
377
+	Multiple-level page support
378
+	Multiple section's for pages (including interface)
379
!	Removed text created using two words on all areas
380
	(e.g. {Intro} {PAGE} is now {INTRO_PAGE})
381
	this is for better language support
382
+	Added Languages section
383
!	Moved Templates and Modules under Add-ons section
384
!	Changed name of "Default" template to "Round"
385
+	Added "All CSS" template
386
+	Added "Jump"
387
+	Added 
388
!	Modified "Box" template to support multiple page levels
389
+	Added "Menu Link" module
390
+	Added "News" module
391
+	Added "Code" module
392
+	Added "Form" module
393
+	Added "Wrapper" module
394
!	Changed name of "Normal Page" module to "WYSIWYG"
395
+	Created new admin wrapper script to ease module develpment
396
+	Media now automatically creates index.php file for every
397
	sub-folder made (for security purposes)
398
!	Change "Help" link in Administration menu so it now directs
399
	to the the new Website Baker documentation website found at:
400
	http://www.websitebaker.org/documentation
401
!	Password is now required to change email in preferences
402
+	User can now select custom Language and Date & Time Formats
403
+	Added search functionality, with three different "methods":
404
	1. Using all words  2. Using any words  3. Exact match
405
+	Added native MySQL database support
0 406

  
tags/2.6.1/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-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
// 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
}
33
if(isset($_GET['group_id']) AND is_numeric($_GET['group_id'])) {
34
	$group_id = $_GET['group_id'];
35
	define('GROUP_ID', $group_id);
36
}
37

  
38
// Include WB files
39
require_once('../../config.php');
40
require_once(WB_PATH.'/framework/class.frontend.php');
41
$database = new database();
42
$wb = new frontend();
43
$wb->page_id = $page_id;
44
$wb->get_page_details();
45
$wb->get_website_settings();
46

  
47
// Sending XML header
48
header("Content-type: text/xml");
49

  
50
// Header info
51
// Required by CSS 2.0
52

  
53
echo "<rss version='2.0'>";
54
echo "<channel>";
55
echo "<title>".PAGE_TITLE."</title>";
56
echo "<link>".WB_URL."</link>";
57
echo "<description>".PAGE_DESCRIPTION."</description>";
58

  
59
// Optional header info
60
echo "<language>".DEFAULT_LANGUAGE."</language>";
61
echo "<copyright>".WB_URL."</copyright>";
62
echo "<managingEditor>".SERVER_EMAIL."</managingEditor>";
63
echo "<webMaster>".SERVER_EMAIL."</webMaster>";
64
echo "<category>".WEBSITE_TITLE."</category>";
65
echo "<generator>Website Baker Content Management System</generator>";
66

  
67
// Get news items from database
68

  
69
//Query
70
if(isset($group_id)) {
71
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id=".$group_id." AND page_id = ".$page_id." AND active=1 ORDER BY posted_when DESC";
72
} else {
73
	$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 ORDER BY posted_when DESC";	
74
}
75
$result = $database->query($query);
76

  
77
//Generating the news items
78
while($item = $result->fetchRow($result)){
79

  
80
    echo "<item>";
81
    echo "<title>".$item["title"]."</title>";
82
    // Stripping HTML Tags for text-only visibility
83
    echo "<description>".strip_tags($item["content_short"])."</description>";
84
    echo "<link>".WB_URL."/pages".$item["link"].PAGE_EXTENSION."</link>";
85
    /* Add further (non required) information here like ie.
86
    echo "<author>".$item["posted_by"]."</author>");
87
    etc.
88
    */
89
    echo "</item>";
90

  
91
}
92

  
93
// Writing footer information
94
echo "</channel>";
95
echo "</rss>";
96

  
97
?>
0 98

  
tags/2.6.1/wb/modules/news/comment_page.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
// Make sure page cannot be accessed directly
27
if(!defined('WB_URL')) { header('Location: ../index.php'); }
28
	
29
// Get comments page template details from db
30
$query_settings = $database->query("SELECT comments_page,use_captcha FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '".SECTION_ID."'");
31
if($query_settings->numRows() == 0) {
32
	header('Location: '.WB_URL.'/pages/');
33
} else {
34
	$settings = $query_settings->fetchRow();
35
	// Print comments page
36
	echo str_replace('[POST_TITLE]', POST_TITLE, ($settings['comments_page']));
37
	?>
38
	<form name="comment" action="<?php echo WB_URL.'/modules/news/submit_comment.php?page_id='.PAGE_ID.'&section_id='.SECTION_ID.'&post_id='.POST_ID; ?>" method="post">
39
	<?php echo $TEXT['TITLE']; ?>:
40
	<br />
41
	<input type="text" name="title" maxlength="255" style="width: 90%;"<?php if(isset($_SESSION['comment_title'])) { echo ' value="'.$_SESSION['comment_title'].'"'; unset($_SESSION['comment_title']); } ?> />
42
	<br /><br />
43
	<?php echo $TEXT['COMMENT']; ?>:
44
	<br />
45
	<textarea name="comment" style="width: 90%; height: 150px;"><?php if(isset($_SESSION['comment_body'])) { echo $_SESSION['comment_body']; unset($_SESSION['comment_body']); } ?></textarea>
46
	<br /><br />
47
	<?php
48
	if(isset($_SESSION['captcha_error'])) {
49
		echo '<font color="#FF0000">'.$_SESSION['captcha_error'].'</font><br />';
50
		unset($_SESSION['captcha_error']);
51
	}
52
	// Captcha
53
	if($settings['use_captcha']) {
54
	$_SESSION['captcha'] = '';
55
	for($i = 0; $i < 5; $i++) {
56
		$_SESSION['captcha'] .= rand(0,9);
57
	}
58
	?>
59
	<table cellpadding="2" cellspacing="0" border="0">
60
	<tr>
61
	<td><?php echo $TEXT['VERIFICATION']; ?>:</td>
62
	<td><img src="<?php echo WB_URL; ?>/include/captcha.php" alt="Captcha" /></td>
63
	<td><input type="text" name="captcha" maxlength="5" /></td>
64
	</tr></table>
65
	<br />
66
	<?php
67
	}
68
	?>
69
	<input type="submit" name="submit" value="<?php echo $TEXT['ADD']; ?> <?php echo $TEXT['COMMENT']; ?>" />
70
	</form>	
71
	<?php
72
}
73

  
74
?>
0 75

  
tags/2.6.1/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
					 . ' `use_captcha` INT NOT NULL,'
90
					 . 'PRIMARY KEY (section_id)'
91
                . ' )';
92
	$database->query($mod_news);
93
		
94
	// Insert info into the search table
95
	// Module query info
96
	$field_info = array();
97
	$field_info['page_id'] = 'page_id';
98
	$field_info['title'] = 'page_title';
99
	$field_info['link'] = 'link';
100
	$field_info['description'] = 'description';
101
	$field_info['modified_when'] = 'modified_when';
102
	$field_info['modified_by'] = 'modified_by';
103
	$field_info = serialize($field_info);
104
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'news', '$field_info')");
105
	// Query start
106
	$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 ";
107
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'news')");
108
	// Query body
109
	$query_body_code = "
110
	[TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.title LIKE \'%[STRING]%\'
111
	OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_short LIKE \'%[STRING]%\'
112
	OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_long LIKE \'%[STRING]%\'
113
	OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.title LIKE \'%[STRING]%\'
114
	OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.comment LIKE \'%[STRING]%\'
115
	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.header LIKE \'%[STRING]%\'
116
	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.footer LIKE \'%[STRING]%\'
117
	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_header LIKE \'%[STRING]%\'
118
	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.post_footer LIKE \'%[STRING]%\'
119
	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_header LIKE \'%[STRING]%\'
120
	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_footer LIKE \'%[STRING]%\'
121
	OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.comments_footer LIKE \'%[STRING]%\'";
122
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'news')");
123
	// Query end
124
	$query_end_code = "";	
125
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'news')");
126
	
127
	// Insert blank row (there needs to be at least on row for the search to work)
128
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id) VALUES ('0', '0')");
129
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_groups (section_id,page_id) VALUES ('0', '0')");
130
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id) VALUES ('0', '0')");
131
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id) VALUES ('0', '0')");
132
	
133
	// Make news post access files dir
134
	make_dir(WB_PATH.PAGES_DIRECTORY.'/posts/');
+	
135
}
136

  
137
?>
0 138

  
tags/2.6.1/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('&lt;', '&gt;');
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 ($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 ($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, ($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, ($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, ($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 class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
110
	<td>
111
		<input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($fetch_content['use_captcha'] == true) { echo ' checked'; } ?> />
112
		<label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
113
		<input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($fetch_content['use_captcha'] == false) { echo ' checked'; } ?> />
114
		<label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
115
	</td>
116
</tr>
117
<tr>
118
	<td>
119
		<?php echo $TEXT['RESIZE_IMAGE_TO']; ?>:
120
	</td>
121
	<td>
122
		<select name="resize" style="width: 100%;">
123
			<option value=""><?php echo $TEXT['NONE']; ?></option>
124
			<?php
125
			$SIZES['50'] = '50x50px';
126
			$SIZES['75'] = '75x75px';
127
			$SIZES['100'] = '100x100px';
128
			$SIZES['125'] = '125x125px';
129
			$SIZES['150'] = '150x150px';
130
			foreach($SIZES AS $size => $size_name) {
131
				if($fetch_content['resize'] == $size) { $selected = ' selected'; } else { $selected = ''; }
132
				echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>';
133
			}
134
			?>
135
		</select>
136
	</td>
137
</tr>
138
<?php } ?>
139
<tr>
140
	<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td>
141
	<td class="setting_name">
142
		<textarea name="comments_header" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea>
143
	</td>
144
</tr>
145
<tr>
146
	<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td>
147
	<td class="setting_name">
148
		<textarea name="comments_loop" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea>
149
	</td>
150
</tr>
151
<tr>
152
	<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td>
153
	<td class="setting_name">
154
		<textarea name="comments_footer" style="width: 100%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea>
155
	</td>
156
</tr>
157
<tr>
158
	<td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td>
159
	<td class="setting_name">
160
		<textarea name="comments_page" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea>
161
	</td>
162
</tr>
163
</table>
164
<table cellpadding="0" cellspacing="0" border="0" width="100%">
165
<tr>
166
	<td width="105">&nbsp;</td>
167
	<td align="left">
168
		<input name="save" type="submit" value="<?php echo $TEXT['SAVE'].' '.$TEXT['SETTINGS']; ?>" style="width: 200px; margin-top: 5px;"></form>
169
	</td>
170
	<td align="right">
171
		<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;" />
172
	</td>
173
</tr>
174
</table>
175

  
176

  
177
<?php
178

  
179
// Print admin footer
180
$admin->print_footer();
181

  
182
?>
0 183

  
tags/2.6.1/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('&lt;', '&gt;', '?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
	$use_captcha = $_POST['use_captcha'];
49
} else {
50
	$resize = '';
51
	$use_captcha = false;
52
}
53

  
54
// Update settings
55
$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', use_captcha = '$use_captcha' WHERE section_id = '$section_id'");
56

  
57
// Check if there is a db error, otherwise say successful
58
if($database->is_error()) {
59
	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
60
} else {
61
	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
62
}
63

  
64
// Print admin footer
65
$admin->print_footer();
66

  
67
?>
0 68

  
tags/2.6.1/wb/modules/news/submit_comment.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
// Include config file
27
require('../../config.php');
28

  
29
require_once(WB_PATH.'/framework/class.wb.php');
30
$wb = new wb;
31

  
32
// Check if we should show the form or add a comment
33
if(is_numeric($_GET['page_id']) AND is_numeric($_GET['section_id']) AND isset($_GET['post_id']) AND is_numeric($_GET['post_id']) AND isset($_POST['comment']) AND $_POST['comment'] != '') {
34
	
35
	// Check captcha
36
	if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
37
		if(isset($_POST['captcha']) AND $_POST['captcha'] != ''){
38
			// Check for a mismatch
39
			if(!isset($_POST['captcha']) OR !isset($_SESSION['captcha']) OR $_POST['captcha'] != $_SESSION['captcha']) {
40
				$_SESSION['captcha_error'] = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
41
				$_SESSION['comment_title'] = $_POST['title'];
42
				$_SESSION['comment_body'] = $_POST['comment'];
43
				exit(header('Location: '.WB_URL.'/modules/news/comment.php?id='.$_GET['post_id']));
44
			}
45
		} else {
46
			$_SESSION['captcha_error'] = $MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'];
47
			$_SESSION['comment_title'] = $_POST['title'];
48
			$_SESSION['comment_body'] = $_POST['comment'];
49
			exit(header('Location: '.WB_URL.'/modules/news/comment.php?id='.$_GET['post_id']));
50
		}
51
	}
52
	if(isset($_SESSION['catpcha'])) { unset($_SESSION['captcha']); }
53
	
54
	// Insert the comment into db
55
	$page_id = $_GET['page_id'];
56
	$section_id = $_GET['section_id'];
57
	$post_id = $_GET['post_id'];
58
	$title = $wb->add_slashes(strip_tags($_POST['title']));
59
	$comment = $wb->add_slashes(strip_tags($_POST['comment']));
60
	$commented_when = mktime();
61
	if($wb->is_authenticated() == true) {
62
		$commented_by = $wb->get_user_id();
63
	} else {
64
		$commented_by = '';
65
	}
66
	$query = $database->query("INSERT INTO ".TABLE_PREFIX."mod_news_comments (section_id,page_id,post_id,title,comment,commented_when,commented_by) VALUES ('$section_id','$page_id','$post_id','$title','$comment','$commented_when','$commented_by')");
67
	// Get page link
68
	$query_page = $database->query("SELECT link FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = '$post_id'");
69
	$page = $query_page->fetchRow();
70
	header('Location: '.$wb->page_link($page['link']).'?id='.$post_id);
71
	
72
} else {
73
	header('Location: '.WB_URL.'/pages/');
74
}
75

  
76
?>
0 77

  
tags/2.6.1/wb/modules/news/add.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
$header = '<style type=\"text/css\">
30
.post_title, .post_date { border-bottom: 1px solid #DDDDDD; }
31
.post_title { font-weight: bold; font-size: 12px; color: #000000; }
32
.post_date { text-align: right; font-weight: bold; }
33
.post_short { text-align: justify; padding-bottom: 5px; }
34
</style>
35
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">';
36
$post_loop = '<tr class=\"post_top\">
37
<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
38
<td class=\"post_date\">[TIME], [DATE]</td>
39
</tr>
40
<tr>
41
<td class=\"post_short\" colspan=\"2\">
42
[SHORT] 
43
<a href=\"[LINK]\">[TEXT_READ_MORE]</a>
44
</td>
45
</tr>';
46
$footer = '</table>
47
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">
48
<tr>
49
<td width="35%" align="left">[PREVIOUS_PAGE_LINK]</td>
50
<td width="30%" align="center">[OF]</td>
51
<td width="35%" align="right">[NEXT_PAGE_LINK]</td>
52
</tr>
53
</table>';
54
$post_header = addslashes('<table cellpadding="0" cellspacing="0" border="0" width="100%">
55
<tr>
56
<td height="30"><h1>[TITLE]</h1></td>
57
<td rowspan="3" style="display: [DISPLAY_IMAGE]"><img src="[GROUP_IMAGE]" alt="[GROUP_TITLE]" /></td>
58
</tr>
59
<tr>
60
<td valign="top"><b>Posted by [DISPLAY_NAME] ([USERNAME]) on [DATE] at [TIME]</b></td>
61
</tr>
62
<tr style="display: [DISPLAY_GROUP]">
63
<td valign="top"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
64
</tr>
65
</table>
66
<p style="text-align: justify;">');
67
$post_footer = '</p>
68
<a href=\"[BACK]\">Back</a>';
69
$comments_header = addslashes('<br /><br />
70
<style type="text/css">
71
.comment_title { font-weight: bold; }
72
.comment_text { font-weight: bold; background-color: #FDFDFD; border-bottom: 1px solid #DDDDDD; padding-bottom: 15px; }
73
.comment_title, .comment_text { border-left: 1px solid #DDDDDD; }
74
.comment_info { text-align: right; border-right: 1px solid #DDDDDD; }
75
.comment_title, .comment_info { border-top: 1px solid #DDDDDD; background-color: #EEEEEE; }
76
</style>
77
<h2>Comments</h2>
78
<table cellpadding="2" cellspacing="0" border="0" width="100%">');
79
$comments_loop = addslashes('<tr>
80
<td class="comment_title">[TITLE]</td>
81
<td class="comment_info">By [DISPLAY_NAME] on [DATE] at [TIME]</td>
82
</tr>
83
<tr>
84
<td colspan="2" class="comment_text">[COMMENT]</td>
85
</tr>');
86
$comments_footer = '</table>
87
<br /><a href=\"[ADD_COMMENT_URL]\">Add Comment</a>';
88
$comments_page = '<h1>Comment</h1>
89
<h2>[POST_TITLE]</h2>
90
<br />';
91
$commenting = 'none';
92
$use_captcha = true;
93
$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_settings (section_id,page_id,header,post_loop,footer,post_header,post_footer,comments_header,comments_loop,comments_footer,comments_page,commenting,use_captcha) VALUES ('$section_id','$page_id','$header','$post_loop','$footer','$post_header','$post_footer','$comments_header','$comments_loop','$comments_footer','$comments_page','$commenting','$use_captcha')");
94

  
95
?>
0 96

  
tags/2.6.1/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'] = ($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 = ($fetch_settings['header']);
86
		$setting_post_loop = ($fetch_settings['post_loop']);
87
		$setting_footer = ($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 * 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 = ($post['content_short']);
189
				$wb->preprocess($short);
190
				// Replace vars with values
191
				$post_long_len = strlen($post['content_long']);
192
				$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]');
193
				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
194
					if($post_long_len < 9) {
195
						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '');
196
					} else {
197
						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $TEXT['READ_MORE']);
198
					}
199
				} else {
200
					if($post_long_len < 9) {
201
						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, '', '', '', '', '');
202
					} else {
203
						$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, $post['title'], $short, $post_link, $post_date, $post_time, '', '', '', '', $TEXT['READ_MORE']);
204
					}
205
				}
206
				echo str_replace($vars, $values, $setting_post_loop);
207
			}
208
		}
209
	}
210
	
211
	// Print footer
212
	if($display_previous_next_links == 'none') {
213
		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);
214
	} else {
215
		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);
216
	}
217
	
218
} elseif(defined('POST_ID') AND is_numeric(POST_ID)) {
219
	
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff