Project

General

Profile

« Previous | Next » 

Revision 106

Added by stefan about 19 years ago

Renamed compatibility.php to frontend.functions.php.
Moved frontend functions from class frontend to frontend.functions.php.
Removed instances of strip_slashes_dummy. Replaced $this by $wb in a couple of places.
Created file initialize.php, where all initializations now take place (moved from class wb constructor).

View differences:

trunk/wb/search/search.php
42 42
			$string=$_REQUEST['string'];
43 43
		}
44 44
		// reverse potential magic_quotes action
45
		$original_string=$this->strip_slashes($string);
45
		$original_string=$wb->strip_slashes($string);
46 46
		// Double backslashes (mySQL needs doubly escaped backslashes in LIKE comparisons)
47
		$string = addslashes($this->escape_backslashes($original_string));
47
		$string = addslashes($wb->escape_backslashes($original_string));
48 48
		// then escape for mySQL query
49 49
		$search_string = htmlspecialchars($original_string,ENT_QUOTES);
50 50
	} else {
......
105 105
	// Replace vars in search settings with values
106 106
	$vars = array('[SEARCH_STRING]', '[WB_URL]', '[PAGE_EXTENSION]', '[TEXT_RESULTS_FOR]');
107 107
	$values = array($search_string, WB_URL, PAGE_EXTENSION, $TEXT['RESULTS_FOR']);
108
	$search_footer = str_replace($vars, $values, $this->strip_slashes_dummy($fetch_footer['value']));
109
	$search_results_header = str_replace($vars, $values, $this->strip_slashes_dummy($fetch_results_header['value']));
110
	$search_results_footer = str_replace($vars, $values, $this->strip_slashes_dummy($fetch_results_footer['value']));
108
	$search_footer = str_replace($vars, $values, ($fetch_footer['value']));
109
	$search_results_header = str_replace($vars, $values, ($fetch_results_header['value']));
110
	$search_results_footer = str_replace($vars, $values, ($fetch_results_footer['value']));
111 111
	// Do extra vars/values replacement
112 112
	$vars = array('[SEARCH_STRING]', '[WB_URL]', '[PAGE_EXTENSION]', '[TEXT_SEARCH]', '[TEXT_ALL_WORDS]', '[TEXT_ANY_WORDS]', '[TEXT_EXACT_MATCH]', '[TEXT_MATCH]', '[TEXT_MATCHING]', '[ALL_CHECKED]', '[ANY_CHECKED]', '[EXACT_CHECKED]');
113 113
	$values = array($search_string, WB_URL, PAGE_EXTENSION, $TEXT['SEARCH'], $TEXT['ALL_WORDS'], $TEXT['ANY_WORDS'], $TEXT['EXACT_MATCH'], $TEXT['MATCH'], $TEXT['MATCHING'], $all_checked, $any_checked, $exact_checked);
114
	$search_header = str_replace($vars, $values, $this->strip_slashes_dummy($fetch_header['value']));
114
	$search_header = str_replace($vars, $values, ($fetch_header['value']));
115 115
	
116 116
	// Insert js code
117 117
	?>
......
160 160
					$date = $TEXT['UNKNOWN'].' '.$TEXT['DATE'];
161 161
					$time = $TEXT['UNKNOWN'].' '.$TEXT['TIME'];
162 162
				}
163
				$values = array($link, $this->strip_slashes_dummy($page['page_title']),$this->strip_slashes_dummy($page['description']), $users[$page['modified_by']]['username'], $users[$page['modified_by']]['display_name'], $date, $time, $TEXT['LAST_UPDATED_BY'], strtolower($TEXT['ON']));
163
				$values = array($link, ($page['page_title']),($page['description']), $users[$page['modified_by']]['username'], $users[$page['modified_by']]['display_name'], $date, $time, $TEXT['LAST_UPDATED_BY'], strtolower($TEXT['ON']));
164 164
				// Show loop code with vars replaced by values
165 165
				if($values != array()) {
166
					echo str_replace($vars, $values, $this->strip_slashes_dummy($fetch_results_loop['value']));
166
					echo str_replace($vars, $values, ($fetch_results_loop['value']));
167 167
				}
168 168
				// Say that we have already listed this page id
169 169
				$pages_listed[$page['page_id']] = true;
......
186 186
					// Fetch query start
187 187
					$fetch_query_start = $get_query_start->fetchRow();
188 188
					// Prepare query start for execution by replacing {TP} with the TABLE_PREFIX
189
					$query_start = str_replace('[TP]', TABLE_PREFIX, $this->strip_slashes_dummy($fetch_query_start['value']));
189
					$query_start = str_replace('[TP]', TABLE_PREFIX, ($fetch_query_start['value']));
190 190
					// Get query end
191 191
					$get_query_end = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'query_end' AND extra = '$module_name' LIMIT 1");
192 192
					if($get_query_end->numRows() > 0) {
193 193
						// Fetch query start
194 194
						$fetch_query_end = $get_query_end->fetchRow();
195 195
						// Set query end
196
						$query_end = $this->strip_slashes_dummy($fetch_query_end['value']);
196
						$query_end = ($fetch_query_end['value']);
197 197
						// Get query body
198 198
						$get_query_body = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'query_body' AND extra = '$module_name' LIMIT 1");
199 199
						if($get_query_body->numRows() > 0) {
200 200
							// Fetch query start
201 201
							$fetch_query_body = $get_query_body->fetchRow();
202 202
							// Prepare query body for execution by replacing {STRING} with the correct one
203
							$query_body = str_replace(array('[TP]','[O]','[W]'), array(TABLE_PREFIX,'LIKE','%'), $this->strip_slashes_dummy($fetch_query_body['value']));
203
							$query_body = str_replace(array('[TP]','[O]','[W]'), array(TABLE_PREFIX,'LIKE','%'), ($fetch_query_body['value']));
204 204
							// Loop through query body for each string, then combine with start and end
205 205
							$prepared_query = $query_start;
206 206
							$count = 0;
......
228 228
											$date = $TEXT['UNKNOWN'].' '.$TEXT['DATE'];
229 229
											$time = $TEXT['UNKNOWN'].' '.$TEXT['TIME'];
230 230
										}
231
										$values = array($link, $this->strip_slashes_dummy($page[$fields['title']]), $this->strip_slashes_dummy($page[$fields['description']]), $users[$page[$fields['modified_by']]]['username'], $users[$page[$fields['modified_by']]]['display_name'], $date, $time, $TEXT['LAST_UPDATED_BY'], strtolower($TEXT['ON']));
231
										$values = array($link, ($page[$fields['title']]), ($page[$fields['description']]), $users[$page[$fields['modified_by']]]['username'], $users[$page[$fields['modified_by']]]['display_name'], $date, $time, $TEXT['LAST_UPDATED_BY'], strtolower($TEXT['ON']));
232 232
										// Show loop code with vars replaced by values
233
										echo str_replace($vars, $values, $this->strip_slashes_dummy($fetch_results_loop['value']));
233
										echo str_replace($vars, $values, ($fetch_results_loop['value']));
234 234
										// Say that this page or item has been listed if we can
235 235
										if(isset($fields['page_id'])) {
236 236
											$pages_listed[$page[$fields['page_id']]] = true;
trunk/wb/search/index.php
1 1
<?php
2 2

  
3
// $Id: index.php,v 1.3 2005/04/02 06:27:52 rdjurovich Exp $
3
// $Id$
4 4

  
5 5
/*
6 6

  
......
23 23

  
24 24
*/
25 25

  
26
// Include the config file
27
require('../config.php');
28
require_once(WB_PATH."/framework/class.frontend.php");
29
$wb = new frontend();
30

  
31

  
26 32
// Required page details
27 33
$page_id = 0;
28 34
$page_description = '';
......
37 43
define('VISIBILITY', 'public');
38 44
define('PAGE_CONTENT', 'search.php');
39 45

  
40
// Include the config file
41
require('../config.php');
42 46

  
43 47
// Include database class file
44 48
require_once(WB_PATH.'/framework/class.database.php');
trunk/wb/install/save.php
280 280
"define('ADMIN_PATH', '$wb_path/admin');\n".
281 281
"define('ADMIN_URL', '$wb_url/admin');\n".
282 282
"\n".
283
"require_once(WB_PATH.'/framework/initialize.php');\n".
283 284
"?>";
284 285

  
285 286
$config_filename = '../config.php';
......
300 301
}
301 302

  
302 303
// Include configuration file
303
require('../config.php');
304
define('DB_TYPE', 'mysql');
305
define('DB_HOST', $database_host);
306
define('DB_USERNAME', $database_username);
307
define('DB_PASSWORD', $database_password);
308
define('DB_NAME', $database_name);
309
define('TABLE_PREFIX', $table_prefix);
310
define('WB_PATH', $wb_path);
311
define('WB_URL', $wb_url);
312
define('ADMIN_PATH', $wb_path.'/admin');
313
define('ADMIN_URL', $wb_url.'/admin');
304 314

  
315
//require('../config.php');
316

  
305 317
// Check if the user has entered a correct path
306 318
if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
307 319
	set_error('It appears the Absolute path that you entered is incorrect');
......
548 560
	// Search template
549 561
	$database->query("INSERT INTO `".TABLE_PREFIX."search` (name) VALUES ('template')");
550 562
	
551
	$wb=new wb();
563
	require_once(WB_PATH.'/framework/initialize.php');
564
	$wb = new wb();
552 565
	
553 566
	// Include the pre-installed module install scripts
554 567
	require(WB_PATH.'/modules/wysiwyg/install.php');
trunk/wb/modules/wrapper/view.php
26 26
// Get url
27 27
$get_settings = $database->query("SELECT url,height FROM ".TABLE_PREFIX."mod_wrapper WHERE section_id = '$section_id'");
28 28
$fetch_settings = $get_settings->fetchRow();
29
$url = $this->strip_slashes_dummy($fetch_settings['url']);
29
$url = ($fetch_settings['url']);
30 30

  
31 31
?>
32 32
<iframe src="<?php echo $url; ?>" width="100%" height="<?php echo $fetch_settings['height']; ?>px" frameborder="0" scrolling="auto">
trunk/wb/modules/wysiwyg/view.php
26 26
// Get content
27 27
$get_content = $database->query("SELECT content FROM ".TABLE_PREFIX."mod_wysiwyg WHERE section_id = '$section_id'");
28 28
$fetch_content = $get_content->fetchRow();
29
$content = $this->strip_slashes_dummy($fetch_content['content']);
29
$content = ($fetch_content['content']);
30 30

  
31
$this->preprocess($content);
31
$wb->preprocess($content);
32 32

  
33 33
echo $content;
34 34

  
trunk/wb/modules/form/view.php
113 113
$query_settings = $database->query("SELECT header,field_loop,footer FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
114 114
if($query_settings->numRows() > 0) {
115 115
	$fetch_settings = $query_settings->fetchRow();
116
	$header = $this->strip_slashes_dummy($fetch_settings['header']);
117
	$field_loop = $this->strip_slashes_dummy($fetch_settings['field_loop']);
118
	$footer = $this->strip_slashes_dummy($fetch_settings['footer']);
116
	$header = $fetch_settings['header'];
117
	$field_loop = $fetch_settings['field_loop'];
118
	$footer = $fetch_settings['footer'];
119 119
} else {
120 120
	$header = '';
121 121
	$field_loop = '';
......
136 136
	while($field = $query_fields->fetchRow()) {
137 137
		// Set field values
138 138
		$field_id = $field['field_id'];
139
		$value = $this->strip_slashes_dummy($field['value']);
139
		$value = $field['value'];
140 140
		// Print field_loop after replacing vars with values
141 141
		$vars = array('{TITLE}', '{REQUIRED}');
142 142
		$values = array($field['title']);
......
198 198
	$query_settings = $database->query("SELECT email_to,email_from,email_subject,success_message,max_submissions,stored_submissions FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
199 199
	if($query_settings->numRows() > 0) {
200 200
		$fetch_settings = $query_settings->fetchRow();
201
		$email_to = $this->strip_slashes_dummy($fetch_settings['email_to']);
202
		$email_from = $this->strip_slashes_dummy($fetch_settings['email_from']);
201
		$email_to = $fetch_settings['email_to'];
202
		$email_from = $fetch_settings['email_from'];
203 203
		if(substr($email_from, 0, 5) == 'field') {
204 204
			// Set the email from field to what the user entered in the specified field
205
			$email_from = $this->add_slashes($_POST[$email_from]);
205
			$email_from = $wb->add_slashes($_POST[$email_from]);
206 206
		}
207
		$email_subject = $this->strip_slashes_dummy($fetch_settings['email_subject']);
208
		$success_message = $this->strip_slashes_dummy($fetch_settings['success_message']);
209
		$max_submissions = $this->strip_slashes_dummy($fetch_settings['max_submissions']);
210
		$stored_submissions = $this->strip_slashes_dummy($fetch_settings['stored_submissions']);
207
		$email_subject = $fetch_settings['email_subject'];
208
		$success_message = $fetch_settings['success_message'];
209
		$max_submissions = $fetch_settings['max_submissions'];
210
		$stored_submissions = $fetch_settings['stored_submissions'];
211 211
	} else {
212 212
		exit($TEXT['UNDER_CONSTRUCTION']);
213 213
	}
......
231 231
					} elseif (!is_array($_POST['field'.$field['field_id']])) {
232 232
					$email_body .= '
233 233
					
234
	'.$this->strip_slashes_dummy($field['title']).': '.$_POST['field'.$field['field_id']]."\n";
234
	'.$field['title'].': '.$_POST['field'.$field['field_id']]."\n";
235 235
					} else {
236 236
						$email_body .= '
237 237
					
238
	'.$this->strip_slashes_dummy($field['title']).": \n";
238
	'.$field['title'].": \n";
239 239
						foreach ($_POST['field'.$field['field_id']] as $k=>$v) {
240 240
							$email_body .= '
241 241
					
......
243 243
						}
244 244
					}
245 245
				} elseif($field['required'] == 1) {
246
				$required[] = $this->strip_slashes_dummy($field['title']);
246
				$required[] = $field['title'];
247 247
				}
248 248
			}
249 249
		}
250 250
	}
251 251
	
252 252
	// Addslashes to email body - proposed by Icheb in topic=1170.0
253
	// $email_body = $this->add_slashes($email_body);
253
	// $email_body = $wb->add_slashes($email_body);
254 254
	
255 255
	// Check if the user forgot to enter values into all the required fields
256 256
	if($required != array()) {
......
288 288
			} else {
289 289
				$submitted_by = 0;
290 290
			}
291
			$email_body = $this->add_slashes($email_body);
291
			$email_body = $wb->add_slashes($email_body);
292 292
			$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_submissions (page_id,section_id,submitted_when,submitted_by,body) VALUES ('".PAGE_ID."','$section_id','".mktime()."','$submitted_by','$email_body')");
293 293
			// Make sure submissions table isn't too full
294 294
			$query_submissions = $database->query("SELECT submission_id FROM ".TABLE_PREFIX."mod_form_submissions ORDER BY submitted_when");
trunk/wb/modules/code/view.php
26 26
// Get content
27 27
$get_content = $database->query("SELECT content FROM ".TABLE_PREFIX."mod_code WHERE section_id = '$section_id'");
28 28
$fetch_content = $get_content->fetchRow();
29
$content = $this->strip_slashes_dummy($fetch_content['content']);
29
$content = $fetch_content['content'];
30 30
eval($content);
31 31

  
32 32
?>
trunk/wb/modules/news/comment_page.php
35 35
	// Print comments page
36 36
	$vars = array('[POST_TITLE]', '[ACTION_URL]');
37 37
	$values = array(POST_TITLE, WB_URL.'/modules/news/submit_comment.php?page_id='.PAGE_ID.'&section_id='.SECTION_ID.'&post_id='.POST_ID);
38
	echo str_replace($vars, $values, $this->strip_slashes_dummy($settings['comments_page']));
38
	echo str_replace($vars, $values, ($settings['comments_page']));
39 39
}
40 40

  
41 41
?>
trunk/wb/modules/news/view.php
55 55
	while($group = $query_users->fetchRow()) {
56 56
		// Insert user info into users array
57 57
		$group_id = $group['group_id'];
58
		$groups[$group_id]['title'] = $this->strip_slashes_dummy($group['title']);
58
		$groups[$group_id]['title'] = ($group['title']);
59 59
		$groups[$group_id]['active'] = $group['active'];
60 60
		if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) {
61 61
			$groups[$group_id]['image'] = WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
......
82 82
	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
83 83
	if($query_settings->numRows() > 0) {
84 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']);
85
		$setting_header = ($fetch_settings['header']);
86
		$setting_post_loop = ($fetch_settings['post_loop']);
87
		$setting_footer = ($fetch_settings['footer']);
88 88
		$setting_posts_per_page = $fetch_settings['posts_per_page'];
89 89
	} else {
90 90
		$setting_header = '';
......
185 185
				if($group_image == '') { $display_image = 'none'; } else { $display_image = ''; }
186 186
				if($group_id == 0) { $display_group = 'none'; } else { $display_group = ''; }
187 187
				// Replace [wblink--PAGE_ID--] with real link
188
				$short = $this->strip_slashes_dummy($post['content_short']);
189
				$this->preprocess($short);
188
				$short = ($post['content_short']);
189
				$wb->preprocess($short);
190 190
				// Replace vars with values
191 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 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']);
193
					$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']);
194 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']);
195
					$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']);
196 196
				}
197 197
				echo str_replace($vars, $values, $setting_post_loop);
198 198
			}
......
212 212
	$query_settings = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings WHERE section_id = '$section_id'");
213 213
	if($query_settings->numRows() > 0) {
214 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']);
215
		$setting_post_header = ($fetch_settings['post_header']);
216
		$setting_post_footer = ($fetch_settings['post_footer']);
217
		$setting_comments_header = ($fetch_settings['comments_header']);
218
		$setting_comments_loop = ($fetch_settings['comments_loop']);
219
		$setting_comments_footer = ($fetch_settings['comments_footer']);
220 220
	} else {
221 221
		$setting_post_header = '';
222 222
		$setting_post_footer = '';
......
258 258
			if($group_id == 0) { $display_group = 'none'; } else { $display_group = ''; }
259 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 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']);
261
				$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, ($post['title']), ($post['content_short']), $page_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email']);
262 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, '', '', '', '');
263
				$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, ($post['title']), ($post['content_short']), $page_link, $post_date, $post_time, '', '', '', '');
264 264
			}
265
			$post_long = $this->strip_slashes_dummy($post['content_long']);
265
			$post_long = ($post['content_long']);
266 266
		}
267 267
	} else {
268 268
		header('Location: '.WB_URL.'/pages/');
......
272 272
	echo str_replace($vars, $values, $setting_post_header);
273 273
	
274 274
	// Replace [wblink--PAGE_ID--] with real link
275
  	$this->preprocess($postlong);
275
  	$wb->preprocess($postlong);
276 276
	// Print long
277 277
	echo $post_long;
278 278
	
......
290 290
		if($query_comments->numRows() > 0) {
291 291
			while($comment = $query_comments->fetchRow()) {
292 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']);
293
				$comment['comment'] = nl2br(($comment['comment']));
294
				$comment['title'] = ($comment['title']);
295 295
				// Print comments loop
296 296
				$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
297 297
				$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
298 298
				$uid = $comment['commented_by'];
299 299
				$vars = array('[TITLE]','[COMMENT]','[DATE]','[TIME]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
300 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']));
301
					$values = array(($comment['title']), ($comment['comment']), $commented_date, $commented_time, $uid, ($users[$uid]['username']), ($users[$uid]['display_name']), ($users[$uid]['email']));
302 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'], '');
303
					$values = array(($comment['title']), ($comment['comment']), $commented_date, $commented_time, '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], '');
304 304
				}
305 305
				echo str_replace($vars, $values, $setting_comments_loop);
306 306
			}
trunk/wb/account/logout.php
1 1
<?php
2 2

  
3
// $Id: logout.php,v 1.4 2005/04/16 01:12:40 rdjurovich Exp $
3
// $Id$
4 4

  
5 5
/*
6 6

  
......
25 25

  
26 26
require("../config.php");
27 27

  
28
// Start a session
29
if(!defined('SESSION_STARTED')) {
30
	session_name(APP_NAME.'_session_id');
31
	session_start();
32
	define('SESSION_STARTED', true);
33
}
34

  
35 28
$_SESSION['USER_ID'] = null;
36 29
$_SESSION['GROUP_ID'] = null;
37 30
$_SESSION['USERNAME'] = null;
trunk/wb/account/forgot_form.php
36 36
	$email = $_POST['email'];
37 37
	
38 38
	// Check if the email exists in the database
39
	$query = "SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users WHERE email = '".$this->add_slashes($_POST['email'])."'";
39
	$query = "SELECT user_id,username,display_name,email FROM ".TABLE_PREFIX."users WHERE email = '".$wb->add_slashes($_POST['email'])."'";
40 40
	$results = $database->query($query);
41 41
	if($results->numRows() > 0) {
42 42
		// Get the id, username, and email from the above db query
trunk/wb/account/signup2.php
75 75
}
76 76

  
77 77
// Check if the email already exists
78
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE email = '".$this->add_slashes($_POST['email'])."'");
78
$results = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE email = '".$wb->add_slashes($_POST['email'])."'");
79 79
if($results->numRows() > 0) {
80 80
	if(isset($MESSAGE['USERS']['EMAIL_TAKEN'])) {
81 81
		$admin->print_error($MESSAGE['USERS']['EMAIL_TAKEN'], $js_back);
trunk/wb/framework/compatibility.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
/*
27
	This file is purely for ensuring compatibility with 3rd party
28
	contributions made for WB version 2.5.2 or below
29
*/
30
if(!defined('WB_URL')) {
31
	header('Location: ../index.php');
32
}
33

  
34
function page_link($link) {
35
	global $wb;
36
	return $wb->page_link($link);
37
}
38

  
39

  
40
function page_content($block=1) {
41
	global $wb;
42
	$wb->content($block);
43
}
44

  
45
// Old menu call invokes new menu function
46
function page_menu($parent = 0, $menu_number = 1, $item_template = '<li><span[class]>[a][menu_title][/a]</span>', $menu_header = '<ul>', $menu_footer = '</ul>', $default_class = ' class="menu_default"', $current_class = ' class="menu_current"', $recurse = LEVEL) {
47
	global $wb;
48
	$wb->menu_number=$menu_number;
49
	$wb->menu_item_template=$item_template;
50
	$wb->menu_parent = $parent;
51
	$wb->menu_header = $menu_header; 
52
	$wb->menu_footer = $menu_footer;
53
	$wb->menu_default_class = $default_class;
54
	$wb->menu_current_class = $current_class;
55
	$wb->menu_recurse = $recurse+2; 	
56
	$wb->menu();
57
}
58

  
59
// Function for page title
60
function page_title($spacer = ' - ', $template = '[WEBSITE_TITLE][SPACER][PAGE_TITLE]') {
61
	global $wb;
62
	$wb->page_title($spacer,$template);
63
}
64

  
65
// Function for page description
66
function page_description() {
67
	global $wb;
68
	$wb->page_description();
69
}
70
// Function for page keywords
71
function page_keywords() {
72
	global $wb;
73
	$wb->page_keywords();
74
}
75
// Function for page header
76
function page_header($date_format = 'Y') {
77
	global $wb;
78
	$wb->page_header($date_format);
79
}
80
// Function for page footer
81
function page_footer($date_format = 'Y') {
82
	global $wb;
83
	$wb->page_footer($date_format);
84
}
85

  
86
// references to objects and variables that changed their names
87

  
88
$admin = &$wb;
89

  
90
$default_link=&$wb->default_link;
91

  
92
$page_trail=&$wb->page_trail;
93
$page_description=&$wb->page_description;
94
$page_keywords=&$wb->page_keywords;
95
$page_link=&$wb->link;
96

  
97
// extra_sql is not used anymore - this is basically a register_globals exploit prevention...
98
$extra_sql=&$wb->extra_sql;
99
$extra_where_sql=&$wb->extra_where_sql;
100

  
101

  
102
// Begin WB < 2.4.x template compatibility code
103
	// Make extra_sql accessable through private_sql
104
	$private_sql = $extra_sql;
105
	$private_where_sql = $extra_where_sql;
106
	// Query pages for menu
107
	$menu1 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '0' AND $extra_where_sql ORDER BY position ASC");
108
	// Check if current pages is a parent page and if we need its submenu
109
	if(PARENT == 0) {
110
		// Get the pages submenu
111
		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PAGE_ID."' AND $extra_where_sql ORDER BY position ASC");
112
	} else {
113
		// Get the pages submenu
114
		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PARENT."' AND $extra_where_sql ORDER BY position ASC");
115
	}
116
// End WB < 2.4.x template compatibility code
117
// Include template file
118

  
119

  
120
?>
121 0

  
trunk/wb/framework/class.admin.php
38 38

  
39 39
require_once(WB_PATH.'/framework/class.wb.php');
40 40

  
41
//require_once(WB_PATH.'/framework/initialize.php');
42

  
43 41
// Include PHPLIB template class
44 42
require_once(WB_PATH."/include/phplib/template.inc");
45 43

  
......
94 92
													'SECTION_NAME' => $MENU[strtoupper($this->section_name)],
95 93
													'INTERFACE_DIR' => ADMIN_URL.'/interface',
96 94
													'BODY_TAGS' => $body_tags,
97
													'WEBSITE_TITLE' => $this->strip_slashes_dummy($title['value']),
95
													'WEBSITE_TITLE' => ($title['value']),
98 96
													'TEXT_ADMINISTRATION' => $TEXT['ADMINISTRATION'],
99 97
													'VERSION' => VERSION
100 98
													)
trunk/wb/framework/class.wb.php
30 30
This class is the basis for admin and frontend classes.
31 31

  
32 32
*/
33
if (file_exists(WB_PATH.'/framework/class.database.php'))
34
	require_once(WB_PATH.'/framework/class.database.php');
35
		
36 33

  
34
require_once(WB_PATH.'/framework/class.database.php');
35

  
37 36
class wb
38 37
{
39 38
	// General initialization function 
40 39
	// performed when frontend or backend is loaded.
41 40
	function wb() {
42
		// set global database variable
43
		global $database;
44
		// Create database class
45
		$this->database = new database();
46
		$database=$this->database;
47

  
48
		// Start a session
49
		if(!defined('SESSION_STARTED')) {
50
			session_name(APP_NAME.'_session_id');
51
			session_start();
52
			define('SESSION_STARTED', true);
53
		}
54

  
55
		set_magic_quotes_runtime(0);
56
		
57
		// Get website settings (title, keywords, description, header, and footer)
58
		$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
59
		$get_settings = $database->query($query_settings);
60
		while($setting = $get_settings->fetchRow()) {
61
			$setting_name=strtoupper($setting['name']);
62
			$setting_value=$setting['value'];
63
			if ($setting_value=='false')
64
				$setting_value=false;
65
			if ($setting_value=='true')
66
				$setting_value=true;
67
			define($setting_name,$setting_value);
68
		}
69
		$string_file_mode = STRING_FILE_MODE;
70
		define('OCTAL_FILE_MODE',(int) $string_file_mode);
71
		$string_dir_mode = STRING_DIR_MODE;
72
		define('OCTAL_DIR_MODE',(int) $string_dir_mode);
73
		
74
		// Get users language
75
		if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
76
		  	define('LANGUAGE', strtoupper($_GET['lang']));
77
			$_SESSION['LANGUAGE']=LANGUAGE;
78
		} else {
79
			if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
80
				define('LANGUAGE', $_SESSION['LANGUAGE']);
81
			} else {
82
				define('LANGUAGE', DEFAULT_LANGUAGE);
83
			}
84
		}
85

  
86
		// make language variables globally accessible
87
		global $language_code, $language_name, $language_author, $language_version, $language_designed_for;
88
		global $MENU, $OVERVIEW, $TEXT, $HEADING, $MESSAGE;
89
		// Load Language file
90
		if(!defined('LANGUAGE_LOADED')) {
91
			if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
92
				exit('Error loading language file '.LANGUAGE.', please check configuration');
93
			} else {
94
				require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
95
			}
96
		}
97
		
98
		// Get users timezone
99
		if(isset($_SESSION['TIMEZONE'])) {
100
			define('TIMEZONE', $_SESSION['TIMEZONE']);
101
		} else {
102
			define('TIMEZONE', DEFAULT_TIMEZONE);
103
		}
104
		// Get users date format
105
		if(isset($_SESSION['DATE_FORMAT'])) {
106
			define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
107
		} else {
108
			define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
109
		}
110
		// Get users time format
111
		if(isset($_SESSION['TIME_FORMAT'])) {
112
			define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
113
		} else {
114
			define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
115
		}
116 41
	}
117 42

  
118 43
	// Check whether we should show a page or not (for front-end)
......
233 158

  
234 159
	// Get the current users display name
235 160
	function get_display_name() {
236
		return $this->strip_slashes_dummy($_SESSION['DISPLAY_NAME']);
161
		return ($_SESSION['DISPLAY_NAME']);
237 162
	}
238 163

  
239 164
	// Get the current users email address
trunk/wb/framework/initialize.php
1
<?php
2

  
3
// $Id$
4

  
5

  
6
/*
7

  
8
 Website Baker Project <http://www.websitebaker.org/>
9
 Copyright (C) 2004-2005, Ryan Djurovich
10

  
11
 Website Baker is free software; you can redistribute it and/or modify
12
 it under the terms of the GNU General Public License as published by
13
 the Free Software Foundation; either version 2 of the License, or
14
 (at your option) any later version.
15

  
16
 Website Baker is distributed in the hope that it will be useful,
17
 but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 GNU General Public License for more details.
20

  
21
 You should have received a copy of the GNU General Public License
22
 along with Website Baker; if not, write to the Free Software
23
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24

  
25
*/
26
 
27
if (file_exists(WB_PATH.'/framework/class.database.php'))
28
{
29
	require_once(WB_PATH.'/framework/class.database.php');
30
		
31
	// Create database class
32
	$database = new database();
33
	
34
	// Start a session
35
	if(!defined('SESSION_STARTED')) {
36
		session_name(APP_NAME.'_session_id');
37
		session_start();
38
		define('SESSION_STARTED', true);
39
	}
40
	
41
	set_magic_quotes_runtime(0);
42
	
43
	// Get website settings (title, keywords, description, header, and footer)
44
	$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
45
	$get_settings = $database->query($query_settings);
46
	while($setting = $get_settings->fetchRow()) {
47
		$setting_name=strtoupper($setting['name']);
48
		$setting_value=$setting['value'];
49
		if ($setting_value=='false')
50
			$setting_value=false;
51
		if ($setting_value=='true')
52
			$setting_value=true;
53
		define($setting_name,$setting_value);
54
	}
55
	$string_file_mode = STRING_FILE_MODE;
56
	define('OCTAL_FILE_MODE',(int) $string_file_mode);
57
	$string_dir_mode = STRING_DIR_MODE;
58
	define('OCTAL_DIR_MODE',(int) $string_dir_mode);
59
	
60
	// Get users language
61
	if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
62
	  	define('LANGUAGE', strtoupper($_GET['lang']));
63
		$_SESSION['LANGUAGE']=LANGUAGE;
64
	} else {
65
		if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
66
			define('LANGUAGE', $_SESSION['LANGUAGE']);
67
		} else {
68
			define('LANGUAGE', DEFAULT_LANGUAGE);
69
		}
70
	}
71
	
72
	// Load Language file
73
	if(!defined('LANGUAGE_LOADED')) {
74
		if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
75
			exit('Error loading language file '.LANGUAGE.', please check configuration');
76
		} else {
77
			require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
78
		}
79
	}
80
	
81
	// Get users timezone
82
	if(isset($_SESSION['TIMEZONE'])) {
83
		define('TIMEZONE', $_SESSION['TIMEZONE']);
84
	} else {
85
		define('TIMEZONE', DEFAULT_TIMEZONE);
86
	}
87
	// Get users date format
88
	if(isset($_SESSION['DATE_FORMAT'])) {
89
		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
90
	} else {
91
		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
92
	}
93
	// Get users time format
94
	if(isset($_SESSION['TIME_FORMAT'])) {
95
		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
96
	} else {
97
		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
98
	}
99
	
100
	
101
}
102
?>
0 103

  
trunk/wb/framework/class.frontend.php
75 75
				$content = fread($handle, filesize($filename));
76 76
				fclose($handle);
77 77
				$this->preprocess($content);
78
				echo $this->strip_slashes_dummy($content);
78
				echo ($content);
79 79
				return false;
80 80
			}
81 81
		}
......
143 143
			// Page ID
144 144
			define('PAGE_ID', $this->page['page_id']);
145 145
			// Page Title
146
			define('PAGE_TITLE', $this->strip_slashes_dummy($this->page['page_title']));
146
			define('PAGE_TITLE', ($this->page['page_title']));
147 147
			$this->page_title=PAGE_TITLE;
148 148
			// Menu Title
149
			$menu_title = $this->strip_slashes_dummy($this->page['menu_title']);
149
			$menu_title = ($this->page['menu_title']);
150 150
			if($menu_title != '') {
151 151
				define('MENU_TITLE', $menu_title);
152 152
			} else {
......
278 278
	}
279 279
	
280 280
	function menu() {
281
	   if (!isset($this->menu_number)) {
282
	   	$this->menu_number = 1;
281
		global $wb;
282
	   if (!isset($wb->menu_number)) {
283
	   	$wb->menu_number = 1;
283 284
	   }
284
	   if (!isset($this->menu_start_level)) {
285
	   	$this->menu_start_level = 0;
285
	   if (!isset($wb->menu_start_level)) {
286
	   	$wb->menu_start_level = 0;
286 287
	   }
287
	   if (!isset($this->menu_recurse)) {
288
	   	$this->menu_recurse = -1;
288
	   if (!isset($wb->menu_recurse)) {
289
	   	$wb->menu_recurse = -1;
289 290
	   }
290
	   if (!isset($this->menu_collapse)) {
291
	   	$this->menu_collapse = true;
291
	   if (!isset($wb->menu_collapse)) {
292
	   	$wb->menu_collapse = true;
292 293
	   }
293
	   if (!isset($this->menu_item_template)) {
294
	   	$this->menu_item_template = '<li><span[class]>[a][menu_title][/a]</span>';
294
	   if (!isset($wb->menu_item_template)) {
295
	   	$wb->menu_item_template = '<li><span[class]>[a][menu_title][/a]</span>';
295 296
	   }
296
	   if (!isset($this->menu_item_footer)) {
297
	   	$this->menu_item_footer = '</li>';
297
	   if (!isset($wb->menu_item_footer)) {
298
	   	$wb->menu_item_footer = '</li>';
298 299
	   }
299
	   if (!isset($this->menu_header)) {
300
	   	$this->menu_header = '<ul>';
300
	   if (!isset($wb->menu_header)) {
301
	   	$wb->menu_header = '<ul>';
301 302
	   }
302
	   if (!isset($this->menu_footer)) {
303
	   	$this->menu_footer = '<ul>';
303
	   if (!isset($wb->menu_footer)) {
304
	   	$wb->menu_footer = '<ul>';
304 305
	   }
305
	   if (!isset($this->menu_default_class)) {
306
	   	$this->menu_default_class = ' class="menu_default"';
306
	   if (!isset($wb->menu_default_class)) {
307
	   	$wb->menu_default_class = ' class="menu_default"';
307 308
	   }
308
	   if (!isset($this->menu_current_class)) {
309
	   	$this->menu_current_class = ' class="menu_current"';
309
	   if (!isset($wb->menu_current_class)) {
310
	   	$wb->menu_current_class = ' class="menu_current"';
310 311
	   }
311
       if (!isset($this->menu_parent)) {
312
     	$this->menu_parent = 0;
312
       if (!isset($wb->menu_parent)) {
313
     	$wb->menu_parent = 0;
313 314
	   }
314
	   $this->show_menu();
315
	   $wb->show_menu();
315 316
	   if ($start_level>0) {
316
	       $key_array=array_keys($this->page_trail);
317
	       $key_array=array_keys($wb->page_trail);
317 318
	       $real_start=$key_array[$start_level-1];
318 319
	       if (isset($real_start))
319 320
	       {
320
	       		$this->menu_parent=$real_start;
321
	          $this->show_menu();
321
	       	$wb->menu_parent=$real_start;
322
	        $wb->show_menu();
322 323
	       }
323 324
	       return;
324 325
	   }
......
327 328
	
328 329
	function show_menu() {
329 330
	   global $database;
330
	   if ($this->menu_recurse==0)
331
	   global $wb;
332
	   if ($wb->menu_recurse==0)
331 333
	       return;
332 334
	   // Check if we should add menu number check to query
333 335
	   if($menu_parent == 0) {
334
	       $menu_number = "menu = '$this->menu_number'";
336
	       $menu_number = "menu = '$wb->menu_number'";
335 337
	   } else {
336 338
	      $menu_number = '1';
337 339
	   }
338 340
	   // Query pages
339 341
	   $query_menu = $database->query("SELECT page_id,menu_title,page_title,link,target,level,visibility FROM ".
340
	TABLE_PREFIX."pages WHERE parent = '$this->menu_parent' AND $menu_number AND $this->extra_where_sql ORDER BY position ASC");
342
	TABLE_PREFIX."pages WHERE parent = '$wb->menu_parent' AND $menu_number AND $wb->extra_where_sql ORDER BY position ASC");
341 343
	   // Check if there are any pages to show
342 344
	   if($query_menu->numRows() > 0) {
343 345
	   	  // Print menu header
344
	   	  echo "\n".$this->menu_header;
346
	   	  echo "\n".$wb->menu_header;
345 347
	      // Loop through pages
346 348
	      while($page = $query_menu->fetchRow()) {
347 349
	      	 // Check if this page should be shown
......
349 351
	         $vars = array('[class]','[a]', '[/a]', '[menu_title]', '[page_title]');
350 352
	         // Work-out class
351 353
	         if($page['page_id'] == PAGE_ID) {
352
	            $class = $this->menu_current_class;
354
	            $class = $wb->menu_current_class;
353 355
	         } else {
354
	            $class = $this->menu_default_class;
356
	            $class = $wb->menu_default_class;
355 357
	         }
356 358
	         // Check if link is same as first page link, and if so change to WB URL
357
	         if($page['link'] == $this->default_link AND !INTRO_PAGE) {
359
	         if($page['link'] == $wb->default_link AND !INTRO_PAGE) {
358 360
	            $link = WB_URL;
359 361
	         } else {
360
	            $link = $this->page_link($page['link']);
362
	            $link = $wb->page_link($page['link']);
361 363
	         }
362 364
	         // Create values
363
	         $values = array($class,'<a href="'.$link.'" target="'.$page['target'].'" '.$class.'>', '</a>', $this->strip_slashes_dummy($page['menu_title']), $this->strip_slashes_dummy($page['page_title']));
365
	         $values = array($class,'<a href="'.$link.'" target="'.$page['target'].'" '.$class.'>', '</a>', ($page['menu_title']), ($page['page_title']));
364 366
	         // Replace vars with value and print
365
	         echo "\n".str_replace($vars, $values, $this->menu_item_template);
367
	         echo "\n".str_replace($vars, $values, $wb->menu_item_template);
366 368
	         // Generate sub-menu
367
	         if($this->menu_collapse==false OR ($this->menu_collapse==true AND isset($this->page_trail[$page['page_id']]))) {
368
	            $this->menu_recurse--;
369
	            $this->menu_parent=$page['page_id'];
370
	            $this->show_menu();
369
	         if($wb->menu_collapse==false OR ($wb->menu_collapse==true AND isset($wb->page_trail[$page['page_id']]))) {
370
	            $wb->menu_recurse--;
371
	            $wb->menu_parent=$page['page_id'];
372
	            $wb->show_menu();
371 373
	         }
372
	         echo "\n".$this->menu_item_footer;
374
	         echo "\n".$wb->menu_item_footer;
373 375
	      }
374 376
	      // Print menu footer
375
	      echo "\n".$this->menu_footer;
377
	      echo "\n".$wb->menu_footer;
376 378
	   }
377 379
	}
378 380

  
379
	function content($block = 1) {
380
		// Get outside objects
381
		global $TEXT,$MENU,$HEADING,$MESSAGE;
382
		global $globals;
383
		global $database;
384
		$admin = & $this;
385
		if ($this->page_access_denied==true) {
386
            echo $MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS'];
387
			exit();
388
		}
389
		if(isset($globals) AND is_array($globals)) { foreach($globals AS $global_name) { global $$global_name; } }
390
		// Make sure block is numeric
391
		if(!is_numeric($block)) { $block = 1; }
392
		// Include page content
393
		if(!defined('PAGE_CONTENT') OR $block!=1) {
394
			if ($this->page_id==0) {
395
				if ($this->default_block_content=='none') {
396
					return;
397
				}
398
				if (is_numeric($this->default_block_content)) {
399
					$page_id=$this->default_block_content;
400
				} else {
401
					$page_id=$this->default_page-id;
402
				}				
403
			} else {
404
				$page_id=$this->page_id;
405
			}
406
			// First get all sections for this page
407
			$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
408
			if($query_sections->numRows() > 0) {
409
				// Loop through them and include there modules file
410
				while($section = $query_sections->fetchRow()) {
411
					$section_id = $section['section_id'];
412
					$module = $section['module'];
413
					require(WB_PATH.'/modules/'.$module.'/view.php');
414
				}
415
			}
416
		} else {
417
			require(PAGE_CONTENT);
418
		}
419
	}
420 381

  
421
	function breadcrumbs($sep=' > ',$tier=1,$links=true) {
422
		$page_id=&$this->page_id;
423
		if ($page_id!=0)
424
		{
425
	 		global $database;
426
			$bca=&$this->page_trail;
427
			if (sizeof($bca)==0)
428
			        create_breadcrumbs($page_id);
429
			$counter=0;
430
			foreach ($bca as $temp)
431
			{
432
		        if ($counter>=(tier-1));
433
		        {
434
					if ($counter>=$tier) echo $sep;
435
					$query_menu=$database->query("SELECT menu_title,link FROM ".TABLE_PREFIX."pages WHERE page_id=$temp");
436
					$page=$query_menu->fetchRow();
437
					if ($links==true AND $temp!=$page_id)
438
						echo '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>';
439
					else
440
					        echo stripslashes($page['menu_title']);
441
		        }
442
                $counter++;
443
			}
444
		}
445
	}
446

  
447
	// Function for page title
448
	function page_title($spacer = ' - ', $template = '[WEBSITE_TITLE][SPACER][PAGE_TITLE]') {
449
		$vars = array('[WEBSITE_TITLE]', '[PAGE_TITLE]', '[MENU_TITLE]', '[SPACER]');
450
		$values = array(WEBSITE_TITLE, PAGE_TITLE, MENU_TITLE, $spacer);
451
		echo str_replace($vars, $values, $template);
452
	}
453

  
454
	// Function for page description
455
	function page_description() {
456
		echo WEBSITE_DESCRIPTION;
457
	}
458
	// Function for page keywords
459
	function page_keywords() {
460
		echo WEBSITE_KEYWORDS;
461
	}
462
	// Function for page header
463
	function page_header($date_format = 'Y') {
464
		echo WEBSITE_HEADER;
465
	}
466

  
467
	// Function for page footer
468
	function page_footer($date_format = 'Y') {
469
		global $starttime;
470
   		$vars = array('[YEAR]', '[PROCESSTIME]');
471
   		$processtime=(microtime()>$starttime)?microtime()-$starttime:microtime()-$starttime+1;
472
		$values = array(date($date_format),$processtime);
473
		echo str_replace($vars, $values, WEBSITE_FOOTER);
474
	}
475

  
476 382
	// Function to show the "Under Construction" page
477 383
	function print_under_construction() {
478 384
		global $MESSAGE;
trunk/wb/framework/frontend.functions.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
/*
27
	This file is purely for ensuring compatibility with 3rd party
28
	contributions made for WB version 2.5.2 or below
29
*/
30
if(!defined('WB_URL')) {
31
	header('Location: ../index.php');
32
}
33

  
34
// references to objects and variables that changed their names
35

  
36
$admin = &$wb;
37

  
38
$default_link=&$wb->default_link;
39

  
40
$page_trail=&$wb->page_trail;
41
$page_description=&$wb->page_description;
42
$page_keywords=&$wb->page_keywords;
43
$page_link=&$wb->link;
44

  
45
// extra_sql is not used anymore - this is basically a register_globals exploit prevention...
46
$extra_sql=&$wb->extra_sql;
47
$extra_where_sql=&$wb->extra_where_sql;
48

  
49
// compatibility code
50
function page_link($link) {
51
	global $wb;
52
	return $wb->page_link($link);
53
}
54

  
55
// Old menu call invokes new menu function
56
function page_menu($parent = 0, $menu_number = 1, $item_template = '<li><span[class]>[a][menu_title][/a]</span>', $menu_header = '<ul>', $menu_footer = '</ul>', $default_class = ' class="menu_default"', $current_class = ' class="menu_current"', $recurse = LEVEL) {
57
	global $wb;
58
	$wb->menu_number=$menu_number;
59
	$wb->menu_item_template=$item_template;
60
	$wb->menu_parent = $parent;
61
	$wb->menu_header = $menu_header; 
62
	$wb->menu_footer = $menu_footer;
63
	$wb->menu_default_class = $default_class;
64
	$wb->menu_current_class = $current_class;
65
	$wb->menu_recurse = $recurse+2; 	
66
	$wb->menu();
67
}
68

  
69
function page_content($block = 1) {
70
	// Get outside objects
71
	global $TEXT,$MENU,$HEADING,$MESSAGE;
72
	global $globals;
73
	global $database;
74
	$admin = & $this;
75
	global $wb;
76
	if ($wb->page_access_denied==true) {
77
        echo $MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS'];
78
		exit();
79
	}
80
	if(isset($globals) AND is_array($globals)) { foreach($globals AS $global_name) { global $$global_name; } }
81
	// Make sure block is numeric
82
	if(!is_numeric($block)) { $block = 1; }
83
	// Include page content
84
	if(!defined('PAGE_CONTENT') OR $block!=1) {
85
		if ($wb->page_id==0) {
86
			if ($wb->default_block_content=='none') {
87
				return;
88
			}
89
			if (is_numeric($wb->default_block_content)) {
90
				$page_id=$wb->default_block_content;
91
			} else {
92
				$page_id=$wb->default_page-id;
93
			}				
94
		} else {
95
			$page_id=$wb->page_id;
96
		}
97
		// First get all sections for this page
98
		$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
99
		if($query_sections->numRows() > 0) {
100
			// Loop through them and include there modules file
101
			while($section = $query_sections->fetchRow()) {
102
				$section_id = $section['section_id'];
103
				$module = $section['module'];
104
				require(WB_PATH.'/modules/'.$module.'/view.php');
105
			}
106
		}
107
	} else {
108
		require(PAGE_CONTENT);
109
	}
110
}
111

  
112
function show_content($block=1) {
113
	page_content($block);
114
}
115

  
116
function show_breadcrumbs($sep=' > ',$tier=1,$links=true) {
117
	$page_id=&$wb->page_id;
118
	if ($page_id!=0)
119
	{
120
 		global $database;
121
		$bca=&$wb->page_trail;
122
		if (sizeof($bca)==0)
123
		        create_breadcrumbs($page_id);
124
		$counter=0;
125
		foreach ($bca as $temp)
126
		{
127
	        if ($counter>=(tier-1));
128
	        {
129
				if ($counter>=$tier) echo $sep;
130
				$query_menu=$database->query("SELECT menu_title,link FROM ".TABLE_PREFIX."pages WHERE page_id=$temp");
131
				$page=$query_menu->fetchRow();
132
				if ($links==true AND $temp!=$page_id)
133
					echo '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>';
134
				else
135
				        echo stripslashes($page['menu_title']);
136
	        }
137
            $counter++;
138
		}
139
	}
140
}
141

  
142
// Function for page title
143
function page_title($spacer = ' - ', $template = '[WEBSITE_TITLE][SPACER][PAGE_TITLE]') {
144
	$vars = array('[WEBSITE_TITLE]', '[PAGE_TITLE]', '[MENU_TITLE]', '[SPACER]');
145
	$values = array(WEBSITE_TITLE, PAGE_TITLE, MENU_TITLE, $spacer);
146
	echo str_replace($vars, $values, $template);
147
}
148

  
149
// Function for page description
150
function page_description() {
151
	echo WEBSITE_DESCRIPTION;
152
}
153
// Function for page keywords
154
function page_keywords() {
155
	echo WEBSITE_KEYWORDS;
156
}
157
// Function for page header
158
function page_header($date_format = 'Y') {
159
	echo WEBSITE_HEADER;
160
}
161

  
162
// Function for page footer
163
function page_footer($date_format = 'Y') {
164
	global $starttime;
165
	$vars = array('[YEAR]', '[PROCESSTIME]');
166
	$processtime=(microtime()>$starttime)?microtime()-$starttime:microtime()-$starttime+1;
167
	$values = array(date($date_format),$processtime);
168
	echo str_replace($vars, $values, WEBSITE_FOOTER);
169
}
170

  
171
// Begin WB < 2.4.x template compatibility code
172
	// Make extra_sql accessable through private_sql
173
	$private_sql = $extra_sql;
174
	$private_where_sql = $extra_where_sql;
175
	// Query pages for menu
176
	$menu1 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '0' AND $extra_where_sql ORDER BY position ASC");
177
	// Check if current pages is a parent page and if we need its submenu
178
	if(PARENT == 0) {
179
		// Get the pages submenu
180
		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PAGE_ID."' AND $extra_where_sql ORDER BY position ASC");
181
	} else {
182
		// Get the pages submenu
183
		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PARENT."' AND $extra_where_sql ORDER BY position ASC");
184
	}
185
// End WB < 2.4.x template compatibility code
186
// Include template file
187

  
188

  
189
?>
0 190

  
trunk/wb/index.php
36 36
require_once(WB_PATH.'/framework/class.frontend.php');
37 37
// Create new frontend object
38 38
// Perform general initializations
39
$wb = & new frontend();
39
if (!isset($wb)) $wb = new frontend();
40 40

  
41 41
// Figure out which page to display
42 42
// Stop processing if intro page was shown
......
49 49
// Collect general website settings
50 50
$wb->get_website_settings();
51 51

  
52
// Load some ugly compatibility code
53
require(WB_PATH.'/framework/compatibility.php');
52
// Load functions available to templates, modules and code sections
53
// also, set some aliases for backward compatibility
54
require(WB_PATH.'/framework/frontend.functions.php');
54 55

  
55 56
// Display the template
56 57
require(WB_PATH.'/templates/'.TEMPLATE.'/index.php');

Also available in: Unified diff