Index: trunk/wb/admin/media/rename2.php
===================================================================
--- trunk/wb/admin/media/rename2.php	(revision 7)
+++ trunk/wb/admin/media/rename2.php	(revision 8)
@@ -1,150 +1,148 @@
-<?php
-
-// $Id: rename2.php,v 1.8 2005/04/07 07:43:36 rdjurovich Exp $
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Create admin object
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Media', 'media_rename', false);
-
-// Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
-
-// Include the basic header file
-require(ADMIN_PATH.'/media/basic_header.html');
-
-// Get the current dir
-$directory = $admin->get_post('dir');
-if($directory == '/') {
-	$directory = '';
-}
-// Check to see if it contains ../
-if(strstr($directory, '../')) {
-	$admin->print_header();
-	$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH']);
-}
-
-// Get the temp id
-if(!is_numeric($admin->get_post('id'))) {
-	header("Location: browse.php?dir=$directory");
-} else {
-	$file_id = $admin->get_post('id');
-}
-
-// Get home folder not to show
-$home_folders = get_home_folders();
-
-// Figure out what folder name the temp id is
+<?php
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2005, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Create admin object
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Media', 'media_rename', false);
+
+// Include the WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
+// Include the basic header file
+require(ADMIN_PATH.'/media/basic_header.html');
+
+// Get the current dir
+$directory = $admin->get_post('dir');
+if($directory == '/') {
+	$directory = '';
+}
+// Check to see if it contains ../
+if(strstr($directory, '../')) {
+	$admin->print_header();
+	$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH']);
+}
+
+// Get the temp id
+if(!is_numeric($admin->get_post('id'))) {
+	header("Location: browse.php?dir=$directory");
+} else {
+	$file_id = $admin->get_post('id');
+}
+
+// Get home folder not to show
+$home_folders = get_home_folders();
+
+// Figure out what folder name the temp id is
 if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
-	// Loop through the files and dirs an add to list
+	// Loop through the files and dirs an add to list
    while (false !== ($file = readdir($handle))) {
-		if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
-			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
+		if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
+			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
 				if(!isset($home_folders[$directory.'/'.$file])) {
-					$DIR[] = $file;
-				}
-			} else {
-				$FILE[] = $file;
-			}
-		}
-	}
-	$temp_id = 0;
-	if(isset($DIR)) {
-		foreach($DIR AS $name) {
-			$temp_id++;
-			if($file_id == $temp_id) {
-				$rename_file = $name;
-				$type = 'folder';
-			}
-		}
-	}
-	if(isset($FILE)) {
-		foreach($FILE AS $name) {
-			$temp_id++;
-			if($file_id == $temp_id) {
-				$rename_file = $name;
-				$type = 'file';
-			}
-		}
-	}
-}
-
-if(!isset($rename_file)) {
-	$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);
-}
-
-// Check if they entered a new name
-if(media_filename($admin->get_post('name')) == "") {
-	$admin->print_error($MESSAGE['MEDIA']['BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false);
-} else {
-	$old_name = $admin->get_post('old_name');
-	$new_name =  media_filename($admin->get_post('name'));
-}
-
-// Check if they entered an extension
-if($type == 'file') {
-	if(media_filename($admin->get_post('extension')) == "") {
-		$admin->print_error($MESSAGE['MEDIA']['BLANK_EXTENSION'], "rename.php?dir=$directory&id=$file_id", false);
-	} else {
-		$extension = media_filename($admin->get_post('extension'));
-	}
-} else {
-	$extension = '';
-}
-
-// Join new name and extension
-$name = $new_name.$extension;
-
-// Check if the name contains ..
-if(strstr($name, '..')) {
-	$admin->print_error($MESSAGE['MEDIA']['NAME_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false);
-}
-
-// Check if the name is index.php
-if($name == 'index.php') {
-	$admin->print_error($MESSAGE['MEDIA']['NAME_INDEX_PHP'], "rename.php?dir=$directory&id=$file_id", false);
-}
-
-// Check that the name still has a value
-if($name == '') {
-	$admin->print_error($MESSAGE['MEDIA']['BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false);
-}
-
-// Check if we should overwrite or not
-if($admin->get_post('overwrite') != 'yes' AND file_exists(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name) == true) {
-	if($type == 'folder') {
-		$admin->print_error($MESSAGE['MEDIA']['DIR_EXISTS'], "rename.php?dir=$directory&id=$file_id", false);
-	} else {
-		$admin->print_error($MESSAGE['MEDIA']['FILE_EXISTS'], "rename.php?dir=$directory&id=$file_id", false);
-	}
-}
-
-// Try and rename the file/folder
-if(rename(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$rename_file, WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name)) {
-	$admin->print_success($MESSAGE['MEDIA']['RENAMED'], "browse.php?dir=$directory");
-} else {
-	$admin->print_error($MESSAGE['MEDIA']['CANNOT_RENAME'], "rename.php?dir=$directory&id=$file_id", false);
-}
-
-?>
\ No newline at end of file
+					$DIR[] = $file;
+				}
+			} else {
+				$FILE[] = $file;
+			}
+		}
+	}
+	$temp_id = 0;
+	if(isset($DIR)) {
+		foreach($DIR AS $name) {
+			$temp_id++;
+			if($file_id == $temp_id) {
+				$rename_file = $name;
+				$type = 'folder';
+			}
+		}
+	}
+	if(isset($FILE)) {
+		foreach($FILE AS $name) {
+			$temp_id++;
+			if($file_id == $temp_id) {
+				$rename_file = $name;
+				$type = 'file';
+			}
+		}
+	}
+}
+
+if(!isset($rename_file)) {
+	$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);
+}
+
+// Check if they entered a new name
+if(media_filename($admin->get_post('name')) == "") {
+	$admin->print_error($MESSAGE['MEDIA']['BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false);
+} else {
+	$old_name = $admin->get_post('old_name');
+	$new_name =  media_filename($admin->get_post('name'));
+}
+
+// Check if they entered an extension
+if($type == 'file') {
+	if(media_filename($admin->get_post('extension')) == "") {
+		$admin->print_error($MESSAGE['MEDIA']['BLANK_EXTENSION'], "rename.php?dir=$directory&id=$file_id", false);
+	} else {
+		$extension = media_filename($admin->get_post('extension'));
+	}
+} else {
+	$extension = '';
+}
+
+// Join new name and extension
+$name = $new_name.$extension;
+
+// Check if the name contains ..
+if(strstr($name, '..')) {
+	$admin->print_error($MESSAGE['MEDIA']['NAME_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false);
+}
+
+// Check if the name is index.php
+if($name == 'index.php') {
+	$admin->print_error($MESSAGE['MEDIA']['NAME_INDEX_PHP'], "rename.php?dir=$directory&id=$file_id", false);
+}
+
+// Check that the name still has a value
+if($name == '') {
+	$admin->print_error($MESSAGE['MEDIA']['BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false);
+}
+
+// Check if we should overwrite or not
+if($admin->get_post('overwrite') != 'yes' AND file_exists(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name) == true) {
+	if($type == 'folder') {
+		$admin->print_error($MESSAGE['MEDIA']['DIR_EXISTS'], "rename.php?dir=$directory&id=$file_id", false);
+	} else {
+		$admin->print_error($MESSAGE['MEDIA']['FILE_EXISTS'], "rename.php?dir=$directory&id=$file_id", false);
+	}
+}
+
+// Try and rename the file/folder
+if(rename(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$rename_file, WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name)) {
+	$admin->print_success($MESSAGE['MEDIA']['RENAMED'], "browse.php?dir=$directory");
+} else {
+	$admin->print_error($MESSAGE['MEDIA']['CANNOT_RENAME'], "rename.php?dir=$directory&id=$file_id", false);
+}
+
+?>
Index: trunk/wb/admin/media/browse.php
===================================================================
--- trunk/wb/admin/media/browse.php	(revision 7)
+++ trunk/wb/admin/media/browse.php	(revision 8)
@@ -27,10 +27,10 @@
 require('../../config.php');
 require_once(WB_PATH.'/framework/class.admin.php');
 $admin = new admin('Media', 'media', false);
-
-// Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
 
+// Include the WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
 // Setup template object
 $template = new Template(ADMIN_PATH.'/media');
 $template->set_file('page', 'browse.html');
@@ -70,19 +70,19 @@
 								'DISPLAY_UP_ARROW' => $display_up_arrow
 								)
 						);
-
-// Get home folder not to show
-$home_folders = get_home_folders();
-
+
+// Get home folder not to show
+$home_folders = get_home_folders();
+
 // Generate list
 $template->set_block('main_block', 'list_block', 'list');
 if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
 	// Loop through the files and dirs an add to list
    while(false !== ($file = readdir($handle))) {
-		if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
-			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
+		if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
+			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
 				if(!isset($home_folders[$directory.'/'.$file])) {
-					$DIR[] = $file;
+					$DIR[] = $file;
 				}
 			} else {
 				$FILE[] = $file;
@@ -171,4 +171,4 @@
 $template->parse('main', 'main_block', false);
 $template->pparse('output', 'page');
 
-?>
\ No newline at end of file
+?>
Index: trunk/wb/admin/media/delete.php
===================================================================
--- trunk/wb/admin/media/delete.php	(revision 7)
+++ trunk/wb/admin/media/delete.php	(revision 8)
@@ -1,120 +1,120 @@
-<?php
-
-// $Id: delete.php,v 1.5 2005/04/04 00:56:30 rdjurovich Exp $
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Create admin object
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Media', 'media_delete', false);
-
-// Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
-
-// Include the stripped-down header file
-require('basic_header.html');
-
-// Get the current dir
-$directory = $admin->get_get('dir');
-if($directory == '/') {
-	$directory = '';
-}
-// Check to see if it contains ../
-if(strstr($directory, '../')) {
-	$admin->print_header();
-	$admin->print_error($MESSAGE['MEDIA']['DOT_DOT_SLASH']);
-}
-
-// Get the temp id
-if(!is_numeric($admin->get_get('id'))) {
-	header("Location: browse.php?dir=$directory");
-} else {
-	$file_id = $admin->get_get('id');
-}
-
-// Get home folder not to show
-$home_folders = get_home_folders();
-
-// Figure out what folder name the temp id is
+<?php
+
+// $Id: delete.php,v 1.5 2005/04/04 00:56:30 rdjurovich Exp $
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2005, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Create admin object
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Media', 'media_delete', false);
+
+// Include the WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
+// Include the stripped-down header file
+require('basic_header.html');
+
+// Get the current dir
+$directory = $admin->get_get('dir');
+if($directory == '/') {
+	$directory = '';
+}
+// Check to see if it contains ../
+if(strstr($directory, '../')) {
+	$admin->print_header();
+	$admin->print_error($MESSAGE['MEDIA']['DOT_DOT_SLASH']);
+}
+
+// Get the temp id
+if(!is_numeric($admin->get_get('id'))) {
+	header("Location: browse.php?dir=$directory");
+} else {
+	$file_id = $admin->get_get('id');
+}
+
+// Get home folder not to show
+$home_folders = get_home_folders();
+
+// Figure out what folder name the temp id is
 if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
-	// Loop through the files and dirs an add to list
+	// Loop through the files and dirs an add to list
    while (false !== ($file = readdir($handle))) {
-		if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
-			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
+		if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
+			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
 				if(!isset($home_folders[$directory.'/'.$file])) {
-					$DIR[] = $file;
-				}
-			} else {
-				$FILE[] = $file;
-			}
-		}
-	}
-	$temp_id = 0;
-	if(isset($DIR)) {
-		foreach($DIR AS $name) {
-			$temp_id++;
-			if(!isset($delete_file) AND $file_id == $temp_id) {
-				$delete_file = $name;
-				$type = 'folder';
-			}
-		}
-	}
-	if(isset($FILE)) {
-		foreach($FILE AS $name) {
-			$temp_id++;
-			if(!isset($delete_file) AND $file_id == $temp_id) {
-				$delete_file = $name;
-				$type = 'file';
-			}
-		}
-	}
-}
-
-// Check to see if we could find an id to match
-if(!isset($delete_file)) {
-	$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);
-}
-$relative_path = WB_PATH.MEDIA_DIRECTORY.'/'.$directory.'/'.$delete_file;
-// Check if the file/folder exists
-if(!file_exists($relative_path)) {
-	$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);	
-}
-
-// Find out whether its a file or folder
-if($type == 'folder') {
-	// Try and delete the directory
-	if(rm_full_dir($relative_path)) {
-		$admin->print_success($MESSAGE['MEDIA']['DELETED_DIR'], "browse.php?dir=$directory");
-	} else {
-		$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_DIR'], "browse.php?dir=$directory", false);
-	}
-} else {
-	// Try and delete the file
-	if(unlink($relative_path)) {
-		$admin->print_success($MESSAGE['MEDIA']['DELETED_FILE'], "browse.php?dir=$directory");
-	} else {
-		$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_FILE'], "browse.php?dir=$directory", false);
-	}
-}
-
-?>
\ No newline at end of file
+					$DIR[] = $file;
+				}
+			} else {
+				$FILE[] = $file;
+			}
+		}
+	}
+	$temp_id = 0;
+	if(isset($DIR)) {
+		foreach($DIR AS $name) {
+			$temp_id++;
+			if(!isset($delete_file) AND $file_id == $temp_id) {
+				$delete_file = $name;
+				$type = 'folder';
+			}
+		}
+	}
+	if(isset($FILE)) {
+		foreach($FILE AS $name) {
+			$temp_id++;
+			if(!isset($delete_file) AND $file_id == $temp_id) {
+				$delete_file = $name;
+				$type = 'file';
+			}
+		}
+	}
+}
+
+// Check to see if we could find an id to match
+if(!isset($delete_file)) {
+	$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);
+}
+$relative_path = WB_PATH.MEDIA_DIRECTORY.'/'.$directory.'/'.$delete_file;
+// Check if the file/folder exists
+if(!file_exists($relative_path)) {
+	$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);	
+}
+
+// Find out whether its a file or folder
+if($type == 'folder') {
+	// Try and delete the directory
+	if(rm_full_dir($relative_path)) {
+		$admin->print_success($MESSAGE['MEDIA']['DELETED_DIR'], "browse.php?dir=$directory");
+	} else {
+		$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_DIR'], "browse.php?dir=$directory", false);
+	}
+} else {
+	// Try and delete the file
+	if(unlink($relative_path)) {
+		$admin->print_success($MESSAGE['MEDIA']['DELETED_FILE'], "browse.php?dir=$directory");
+	} else {
+		$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_FILE'], "browse.php?dir=$directory", false);
+	}
+}
+
+?>
Index: trunk/wb/admin/media/rename.php
===================================================================
--- trunk/wb/admin/media/rename.php	(revision 7)
+++ trunk/wb/admin/media/rename.php	(revision 8)
@@ -1,139 +1,139 @@
-<?php
-
-// $Id: rename.php,v 1.4 2005/04/04 00:56:30 rdjurovich Exp $
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Create admin object
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Media', 'media_rename', false);
-
-// Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
-
-// Include the basic header file
-require(ADMIN_PATH.'/media/basic_header.html');
-
-// Get the current dir
-$directory = $admin->get_get('dir');
-if($directory == '/') {
-	$directory = '';
-}
-// Check to see if it contains ../
-if(strstr($directory, '../')) {
-	$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false);
-}
-
-// Get the temp id
-if(!is_numeric($admin->get_get('id'))) {
-	header("Location: browse.php?dir=$directory");
-} else {
-	$file_id = $admin->get_get('id');
-}
-
-// Get home folder not to show
-$home_folders = get_home_folders();
-
-// Figure out what folder name the temp id is
+<?php
+
+// $Id: rename.php,v 1.4 2005/04/04 00:56:30 rdjurovich Exp $
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2005, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Create admin object
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Media', 'media_rename', false);
+
+// Include the WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
+// Include the basic header file
+require(ADMIN_PATH.'/media/basic_header.html');
+
+// Get the current dir
+$directory = $admin->get_get('dir');
+if($directory == '/') {
+	$directory = '';
+}
+// Check to see if it contains ../
+if(strstr($directory, '../')) {
+	$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false);
+}
+
+// Get the temp id
+if(!is_numeric($admin->get_get('id'))) {
+	header("Location: browse.php?dir=$directory");
+} else {
+	$file_id = $admin->get_get('id');
+}
+
+// Get home folder not to show
+$home_folders = get_home_folders();
+
+// Figure out what folder name the temp id is
 if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
-	// Loop through the files and dirs an add to list
+	// Loop through the files and dirs an add to list
    while (false !== ($file = readdir($handle))) {
-		if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
-			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
+		if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
+			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
 				if(!isset($home_folders[$directory.'/'.$file])) {
-					$DIR[] = $file;
-				}
-			} else {
-				$FILE[] = $file;
-			}
-		}
-	}
-	$temp_id = 0;
-	if(isset($DIR)) {
-		foreach($DIR AS $name) {
-			$temp_id++;
-			if($file_id == $temp_id) {
-				$rename_file = $name;
-				$type = 'folder';
-			}
-		}
-	}
-	if(isset($FILE)) {
-		foreach($FILE AS $name) {
-			$temp_id++;
-			if($file_id == $temp_id) {
-				$rename_file = $name;
-				$type = 'file';
-			}
-		}
-	}
-}
-
-if(!isset($rename_file)) {
-	$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);
-}
-
-// Setup template object
-$template = new Template(ADMIN_PATH.'/media');
-$template->set_file('page', 'rename.html');
-$template->set_block('page', 'main_block', 'main');
-//echo WB_PATH.'/media/'.$directory.'/'.$rename_file;
-if($type == 'folder') {
-	$template->set_var('DISPlAY_EXTENSION', 'hide');
-	$extension = '';
-} else {
-	$template->set_var('DISPlAY_EXTENSION', '');
-	$extension = strstr($rename_file, '.');
-}
-
-if($type == 'folder') {
-	$type = $TEXT['FOLDER'];
-} else {
-	$type = $TEXT['FILE'];
-}
-
-$template->set_var(array(
-								'FILENAME' => $rename_file,
-								'DIR' => $directory,
-								'FILE_ID' => $file_id,
-								'TYPE' => $type,
-								'EXTENSION' => $extension
-								)
-						);
-
-
-// Insert language text and messages
-$template->set_var(array(
-								'TEXT_TO' => $TEXT['TO'],
-								'TEXT_RENAME' => $TEXT['RENAME'],
-								'TEXT_CANCEL' => $TEXT['CANCEL'],
-								'TEXT_UP' => $TEXT['UP'],
-								'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING']
-								)
-						);
-
-// Parse template object
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
-?>
\ No newline at end of file
+					$DIR[] = $file;
+				}
+			} else {
+				$FILE[] = $file;
+			}
+		}
+	}
+	$temp_id = 0;
+	if(isset($DIR)) {
+		foreach($DIR AS $name) {
+			$temp_id++;
+			if($file_id == $temp_id) {
+				$rename_file = $name;
+				$type = 'folder';
+			}
+		}
+	}
+	if(isset($FILE)) {
+		foreach($FILE AS $name) {
+			$temp_id++;
+			if($file_id == $temp_id) {
+				$rename_file = $name;
+				$type = 'file';
+			}
+		}
+	}
+}
+
+if(!isset($rename_file)) {
+	$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);
+}
+
+// Setup template object
+$template = new Template(ADMIN_PATH.'/media');
+$template->set_file('page', 'rename.html');
+$template->set_block('page', 'main_block', 'main');
+//echo WB_PATH.'/media/'.$directory.'/'.$rename_file;
+if($type == 'folder') {
+	$template->set_var('DISPlAY_EXTENSION', 'hide');
+	$extension = '';
+} else {
+	$template->set_var('DISPlAY_EXTENSION', '');
+	$extension = strstr($rename_file, '.');
+}
+
+if($type == 'folder') {
+	$type = $TEXT['FOLDER'];
+} else {
+	$type = $TEXT['FILE'];
+}
+
+$template->set_var(array(
+								'FILENAME' => $rename_file,
+								'DIR' => $directory,
+								'FILE_ID' => $file_id,
+								'TYPE' => $type,
+								'EXTENSION' => $extension
+								)
+						);
+
+
+// Insert language text and messages
+$template->set_var(array(
+								'TEXT_TO' => $TEXT['TO'],
+								'TEXT_RENAME' => $TEXT['RENAME'],
+								'TEXT_CANCEL' => $TEXT['CANCEL'],
+								'TEXT_UP' => $TEXT['UP'],
+								'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING']
+								)
+						);
+
+// Parse template object
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
+?>
Index: trunk/wb/admin/templates/install.php
===================================================================
--- trunk/wb/admin/templates/install.php	(revision 7)
+++ trunk/wb/admin/templates/install.php	(revision 8)
@@ -102,7 +102,7 @@
 $dir = dir($template_dir);
 while (false !== $entry = $dir->read()) {
 	// Skip pointers
-	if(substr($entry, 0, 1) != '.' AND $entry != 'CVS' AND !is_dir($template_dir.'/'.$entry)) {
+	if(substr($entry, 0, 1) != '.' AND $entry != '.svn' AND !is_dir($template_dir.'/'.$entry)) {
 		// Chmod file
 		change_mode($template_dir.'/'.$entry);
 	}
@@ -114,4 +114,4 @@
 // Print admin footer
 $admin->print_footer();
 
-?>
\ No newline at end of file
+?>
Index: trunk/wb/admin/templates/index.php
===================================================================
--- trunk/wb/admin/templates/index.php	(revision 7)
+++ trunk/wb/admin/templates/index.php	(revision 8)
@@ -1,85 +1,83 @@
-<?php
-
-// $Id: index.php,v 1.2 2005/04/02 06:25:53 rdjurovich Exp $
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Print admin header
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Addons', 'templates');
-
-// Setup template object
-$template = new Template(ADMIN_PATH.'/templates');
-$template->set_file('page', 'template.html');
-$template->set_block('page', 'main_block', 'main');
-
-// Insert values into template list
-$template->set_block('main_block', 'template_list_block', 'template_list');
+<?php
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2005, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Print admin header
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Addons', 'templates');
+
+// Setup template object
+$template = new Template(ADMIN_PATH.'/templates');
+$template->set_file('page', 'template.html');
+$template->set_block('page', 'main_block', 'main');
+
+// Insert values into template list
+$template->set_block('main_block', 'template_list_block', 'template_list');
 if($handle = opendir(WB_PATH.'/templates/')) {
 	while (false !== ($file = readdir($handle))) {
-		if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
-			// Include the templates info file
-			require(WB_PATH.'/templates/'.$file.'/info.php');
-			$template->set_var('VALUE', $file);
-			$template->set_var('NAME', $template_name);
-			$template->parse('template_list', 'template_list_block', true);
-		}
-	}
-}
-
-// Insert permissions values
-if($admin->get_permission('templates_install') != true) {
-	$template->set_var('DISPLAY_INSTALL', 'hide');
-}
-if($admin->get_permission('templates_uninstall') != true) {
-	$template->set_var('DISPLAY_UNINSTALL', 'hide');
-}
-if($admin->get_permission('templates_view') != true) {
-	$template->set_var('DISPLAY_LIST', 'hide');
-}
-
-// Insert language headings
-$template->set_var(array(
-								'HEADING_INSTALL_TEMPLATE' => $HEADING['INSTALL_TEMPLATE'],
-								'HEADING_UNINSTALL_TEMPLATE' => $HEADING['UNINSTALL_TEMPLATE'],
-								'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
-								)
-						);
-// Insert language text and messages
-$template->set_var(array(
-								'TEXT_INSTALL' => $TEXT['INSTALL'],
-								'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
-								'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
-								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
-								'CHANGE_TEMPLATE_NOTICE' => $MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE']
-								)
-						);
-
-// Parse template object
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
-// Print admin footer
-$admin->print_footer();
-
-?>
\ No newline at end of file
+		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
+			// Include the templates info file
+			require(WB_PATH.'/templates/'.$file.'/info.php');
+			$template->set_var('VALUE', $file);
+			$template->set_var('NAME', $template_name);
+			$template->parse('template_list', 'template_list_block', true);
+		}
+	}
+}
+
+// Insert permissions values
+if($admin->get_permission('templates_install') != true) {
+	$template->set_var('DISPLAY_INSTALL', 'hide');
+}
+if($admin->get_permission('templates_uninstall') != true) {
+	$template->set_var('DISPLAY_UNINSTALL', 'hide');
+}
+if($admin->get_permission('templates_view') != true) {
+	$template->set_var('DISPLAY_LIST', 'hide');
+}
+
+// Insert language headings
+$template->set_var(array(
+								'HEADING_INSTALL_TEMPLATE' => $HEADING['INSTALL_TEMPLATE'],
+								'HEADING_UNINSTALL_TEMPLATE' => $HEADING['UNINSTALL_TEMPLATE'],
+								'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']
+								)
+						);
+// Insert language text and messages
+$template->set_var(array(
+								'TEXT_INSTALL' => $TEXT['INSTALL'],
+								'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
+								'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
+								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
+								'CHANGE_TEMPLATE_NOTICE' => $MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE']
+								)
+						);
+
+// Parse template object
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
+// Print admin footer
+$admin->print_footer();
+
+?>
Index: trunk/wb/admin/pages/settings.php
===================================================================
--- trunk/wb/admin/pages/settings.php	(revision 7)
+++ trunk/wb/admin/pages/settings.php	(revision 8)
@@ -1,7 +1,5 @@
 <?php
 
-// $Id: settings.php,v 1.9 2005/04/08 07:36:58 rdjurovich Exp $
-
 /*
 
  Website Baker Project <http://www.websitebaker.org/>
@@ -294,7 +292,7 @@
 $template->set_block('main_block', 'template_list_block', 'template_list');
 if($handle = opendir(WB_PATH.'/templates/')) {
 	while(false !== ($file = readdir($handle))) {
-		if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH.'/templates/'.$file.'/info.php')) {
+		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH.'/templates/'.$file.'/info.php')) {
 			// Include the templates info file
 			require(WB_PATH.'/templates/'.$file.'/info.php');
 			// Check if the user has perms to use this template
@@ -349,7 +347,7 @@
 if($handle = opendir(WB_PATH.'/languages/')) {
 	$template->set_block('main_block', 'language_list_block', 'language_list');
 	while (false !== ($file = readdir($handle))) {
-		if($file != '.' AND $file != '..' AND $file != 'CVS' AND $file != 'index.php') {
+		if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'index.php') {
 			// Include the languages info file
 			require(WB_PATH.'/languages/'.$file);
 			// Work-out if this language is selected
Index: trunk/wb/admin/pages/index.php
===================================================================
--- trunk/wb/admin/pages/index.php	(revision 7)
+++ trunk/wb/admin/pages/index.php	(revision 8)
@@ -1,549 +1,547 @@
-<?php
-
-// $Id: index.php,v 1.9 2005/04/08 07:36:58 rdjurovich Exp $
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Pages', 'pages');
-
-// Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
-
-?>
-<script type="text/javascript" language="javascript">
-function toggle_viewers() {
-	if(document.add.visibility.value == 'private') {
-		document.getElementById('private_viewers').style.display = 'block';
-		document.getElementById('registered_viewers').style.display = 'none';
-	} else if(document.add.visibility.value == 'registered') {
-		document.getElementById('private_viewers').style.display = 'none';
-		document.getElementById('registered_viewers').style.display = 'block';
-	} else {
-		document.getElementById('private_viewers').style.display = 'none';
-		document.getElementById('registered_viewers').style.display = 'none';
-	}
-}
-function toggle_visibility(id){
-	if(document.getElementById(id).style.display == "block") {
-		document.getElementById(id).style.display = "none";
-	} else {
-		document.getElementById(id).style.display = "block";
-	}
-}
-var plus = new Image;
-plus.src = "<?php echo ADMIN_URL; ?>/images/plus_16.png";
-var minus = new Image;
-minus.src = "<?php echo ADMIN_URL; ?>/images/minus_16.png";
-function toggle_plus_minus(id) {
-	var img_src = document.images['plus_minus_' + id].src;
-	if(img_src == plus.src) {
-		document.images['plus_minus_' + id].src = minus.src;
-	} else {
-		document.images['plus_minus_' + id].src = plus.src;
-	}
-}
-</script>
-
-<style type="text/css">
-.pages_list img {
-	display: block;
-}
-ul, li {
-	list-style: none;
-	margin: 0;
-	padding: 0;
-}
-.page_list {
-	display: none;
-}
-</style>
-
-<noscript>
-	<style type="text/css">
-	.page_list {
-		display: block;
-	}
-	</style>
-</noscript>
-<?php
-
-function make_list($parent, $editable_pages) {
-	// Get objects and vars from outside this function
-	global $admin, $template, $database, $TEXT, $MESSAGE;
-	?>
-	<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list"'; } ?>>
-	<?php	
-	// Get page list from database
-	$database = new database();
-	if(PAGE_TRASH != 'inline') {
-		$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility != 'deleted' ORDER BY position ASC";
-	} else {
-		$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
-	}
-	$get_pages = $database->query($query);
-	
-	// Insert values into main page list
-	if($get_pages->numRows() > 0)	{
-		while($page = $get_pages->fetchRow()) {
-			// Get user perms
-			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
-			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
-			if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
-				if($page['visibility'] == 'deleted') {
-					if(PAGE_TRASH == 'inline') {
-						$can_modify = true;
-						$editable_pages = $editable_pages+1;
-					} else {
-						$can_modify = false;
-					}
-				} elseif($page['visibility'] != 'deleted') {
-					$can_modify = true;
-					$editable_pages = $editable_pages+1;
-				}
-			} else {
-				$can_modify = false;
-			}
-						
-			// Work out if we should show a plus or not
-			$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
-			if($get_page_subs->numRows() > 0) {
-				$display_plus = true;
-			} else {
-				$display_plus = false;
-			}
-			
-			// Work out how many pages there are for this parent
-			$num_pages = $get_pages->numRows();
-			?>
-			
-			<li id="p<?php echo $page['parent']; ?>" style="padding: 2px 0px 2px 0px;">
-			<table width="720" cellpadding="1" cellspacing="0" border="0" style="background-color: #F0F0F0;">
-			<tr>
-				<td width="20" style="padding-left: <?php echo $page['level']*20; ?>px;">
-					<?php
-					if($display_plus == true) {
-					?>
-					<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
-						<img src="<?php echo ADMIN_URL; ?>/images/plus_16.png" onclick="toggle_plus_minus('<?php echo $page['page_id']; ?>');" name="plus_minus_<?php echo $page['page_id']; ?>" border="0" alt="+" />
-					</a>
-					<?php
-					}
-					?>
-				</td>
-				<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true) { ?>
-				<td>
-					<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo stripslashes($page['page_title']); ?></a>
-				</td>
-				<?php } else { ?>
-				<td>
-					<?php	echo stripslashes($page['page_title']); ?>
-				</td>
-				<?php } ?>
-				<td align="left" width="232">
-					<font color="#999999"><?php echo $page['menu_title']; ?></font>
-				</td>
-				<td align="center" valign="middle" width="90">
-				<?php if($page['visibility'] == 'public') { ?>
-					<img src="<?php echo ADMIN_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" />
-				<?php } elseif($page['visibility'] == 'private') { ?>
-					<img src="<?php echo ADMIN_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" />
-				<?php } elseif($page['visibility'] == 'registered') { ?>
-					<img src="<?php echo ADMIN_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" />
-				<?php } elseif($page['visibility'] == 'hidden') { ?>
-					<img src="<?php echo ADMIN_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" border="0" />
-				<?php } elseif($page['visibility'] == 'none') { ?>
-					<img src="<?php echo ADMIN_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" />
-				<?php } elseif($page['visibility'] == 'deleted') { ?>
-					<img src="<?php echo ADMIN_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" />
-				<?php } ?>
-				</td>
-				<td width="20">
-					<?php if($page['visibility'] != 'deleted') { ?>
-						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
-						<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
-							<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" />
-						</a>
-						<?php } ?>
-					<?php } else { ?>
-						<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
-							<img src="<?php echo ADMIN_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" />
-						</a>
-					<?php } ?>
-				</td>
-				<td width="20">
-				<?php if($page['position'] != 1) { ?>
-					<?php if($page['visibility'] != 'deleted') { ?>
-						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
-						<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
-							<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
-						</a>
-						<?php } ?>
-					<?php } ?>
-				<?php } ?>
-				</td>
-				<td width="20">
-				<?php if($page['position'] != $num_pages) { ?>
-					<?php if($page['visibility'] != 'deleted') { ?>
-						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
-						<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
-							<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
-						</a>
-						<?php } ?>
-					<?php } ?>
-				<?php } ?>
-				</td>
-				<td width="20">
-					<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
-					<a href="javascript: confirm_link('<?php echo $MESSAGE['PAGES']['DELETE_CONFIRM']; ?>?', '<?php echo ADMIN_URL; ?>/pages/delete.php?page_id=<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
-						<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
-					</a>
-					<?php } ?>
-				</td>
-				<td width="20">
-					<?php if($page['visibility'] != 'deleted' AND $page['visibility'] != 'none') { ?>
-					<a href="<?php echo page_link($page['link']); ?>" target="_blank">
-						<img src="<?php echo ADMIN_URL; ?>/images/view_16.png" border="0" alt="<?php echo $TEXT['VIEW']; ?>" />
-					</a>
-					<?php } ?>
-				</td>
-			</tr>
-			</table>
-			</li>
-							
-			<?php
-			// Get subs
-			make_list($page['page_id'], $editable_pages);
-		}
-
-	}
-	?>
-	</ul>
-	<?php
-	return $editable_pages;
-}
-
-// Generate pages list
-if($admin->get_permission('pages_view') == true) {
-	?>
-	<table cellpadding="0" cellspacing="0" width="100%" border="0">
-	<tr>
-		<td>
-			<h2><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2>
-		</td>
-		<td align="right">
-			<?php
-				// Check if there are any pages that are in trash, and if we should show a link to the trash page
-				if(PAGE_TRASH == 'separate') {
-					$query_trash = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE visibility = 'deleted'");
-					if($query_trash->numRows() > 0) {
-						?>
-						<a href="<?php echo ADMIN_URL; ?>/pages/trash.php">
-						<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
-						<?php echo $TEXT['VIEW_DELETED_PAGES']; ?></a>
-						<?php
-					}
-				}
-			?>
-		</td>
-	</tr>
-	</table>
-	<div class="pages_list">
-	<table cellpadding="1" cellspacing="0" width="720" border="0">
-	<tr>
-		<td width="20">
-			&nbsp;
-		</td>
-		<td>
-			<?php echo $TEXT['PAGE_TITLE']; ?>:
-		</td>
-		<td width="175" align="left">
-			<?php echo $TEXT['MENU_TITLE']; ?>:
-		</td>
-		<td width="130" align="right">
-			<?php echo $TEXT['VISIBILITY']; ?>:
-		</td>
-		<td width="125" align="center">
-			<?php echo $TEXT['ACTIONS']; ?>:
-		</td>		
-	</tr>
-	</table>
-	<?php
-	$editable_pages = make_list(0, 0);
-	?>
-	</div>
-	<div class="empty_list">
-		<?php echo $TEXT['NONE_FOUND']; ?>
-	</div>
-	<?php
-} else {
-	$editable_pages = 0;
-}
-
-// Setup template object
-$template = new Template(ADMIN_PATH.'/pages');
-$template->set_file('page', 'template.html');
-$template->set_block('page', 'main_block', 'main');
-
-// Figure out if the no pages found message should be shown or not
-if($editable_pages == 0) {
-	?>
-	<style type="text/css">
-	.pages_list {
-		display: none;
-	}
-	</style>
-	<?php
-} else {
-	?>
-	<style type="text/css">
-	.empty_list {
-		display: none;
-	}
-	</style>
-	<?php
-}
-
-// Insert values into the add page form
-
-// Group list 1
-	if($admin->get_group_id() == 1) {
-		$query = "SELECT * FROM ".TABLE_PREFIX."groups";
-	} else {
-		$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'";
-	}
-	$get_groups = $database->query($query);
-	$template->set_block('main_block', 'group_list_block', 'group_list');
-	// Insert admin group and current group first
-	$admin_group_name = $get_groups->fetchRow();
-	$template->set_var(array(
-									'ID' => 1,
-									'TOGGLE' => '',
-									'DISABLED' => ' disabled',
-									'LINK_COLOR' => '000000',
-									'CURSOR' => 'default',
-									'NAME' => $admin_group_name['name'],
-									'CHECKED' => ' checked'
-									)
-							);
-	$template->parse('group_list', 'group_list_block', true);
-	if($admin->get_group_id() != 1) {
-		$template->set_var(array(
-										'ID' => $admin->get_group_id(),
-										'TOGGLE' => '',
-										'DISABLED' => ' disabled',
-										'LINK_COLOR' => '000000',
-										'CURSOR' => 'default',
-										'NAME' => $admin->get_group_name(),
-										'CHECKED' => ' checked'
-										)
-								);
-		$template->parse('group_list', 'group_list_block', true);
-	}
-	while($group = $get_groups->fetchRow()) {
-		// Check if the group is allowed to edit pages
-		$system_permissions = explode(',', $group['system_permissions']);
-		if(is_numeric(array_search('pages_modify', $system_permissions))) {
-			$template->set_var(array(
-											'ID' => $group['group_id'],
-											'TOGGLE' => $group['group_id'],
-											'CHECKED' => '',
-											'DISABLED' => '',
-											'LINK_COLOR' => '',
-											'CURSOR' => 'pointer',
-											'NAME' => $group['name'],
-											'CHECKED' => ''
-											)
-									);
-			$template->parse('group_list', 'group_list_block', true);
-		}
-	}
-// Group list 2
-	if($admin->get_group_id() == 1) {
-		$query = "SELECT * FROM ".TABLE_PREFIX."groups";
-	} else {
-		$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'";
-	}
-	$get_groups = $database->query($query);
-	$template->set_block('main_block', 'group_list_block2', 'group_list2');
-	// Insert admin group and current group first
-	$admin_group_name = $get_groups->fetchRow();
-	$template->set_var(array(
-									'ID' => 1,
-									'TOGGLE' => '',
-									'DISABLED' => ' disabled',
-									'LINK_COLOR' => '000000',
-									'CURSOR' => 'default',
-									'NAME' => $admin_group_name['name'],
-									'CHECKED' => ' checked'
-									)
-							);
-	$template->parse('group_list2', 'group_list_block2', true);
-	if($admin->get_group_id() != 1) {
-		$template->set_var(array(
-										'ID' => $admin->get_group_id(),
-										'TOGGLE' => '',
-										'DISABLED' => ' disabled',
-										'LINK_COLOR' => '000000',
-										'CURSOR' => 'default',
-										'NAME' => $admin->get_group_name(),
-										'CHECKED' => ' checked'
-										)
-								);
-		$template->parse('group_list2', 'group_list_block2', true);
-	}
-	while($group = $get_groups->fetchRow()) {
-		$template->set_var(array(
-										'ID' => $group['group_id'],
-										'TOGGLE' => $group['group_id'],
-										'CHECKED' => '',
-										'DISABLED' => '',
-										'LINK_COLOR' => '',
-										'CURSOR' => 'pointer',
-										'NAME' => $group['name'],
-										'CHECKED' => ''
-										)
-								);
-		$template->parse('group_list2', 'group_list_block2', true);
-	}
-
-// Parent page list
-$database = new database();
-function parent_list($parent) {
-	global $admin, $database, $template;
-	$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
-	$get_pages = $database->query($query);
-	while($page = $get_pages->fetchRow()) {
-		// Stop users from adding pages with a level of more than the set page level limit
-		if($page['level']+1 < PAGE_LEVEL_LIMIT) {
-			// Get user perms
-			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
-			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
-			if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
-				$can_modify = true;
-			} else {
-				$can_modify = false;
-			}
-			// Title -'s prefix
-			$title_prefix = '';
-			for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
-				$template->set_var(array(
-												'ID' => $page['page_id'],
-												'TITLE' => stripslashes($title_prefix.$page['page_title'])
-												)
-										);
-				if($can_modify == true) {
-					$template->set_var('DISABLED', '');
-				} else {
-					$template->set_var('DISABLED', ' disabled');
-				}
-				$template->parse('page_list2', 'page_list_block2', true);
-		}
-		parent_list($page['page_id']);
-	}
-}
-$template->set_block('main_block', 'page_list_block2', 'page_list2');
-if($admin->get_permission('pages_add_l0') == true) {
-	$template->set_var(array(
-									'ID' => '0',
-									'TITLE' => $TEXT['NONE'],
-									'SELECTED' => ' selected',
-									'DISABLED' => ''
-									)
-							);
-	$template->parse('page_list2', 'page_list_block2', true);
-}
-parent_list(0);
-
-// Explode module permissions
-$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
-// Modules list
-$template->set_block('main_block', 'module_list_block', 'module_list');
+<?php
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2005, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Pages', 'pages');
+
+// Include the WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
+?>
+<script type="text/javascript" language="javascript">
+function toggle_viewers() {
+	if(document.add.visibility.value == 'private') {
+		document.getElementById('private_viewers').style.display = 'block';
+		document.getElementById('registered_viewers').style.display = 'none';
+	} else if(document.add.visibility.value == 'registered') {
+		document.getElementById('private_viewers').style.display = 'none';
+		document.getElementById('registered_viewers').style.display = 'block';
+	} else {
+		document.getElementById('private_viewers').style.display = 'none';
+		document.getElementById('registered_viewers').style.display = 'none';
+	}
+}
+function toggle_visibility(id){
+	if(document.getElementById(id).style.display == "block") {
+		document.getElementById(id).style.display = "none";
+	} else {
+		document.getElementById(id).style.display = "block";
+	}
+}
+var plus = new Image;
+plus.src = "<?php echo ADMIN_URL; ?>/images/plus_16.png";
+var minus = new Image;
+minus.src = "<?php echo ADMIN_URL; ?>/images/minus_16.png";
+function toggle_plus_minus(id) {
+	var img_src = document.images['plus_minus_' + id].src;
+	if(img_src == plus.src) {
+		document.images['plus_minus_' + id].src = minus.src;
+	} else {
+		document.images['plus_minus_' + id].src = plus.src;
+	}
+}
+</script>
+
+<style type="text/css">
+.pages_list img {
+	display: block;
+}
+ul, li {
+	list-style: none;
+	margin: 0;
+	padding: 0;
+}
+.page_list {
+	display: none;
+}
+</style>
+
+<noscript>
+	<style type="text/css">
+	.page_list {
+		display: block;
+	}
+	</style>
+</noscript>
+<?php
+
+function make_list($parent, $editable_pages) {
+	// Get objects and vars from outside this function
+	global $admin, $template, $database, $TEXT, $MESSAGE;
+	?>
+	<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list"'; } ?>>
+	<?php	
+	// Get page list from database
+	$database = new database();
+	if(PAGE_TRASH != 'inline') {
+		$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility != 'deleted' ORDER BY position ASC";
+	} else {
+		$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
+	}
+	$get_pages = $database->query($query);
+	
+	// Insert values into main page list
+	if($get_pages->numRows() > 0)	{
+		while($page = $get_pages->fetchRow()) {
+			// Get user perms
+			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
+			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
+			if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
+				if($page['visibility'] == 'deleted') {
+					if(PAGE_TRASH == 'inline') {
+						$can_modify = true;
+						$editable_pages = $editable_pages+1;
+					} else {
+						$can_modify = false;
+					}
+				} elseif($page['visibility'] != 'deleted') {
+					$can_modify = true;
+					$editable_pages = $editable_pages+1;
+				}
+			} else {
+				$can_modify = false;
+			}
+						
+			// Work out if we should show a plus or not
+			$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
+			if($get_page_subs->numRows() > 0) {
+				$display_plus = true;
+			} else {
+				$display_plus = false;
+			}
+			
+			// Work out how many pages there are for this parent
+			$num_pages = $get_pages->numRows();
+			?>
+			
+			<li id="p<?php echo $page['parent']; ?>" style="padding: 2px 0px 2px 0px;">
+			<table width="720" cellpadding="1" cellspacing="0" border="0" style="background-color: #F0F0F0;">
+			<tr>
+				<td width="20" style="padding-left: <?php echo $page['level']*20; ?>px;">
+					<?php
+					if($display_plus == true) {
+					?>
+					<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
+						<img src="<?php echo ADMIN_URL; ?>/images/plus_16.png" onclick="toggle_plus_minus('<?php echo $page['page_id']; ?>');" name="plus_minus_<?php echo $page['page_id']; ?>" border="0" alt="+" />
+					</a>
+					<?php
+					}
+					?>
+				</td>
+				<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true) { ?>
+				<td>
+					<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo stripslashes($page['page_title']); ?></a>
+				</td>
+				<?php } else { ?>
+				<td>
+					<?php	echo stripslashes($page['page_title']); ?>
+				</td>
+				<?php } ?>
+				<td align="left" width="232">
+					<font color="#999999"><?php echo $page['menu_title']; ?></font>
+				</td>
+				<td align="center" valign="middle" width="90">
+				<?php if($page['visibility'] == 'public') { ?>
+					<img src="<?php echo ADMIN_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" />
+				<?php } elseif($page['visibility'] == 'private') { ?>
+					<img src="<?php echo ADMIN_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" />
+				<?php } elseif($page['visibility'] == 'registered') { ?>
+					<img src="<?php echo ADMIN_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" />
+				<?php } elseif($page['visibility'] == 'hidden') { ?>
+					<img src="<?php echo ADMIN_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" border="0" />
+				<?php } elseif($page['visibility'] == 'none') { ?>
+					<img src="<?php echo ADMIN_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" />
+				<?php } elseif($page['visibility'] == 'deleted') { ?>
+					<img src="<?php echo ADMIN_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" />
+				<?php } ?>
+				</td>
+				<td width="20">
+					<?php if($page['visibility'] != 'deleted') { ?>
+						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
+						<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
+							<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" />
+						</a>
+						<?php } ?>
+					<?php } else { ?>
+						<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
+							<img src="<?php echo ADMIN_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" />
+						</a>
+					<?php } ?>
+				</td>
+				<td width="20">
+				<?php if($page['position'] != 1) { ?>
+					<?php if($page['visibility'] != 'deleted') { ?>
+						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
+						<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
+							<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
+						</a>
+						<?php } ?>
+					<?php } ?>
+				<?php } ?>
+				</td>
+				<td width="20">
+				<?php if($page['position'] != $num_pages) { ?>
+					<?php if($page['visibility'] != 'deleted') { ?>
+						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
+						<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
+							<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
+						</a>
+						<?php } ?>
+					<?php } ?>
+				<?php } ?>
+				</td>
+				<td width="20">
+					<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
+					<a href="javascript: confirm_link('<?php echo $MESSAGE['PAGES']['DELETE_CONFIRM']; ?>?', '<?php echo ADMIN_URL; ?>/pages/delete.php?page_id=<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
+						<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
+					</a>
+					<?php } ?>
+				</td>
+				<td width="20">
+					<?php if($page['visibility'] != 'deleted' AND $page['visibility'] != 'none') { ?>
+					<a href="<?php echo page_link($page['link']); ?>" target="_blank">
+						<img src="<?php echo ADMIN_URL; ?>/images/view_16.png" border="0" alt="<?php echo $TEXT['VIEW']; ?>" />
+					</a>
+					<?php } ?>
+				</td>
+			</tr>
+			</table>
+			</li>
+							
+			<?php
+			// Get subs
+			make_list($page['page_id'], $editable_pages);
+		}
+
+	}
+	?>
+	</ul>
+	<?php
+	return $editable_pages;
+}
+
+// Generate pages list
+if($admin->get_permission('pages_view') == true) {
+	?>
+	<table cellpadding="0" cellspacing="0" width="100%" border="0">
+	<tr>
+		<td>
+			<h2><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2>
+		</td>
+		<td align="right">
+			<?php
+				// Check if there are any pages that are in trash, and if we should show a link to the trash page
+				if(PAGE_TRASH == 'separate') {
+					$query_trash = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE visibility = 'deleted'");
+					if($query_trash->numRows() > 0) {
+						?>
+						<a href="<?php echo ADMIN_URL; ?>/pages/trash.php">
+						<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
+						<?php echo $TEXT['VIEW_DELETED_PAGES']; ?></a>
+						<?php
+					}
+				}
+			?>
+		</td>
+	</tr>
+	</table>
+	<div class="pages_list">
+	<table cellpadding="1" cellspacing="0" width="720" border="0">
+	<tr>
+		<td width="20">
+			&nbsp;
+		</td>
+		<td>
+			<?php echo $TEXT['PAGE_TITLE']; ?>:
+		</td>
+		<td width="175" align="left">
+			<?php echo $TEXT['MENU_TITLE']; ?>:
+		</td>
+		<td width="130" align="right">
+			<?php echo $TEXT['VISIBILITY']; ?>:
+		</td>
+		<td width="125" align="center">
+			<?php echo $TEXT['ACTIONS']; ?>:
+		</td>		
+	</tr>
+	</table>
+	<?php
+	$editable_pages = make_list(0, 0);
+	?>
+	</div>
+	<div class="empty_list">
+		<?php echo $TEXT['NONE_FOUND']; ?>
+	</div>
+	<?php
+} else {
+	$editable_pages = 0;
+}
+
+// Setup template object
+$template = new Template(ADMIN_PATH.'/pages');
+$template->set_file('page', 'template.html');
+$template->set_block('page', 'main_block', 'main');
+
+// Figure out if the no pages found message should be shown or not
+if($editable_pages == 0) {
+	?>
+	<style type="text/css">
+	.pages_list {
+		display: none;
+	}
+	</style>
+	<?php
+} else {
+	?>
+	<style type="text/css">
+	.empty_list {
+		display: none;
+	}
+	</style>
+	<?php
+}
+
+// Insert values into the add page form
+
+// Group list 1
+	if($admin->get_group_id() == 1) {
+		$query = "SELECT * FROM ".TABLE_PREFIX."groups";
+	} else {
+		$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'";
+	}
+	$get_groups = $database->query($query);
+	$template->set_block('main_block', 'group_list_block', 'group_list');
+	// Insert admin group and current group first
+	$admin_group_name = $get_groups->fetchRow();
+	$template->set_var(array(
+									'ID' => 1,
+									'TOGGLE' => '',
+									'DISABLED' => ' disabled',
+									'LINK_COLOR' => '000000',
+									'CURSOR' => 'default',
+									'NAME' => $admin_group_name['name'],
+									'CHECKED' => ' checked'
+									)
+							);
+	$template->parse('group_list', 'group_list_block', true);
+	if($admin->get_group_id() != 1) {
+		$template->set_var(array(
+										'ID' => $admin->get_group_id(),
+										'TOGGLE' => '',
+										'DISABLED' => ' disabled',
+										'LINK_COLOR' => '000000',
+										'CURSOR' => 'default',
+										'NAME' => $admin->get_group_name(),
+										'CHECKED' => ' checked'
+										)
+								);
+		$template->parse('group_list', 'group_list_block', true);
+	}
+	while($group = $get_groups->fetchRow()) {
+		// Check if the group is allowed to edit pages
+		$system_permissions = explode(',', $group['system_permissions']);
+		if(is_numeric(array_search('pages_modify', $system_permissions))) {
+			$template->set_var(array(
+											'ID' => $group['group_id'],
+											'TOGGLE' => $group['group_id'],
+											'CHECKED' => '',
+											'DISABLED' => '',
+											'LINK_COLOR' => '',
+											'CURSOR' => 'pointer',
+											'NAME' => $group['name'],
+											'CHECKED' => ''
+											)
+									);
+			$template->parse('group_list', 'group_list_block', true);
+		}
+	}
+// Group list 2
+	if($admin->get_group_id() == 1) {
+		$query = "SELECT * FROM ".TABLE_PREFIX."groups";
+	} else {
+		$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'";
+	}
+	$get_groups = $database->query($query);
+	$template->set_block('main_block', 'group_list_block2', 'group_list2');
+	// Insert admin group and current group first
+	$admin_group_name = $get_groups->fetchRow();
+	$template->set_var(array(
+									'ID' => 1,
+									'TOGGLE' => '',
+									'DISABLED' => ' disabled',
+									'LINK_COLOR' => '000000',
+									'CURSOR' => 'default',
+									'NAME' => $admin_group_name['name'],
+									'CHECKED' => ' checked'
+									)
+							);
+	$template->parse('group_list2', 'group_list_block2', true);
+	if($admin->get_group_id() != 1) {
+		$template->set_var(array(
+										'ID' => $admin->get_group_id(),
+										'TOGGLE' => '',
+										'DISABLED' => ' disabled',
+										'LINK_COLOR' => '000000',
+										'CURSOR' => 'default',
+										'NAME' => $admin->get_group_name(),
+										'CHECKED' => ' checked'
+										)
+								);
+		$template->parse('group_list2', 'group_list_block2', true);
+	}
+	while($group = $get_groups->fetchRow()) {
+		$template->set_var(array(
+										'ID' => $group['group_id'],
+										'TOGGLE' => $group['group_id'],
+										'CHECKED' => '',
+										'DISABLED' => '',
+										'LINK_COLOR' => '',
+										'CURSOR' => 'pointer',
+										'NAME' => $group['name'],
+										'CHECKED' => ''
+										)
+								);
+		$template->parse('group_list2', 'group_list_block2', true);
+	}
+
+// Parent page list
+$database = new database();
+function parent_list($parent) {
+	global $admin, $database, $template;
+	$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
+	$get_pages = $database->query($query);
+	while($page = $get_pages->fetchRow()) {
+		// Stop users from adding pages with a level of more than the set page level limit
+		if($page['level']+1 < PAGE_LEVEL_LIMIT) {
+			// Get user perms
+			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
+			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
+			if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
+				$can_modify = true;
+			} else {
+				$can_modify = false;
+			}
+			// Title -'s prefix
+			$title_prefix = '';
+			for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
+				$template->set_var(array(
+												'ID' => $page['page_id'],
+												'TITLE' => stripslashes($title_prefix.$page['page_title'])
+												)
+										);
+				if($can_modify == true) {
+					$template->set_var('DISABLED', '');
+				} else {
+					$template->set_var('DISABLED', ' disabled');
+				}
+				$template->parse('page_list2', 'page_list_block2', true);
+		}
+		parent_list($page['page_id']);
+	}
+}
+$template->set_block('main_block', 'page_list_block2', 'page_list2');
+if($admin->get_permission('pages_add_l0') == true) {
+	$template->set_var(array(
+									'ID' => '0',
+									'TITLE' => $TEXT['NONE'],
+									'SELECTED' => ' selected',
+									'DISABLED' => ''
+									)
+							);
+	$template->parse('page_list2', 'page_list_block2', true);
+}
+parent_list(0);
+
+// Explode module permissions
+$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
+// Modules list
+$template->set_block('main_block', 'module_list_block', 'module_list');
 if($handle = opendir(WB_PATH.'/modules/')) {
 	while (false !== ($file = readdir($handle))) {
-		if($file != '.' AND $file != '..' AND $file != 'CVS' AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
-			// Include the modules info file
-			require(WB_PATH.'/modules/'.$file.'/info.php');
-			// Check if user is allowed to use this module
-			if(!isset($module_type)) { $module_type = 'unknown'; }
-			if(!is_numeric(array_search($file, $module_permissions)) AND $module_type == 'page') {
-				$template->set_var('VALUE', $file);
-				$template->set_var('NAME', $module_name);
-				if($file == 'wysiwyg') {
-					$template->set_var('SELECTED', ' selected');
-				} else {
-					$template->set_var('SELECTED', '');
-				}
-				$template->parse('module_list', 'module_list_block', true);
-			}
-			if(isset($module_type)) { unset($module_type); } // Unset module type
-		}
-	}
-}
-
-// Insert language headings
-$template->set_var(array(
-								'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'],
-								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE']
-								)
-						);
-// Insert language text and messages
-$template->set_var(array(
-								'TEXT_TITLE' => $TEXT['TITLE'],
-								'TEXT_TYPE' => $TEXT['TYPE'],
-								'TEXT_PARENT' => $TEXT['PARENT'],
-								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
-								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
-								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
-								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
-								'TEXT_HIDDEN' => $TEXT['HIDDEN'],
-								'TEXT_NONE' => $TEXT['NONE'],
-								'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'],
-								'TEXT_ADD' => $TEXT['ADD'],
-								'TEXT_RESET' => $TEXT['RESET'],
-								'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],								
-								'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'],
-								'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'],
-								'INTRO_LINK' => $MESSAGE['PAGES']['INTRO_LINK'],
-								)
-						);
-
-// Insert permissions values
-if($admin->get_permission('pages_add') != true) {
-	$template->set_var('DISPLAY_ADD', 'hide');
-} elseif($admin->get_permission('pages_add_l0') != true AND $editable_pages == 0) {
-	$template->set_var('DISPLAY_ADD', 'hide');
-}
-if($admin->get_permission('pages_intro') != true OR INTRO_PAGE != 'enabled') {
-	$template->set_var('DISPLAY_INTRO', 'hide');
-}
-
-
-// Parse template object
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
-// Print admin 
-$admin->print_footer();
-
-?>
\ No newline at end of file
+		if($file != '.' AND $file != '..' AND $file != '.svn' AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
+			// Include the modules info file
+			require(WB_PATH.'/modules/'.$file.'/info.php');
+			// Check if user is allowed to use this module
+			if(!isset($module_type)) { $module_type = 'unknown'; }
+			if(!is_numeric(array_search($file, $module_permissions)) AND $module_type == 'page') {
+				$template->set_var('VALUE', $file);
+				$template->set_var('NAME', $module_name);
+				if($file == 'wysiwyg') {
+					$template->set_var('SELECTED', ' selected');
+				} else {
+					$template->set_var('SELECTED', '');
+				}
+				$template->parse('module_list', 'module_list_block', true);
+			}
+			if(isset($module_type)) { unset($module_type); } // Unset module type
+		}
+	}
+}
+
+// Insert language headings
+$template->set_var(array(
+								'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'],
+								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE']
+								)
+						);
+// Insert language text and messages
+$template->set_var(array(
+								'TEXT_TITLE' => $TEXT['TITLE'],
+								'TEXT_TYPE' => $TEXT['TYPE'],
+								'TEXT_PARENT' => $TEXT['PARENT'],
+								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
+								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
+								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
+								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
+								'TEXT_HIDDEN' => $TEXT['HIDDEN'],
+								'TEXT_NONE' => $TEXT['NONE'],
+								'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'],
+								'TEXT_ADD' => $TEXT['ADD'],
+								'TEXT_RESET' => $TEXT['RESET'],
+								'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],								
+								'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'],
+								'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'],
+								'INTRO_LINK' => $MESSAGE['PAGES']['INTRO_LINK'],
+								)
+						);
+
+// Insert permissions values
+if($admin->get_permission('pages_add') != true) {
+	$template->set_var('DISPLAY_ADD', 'hide');
+} elseif($admin->get_permission('pages_add_l0') != true AND $editable_pages == 0) {
+	$template->set_var('DISPLAY_ADD', 'hide');
+}
+if($admin->get_permission('pages_intro') != true OR INTRO_PAGE != 'enabled') {
+	$template->set_var('DISPLAY_INTRO', 'hide');
+}
+
+
+// Parse template object
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
+// Print admin 
+$admin->print_footer();
+
+?>
Index: trunk/wb/admin/pages/sections.php
===================================================================
--- trunk/wb/admin/pages/sections.php	(revision 7)
+++ trunk/wb/admin/pages/sections.php	(revision 8)
@@ -1,7 +1,5 @@
 <?php
 
-// $Id: sections.php,v 1.10 2005/04/09 01:00:53 rdjurovich Exp $
-
 /*
 
  Website Baker Project <http://www.websitebaker.org/>
@@ -45,16 +43,16 @@
 // Check if we are supposed to add or delete a section
 if(isset($_GET['section_id']) AND is_numeric($_GET['section_id'])) {
 	// Get more information about this section
-	$section_id = $_GET['section_id'];
-	$query_section = $database->query("SELECT module FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id'");
-	if($query_section->numRows() == 0) {
-		$admin->print_error('Section not found');
-	}
-	$section = $query_section->fetchRow();
-	// Include the modules delete file if it exists
-	if(file_exists(WB_PATH.'/modules/'.$section['module'].'/delete.php')) {
-		require(WB_PATH.'/modules/'.$section['module'].'/delete.php');
+	$section_id = $_GET['section_id'];
+	$query_section = $database->query("SELECT module FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id'");
+	if($query_section->numRows() == 0) {
+		$admin->print_error('Section not found');
 	}
+	$section = $query_section->fetchRow();
+	// Include the modules delete file if it exists
+	if(file_exists(WB_PATH.'/modules/'.$section['module'].'/delete.php')) {
+		require(WB_PATH.'/modules/'.$section['module'].'/delete.php');
+	}
 	$database->query("DELETE FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id' LIMIT 1");
 	if($database->is_error()) {
 		$admin->print_error($database->get_error());
@@ -110,165 +108,165 @@
 
 // Set module permissions
 $module_permissions = $_SESSION['MODULE_PERMISSIONS'];
-
-// Unset block var
-unset($block);
-// Include template info file (if it exists)
-if($results_array['template'] != '') {
-	$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
-} else {
-	$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
-}
-if(file_exists($template_location)) {
-	require($template_location);
-}
-// Check if $menu is set
-if(!isset($block[1]) OR $block[1] == '') {
-	// Make our own menu list
-	$block[1] = $TEXT['MAIN'];
-}
--?>
-<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%" height="50" style="margin-bottom: 10px;">
-<tr style="background-color: #F0F0F0;">
-	<td valign="middle" align="left">
-		<h2><?php echo $HEADING['MANAGE_SECTIONS']; ?></h2>
-	</td>
-	<td align="right">
-		<?php echo $TEXT['CURRENT_PAGE']; ?>: 
-		<b><?php echo stripslashes($results_array['page_title']); ?></b>
-		-
-		<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>"><?php echo $HEADING['MODIFY_PAGE']; ?></a>
-		-
-		<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page_id; ?>"><?php echo $TEXT['CHANGE_SETTINGS']; ?></a>
-	</td>
-</tr>
-</table>
-
-<?php
+
+// Unset block var
+unset($block);
+// Include template info file (if it exists)
+if($results_array['template'] != '') {
+	$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
+} else {
+	$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
+}
+if(file_exists($template_location)) {
+	require($template_location);
+}
+// Check if $menu is set
+if(!isset($block[1]) OR $block[1] == '') {
+	// Make our own menu list
+	$block[1] = $TEXT['MAIN'];
+}
+
+?>
+<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%" height="50" style="margin-bottom: 10px;">
+<tr style="background-color: #F0F0F0;">
+	<td valign="middle" align="left">
+		<h2><?php echo $HEADING['MANAGE_SECTIONS']; ?></h2>
+	</td>
+	<td align="right">
+		<?php echo $TEXT['CURRENT_PAGE']; ?>: 
+		<b><?php echo stripslashes($results_array['page_title']); ?></b>
+		-
+		<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>"><?php echo $HEADING['MODIFY_PAGE']; ?></a>
+		-
+		<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page_id; ?>"><?php echo $TEXT['CHANGE_SETTINGS']; ?></a>
+	</td>
+</tr>
+</table>
+
+<?php
 $query_sections = $database->query("SELECT section_id,module,position,block FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
-if($query_sections->numRows() > 0) {
-?>
-<form name="section_properties" action="<?php echo ADMIN_URL; ?>/pages/sections_save.php?page_id=<?php echo $page_id; ?>" method="post">
-
-<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%">
-<tr>
-	<td><?php echo $TEXT['TYPE']; ?>:</td>
-	<?php if(SECTION_BLOCKS) { ?>
-	<td style="display: {DISPLAY_BLOCK}"><?php echo $TEXT['BLOCK']; ?>:</td>
-	<?php } ?>
-	<td colspan="3" width="60"><?php echo $TEXT['ACTIONS']; ?>:</td>
-</tr>
+if($query_sections->numRows() > 0) {
+?>
+<form name="section_properties" action="<?php echo ADMIN_URL; ?>/pages/sections_save.php?page_id=<?php echo $page_id; ?>" method="post">
+
+<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%">
+<tr>
+	<td><?php echo $TEXT['TYPE']; ?>:</td>
+	<?php if(SECTION_BLOCKS) { ?>
+	<td style="display: {DISPLAY_BLOCK}"><?php echo $TEXT['BLOCK']; ?>:</td>
+	<?php } ?>
+	<td colspan="3" width="60"><?php echo $TEXT['ACTIONS']; ?>:</td>
+</tr>
 <?php
 	$num_sections = $query_sections->numRows();
 	while($section = $query_sections->fetchRow()) {
-		// Get the modules real name
+		// Get the modules real name
 		$module_path = WB_PATH.'/modules/'.$section['module'].'/info.php';
 		if(file_exists($module_path)) {
 			require($module_path);
 			if(!isset($module_type)) { $module_type = 'unknown'; }
-			if(!is_numeric(array_search($section['module'], $module_permissions)) AND $module_type == 'page') {
-			?>
-			<tr>
-				<td style="width: 250px;"><a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>#<?php echo $section['section_id']; ?>"><?php echo $module_name; ?></a></td>
-				<?php if(SECTION_BLOCKS) { ?>
-				<td>
-					<select name="block<?php echo $section['section_id']; ?>" style="width: 150px;">
-						<?php
-						foreach($block AS $number => $name) {
-							?>
-							<option value="<?php echo $number; ?>"<?php if($number == $section['block']) { echo ' selected'; } ?>><?php echo $name; ?></option>
-							<?php
-						}
-						?>
-					</select>
-				</td>
-				<?php } ?>
-				<td width="20">
-					<?php if($section['position'] != 1) { ?>
-					<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section['section_id']; ?>">
-						<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" alt="^" border="0" />
-					</a>
-					<?php } ?>
-				</td>
-				<td width="20">
-					<?php if($section['position'] != $num_sections) { ?>
-					<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section['section_id']; ?>">
-						<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" alt="v" border="0" />
-					</a>
-					<?php } ?>
-				</td>
-				<td width="20">
-					<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section['section_id']; ?>');">
-						<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="Del" border="0" />
-					</a>
-				</td>
-			</tr>
-			<?php
+			if(!is_numeric(array_search($section['module'], $module_permissions)) AND $module_type == 'page') {
+			?>
+			<tr>
+				<td style="width: 250px;"><a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>#<?php echo $section['section_id']; ?>"><?php echo $module_name; ?></a></td>
+				<?php if(SECTION_BLOCKS) { ?>
+				<td>
+					<select name="block<?php echo $section['section_id']; ?>" style="width: 150px;">
+						<?php
+						foreach($block AS $number => $name) {
+							?>
+							<option value="<?php echo $number; ?>"<?php if($number == $section['block']) { echo ' selected'; } ?>><?php echo $name; ?></option>
+							<?php
+						}
+						?>
+					</select>
+				</td>
+				<?php } ?>
+				<td width="20">
+					<?php if($section['position'] != 1) { ?>
+					<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section['section_id']; ?>">
+						<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" alt="^" border="0" />
+					</a>
+					<?php } ?>
+				</td>
+				<td width="20">
+					<?php if($section['position'] != $num_sections) { ?>
+					<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section['section_id']; ?>">
+						<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" alt="v" border="0" />
+					</a>
+					<?php } ?>
+				</td>
+				<td width="20">
+					<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section['section_id']; ?>');">
+						<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="Del" border="0" />
+					</a>
+				</td>
+			</tr>
+			<?php
 			}
 			if(isset($module_type)) { unset($module_type); } // Unset module type
 		}
-	}
-	?>
-	<tr>
-		<td>&nbsp;</td>
-		<?php if(SECTION_BLOCKS) { ?>
-		<td><input type="submit" name="save" value="<?php echo $TEXT['SAVE']; ?>" style="width: 150px;" /></td>
-		<?php } ?>
-		<td colspan="3" width="60">&nbsp;</td>
-	</tr>
-	</table>
-
-</form>
-
+	}
+	?>
+	<tr>
+		<td>&nbsp;</td>
+		<?php if(SECTION_BLOCKS) { ?>
+		<td><input type="submit" name="save" value="<?php echo $TEXT['SAVE']; ?>" style="width: 150px;" /></td>
+		<?php } ?>
+		<td colspan="3" width="60">&nbsp;</td>
+	</tr>
+	</table>
+
+</form>
+
 <?php
-}
-
-// Work-out if we should show the "Add Section" form
+}
+
+// Work-out if we should show the "Add Section" form
 $query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
-if($query_sections->numRows() == 0) {
-	?>
-	<h2><?php echo $TEXT['ADD_SECTION']; ?></h2>
-	
-	<form name="add" action="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page_id; ?>" method="post">
-	
-	<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%">
-	<tr>
-		<td>
-			<select name="module" style="width: 100%;">
-			<?php
+if($query_sections->numRows() == 0) {
+	?>
+	<h2><?php echo $TEXT['ADD_SECTION']; ?></h2>
+	
+	<form name="add" action="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page_id; ?>" method="post">
+	
+	<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%">
+	<tr>
+		<td>
+			<select name="module" style="width: 100%;">
+			<?php
 			// Insert module list
 			if($handle = opendir(WB_PATH.'/modules/')) {
 				while (false !== ($file = readdir($handle))) {
-					if($file != '.' AND $file != '..' AND $file != 'CVS' AND $file != 'menu_link' AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
-						// Include the modules info file
+					if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'menu_link' AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
+						// Include the modules info file
 						require(WB_PATH.'/modules/'.$file.'/info.php');
-						// Check if user is allowed to use this module
+						// Check if user is allowed to use this module
 						if(!isset($module_type)) { $module_type = 'unknown'; }
 						if(!is_numeric(array_search($file, $module_permissions)) AND $module_type == 'page') {
-							?>
-							<option value="<?php echo $file; ?>"<?php if($file == 'wysiwyg') { echo 'selected'; } ?>><?php echo $module_name; ?></option>
-							<?php
+							?>
+							<option value="<?php echo $file; ?>"<?php if($file == 'wysiwyg') { echo 'selected'; } ?>><?php echo $module_name; ?></option>
+							<?php
 						}
-						if(isset($module_type)) { unset($module_type); } // Unset module type-			
+						if(isset($module_type)) { unset($module_type); } // Unset module type
+			
 					}
 				}
-			}
-			?>
-			</select>
-		</td>
-		<td width="100">
-			<input type="submit" name="submit" value="<?php echo $TEXT['ADD']; ?>" style="width: 100px" />
-		</td>
-	</tr>
-	</table>
-	
-	</form>
-	<?php
-}
+			}
+			?>
+			</select>
+		</td>
+		<td width="100">
+			<input type="submit" name="submit" value="<?php echo $TEXT['ADD']; ?>" style="width: 100px" />
+		</td>
+	</tr>
+	</table>
+	
+	</form>
+	<?php
+}
 
 // Print admin footer
 $admin->print_footer();
 
-?>
\ No newline at end of file
+?>
Index: trunk/wb/admin/settings/index.php
===================================================================
--- trunk/wb/admin/settings/index.php	(revision 7)
+++ trunk/wb/admin/settings/index.php	(revision 8)
@@ -1,566 +1,564 @@
-<?php
-
-// $Id: index.php,v 1.14 2005/06/21 09:15:39 rdjurovich Exp $
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
-	$admin = new admin('Settings', 'settings_advanced');
-} else {
-	$admin = new admin('Settings', 'settings_basic');
-}
-
-// Create new database object
-$database = new database();
-
-// Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
-
-// Create new template object
-$template = new Template(ADMIN_PATH.'/settings');
-$template->set_file('page', 'template.html');
-$template->set_block('page', 'main_block', 'main');
-
-// Query current settings in the db, then loop through them and print them
-$query = "SELECT * FROM ".TABLE_PREFIX."settings";
-$results = $database->query($query);
-while($setting = $results->fetchRow()) {
-	$setting_name = $setting['name'];
-	$setting_value = htmlspecialchars(stripslashes($setting['value']));
-	switch($setting_name) {
-		// Website title
-		case 'title':
-			$template->set_var('TITLE', $setting_value);
-		break;
-		// Website description
-		case 'description':
-			$template->set_var('DESCRIPTION', $setting_value);
-		break;
-		// Website keywords
-		case 'keywords':
-			$template->set_var('KEYWORDS', $setting_value);
-		break;
-		// Website header
-		case 'header':
-			$template->set_var('HEADER', $setting_value);
-		break;
-		// Website header
-		case 'header':
-			$template->set_var('HEADER', $setting_value);
-		break;
-		// Website footer
-		case 'footer':
-			$template->set_var('FOOTER', $setting_value);
-		break;
-	}
-}
-
-// Query current settings in the db, then loop through them and print them
-$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
-$results = $database->query($query);
-while($setting = $results->fetchRow()) {
-	$setting_name = $setting['name'];
-	$setting_value = htmlspecialchars(stripslashes($setting['value']));
-	switch($setting_name) {
-		// Search header
-		case 'header':
-			$template->set_var('SEARCH_HEADER', $setting_value);
-		break;
-		// Search results header
-		case 'results_header':
-			$template->set_var('SEARCH_RESULTS_HEADER', $setting_value);
-		break;
-		// Search results loop
-		case 'results_loop':
-			$template->set_var('SEARCH_RESULTS_LOOP', $setting_value);
-		break;
-		// Search results footer
-		case 'results_footer':
-			$template->set_var('SEARCH_RESULTS_FOOTER', $setting_value);
-		break;
-		// Search no results
-		case 'no_results':
-			$template->set_var('SEARCH_NO_RESULTS', $setting_value);
-		break;
-		// Search footer
-		case 'footer':
-			$template->set_var('SEARCH_FOOTER', $setting_value);
-		break;
-		// Search template
-		case 'template':
-			$search_template = $setting_value;
-		break;
-	}
-}
-
-// Do the same for settings stored in config file as with ones in db
-$database_type = '';
-
-// Tell the browser whether or not to show advanced options
-if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
-	$template->set_var('DISPLAY_ADVANCED', '');
-	$template->set_var('ADVANCED', 'yes');
-	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
-	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
-	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
-	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
-} else {
-	$template->set_var('DISPLAY_ADVANCED', 'none');
-	$template->set_var('ADVANCED', 'no');
-	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
-	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
-	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
-	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
-}
-
-$template->set_var(array(	
-									'PAGE_EXTENSION' => PAGE_EXTENSION,
-									'PAGE_SPACER' => PAGE_SPACER,
-									'WB_PATH' => WB_PATH,
-									'WB_URL' => WB_URL,
-									'ADMIN_PATH' => ADMIN_PATH,
-									'ADMIN_URL' => ADMIN_URL,
-									'DATABASE_TYPE' => DB_TYPE,
-									'DATABASE_HOST' => DB_HOST,
-									'DATABASE_USERNAME' => DB_USERNAME,
-									'DATABASE_NAME' => DB_NAME,
-									'TABLE_PREFIX' => TABLE_PREFIX
-								 )
-						 );
-
-// Insert groups into signup list
-$template->set_block('main_block', 'group_list_block', 'group_list');
-$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
-if($results->numRows() > 0) {
-	while($group = $results->fetchRow()) {
-		$template->set_var('ID', $group['group_id']);
-		$template->set_var('NAME', $group['name']);
-		if(FRONTEND_SIGNUP == $group['group_id']) {
-			$template->set_var('SELECTED', 'selected');
-		} else {
-			$template->set_var('SELECTED', '');
-		}
-		$template->parse('group_list', 'group_list_block', true);
-	}
-} else {
-	$template->set_var('ID', 'disabled');
-	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
-	$template->parse('group_list', 'group_list_block', true);
-}
-
-// Insert language values
-$template->set_block('main_block', 'language_list_block', 'language_list');
+<?php
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2005, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
+	$admin = new admin('Settings', 'settings_advanced');
+} else {
+	$admin = new admin('Settings', 'settings_basic');
+}
+
+// Create new database object
+$database = new database();
+
+// Include the WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
+// Create new template object
+$template = new Template(ADMIN_PATH.'/settings');
+$template->set_file('page', 'template.html');
+$template->set_block('page', 'main_block', 'main');
+
+// Query current settings in the db, then loop through them and print them
+$query = "SELECT * FROM ".TABLE_PREFIX."settings";
+$results = $database->query($query);
+while($setting = $results->fetchRow()) {
+	$setting_name = $setting['name'];
+	$setting_value = htmlspecialchars(stripslashes($setting['value']));
+	switch($setting_name) {
+		// Website title
+		case 'title':
+			$template->set_var('TITLE', $setting_value);
+		break;
+		// Website description
+		case 'description':
+			$template->set_var('DESCRIPTION', $setting_value);
+		break;
+		// Website keywords
+		case 'keywords':
+			$template->set_var('KEYWORDS', $setting_value);
+		break;
+		// Website header
+		case 'header':
+			$template->set_var('HEADER', $setting_value);
+		break;
+		// Website header
+		case 'header':
+			$template->set_var('HEADER', $setting_value);
+		break;
+		// Website footer
+		case 'footer':
+			$template->set_var('FOOTER', $setting_value);
+		break;
+	}
+}
+
+// Query current settings in the db, then loop through them and print them
+$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
+$results = $database->query($query);
+while($setting = $results->fetchRow()) {
+	$setting_name = $setting['name'];
+	$setting_value = htmlspecialchars(stripslashes($setting['value']));
+	switch($setting_name) {
+		// Search header
+		case 'header':
+			$template->set_var('SEARCH_HEADER', $setting_value);
+		break;
+		// Search results header
+		case 'results_header':
+			$template->set_var('SEARCH_RESULTS_HEADER', $setting_value);
+		break;
+		// Search results loop
+		case 'results_loop':
+			$template->set_var('SEARCH_RESULTS_LOOP', $setting_value);
+		break;
+		// Search results footer
+		case 'results_footer':
+			$template->set_var('SEARCH_RESULTS_FOOTER', $setting_value);
+		break;
+		// Search no results
+		case 'no_results':
+			$template->set_var('SEARCH_NO_RESULTS', $setting_value);
+		break;
+		// Search footer
+		case 'footer':
+			$template->set_var('SEARCH_FOOTER', $setting_value);
+		break;
+		// Search template
+		case 'template':
+			$search_template = $setting_value;
+		break;
+	}
+}
+
+// Do the same for settings stored in config file as with ones in db
+$database_type = '';
+
+// Tell the browser whether or not to show advanced options
+if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
+	$template->set_var('DISPLAY_ADVANCED', '');
+	$template->set_var('ADVANCED', 'yes');
+	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
+	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
+	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
+	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
+} else {
+	$template->set_var('DISPLAY_ADVANCED', 'none');
+	$template->set_var('ADVANCED', 'no');
+	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
+	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
+	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
+	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
+}
+
+$template->set_var(array(	
+									'PAGE_EXTENSION' => PAGE_EXTENSION,
+									'PAGE_SPACER' => PAGE_SPACER,
+									'WB_PATH' => WB_PATH,
+									'WB_URL' => WB_URL,
+									'ADMIN_PATH' => ADMIN_PATH,
+									'ADMIN_URL' => ADMIN_URL,
+									'DATABASE_TYPE' => DB_TYPE,
+									'DATABASE_HOST' => DB_HOST,
+									'DATABASE_USERNAME' => DB_USERNAME,
+									'DATABASE_NAME' => DB_NAME,
+									'TABLE_PREFIX' => TABLE_PREFIX
+								 )
+						 );
+
+// Insert groups into signup list
+$template->set_block('main_block', 'group_list_block', 'group_list');
+$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
+if($results->numRows() > 0) {
+	while($group = $results->fetchRow()) {
+		$template->set_var('ID', $group['group_id']);
+		$template->set_var('NAME', $group['name']);
+		if(FRONTEND_SIGNUP == $group['group_id']) {
+			$template->set_var('SELECTED', 'selected');
+		} else {
+			$template->set_var('SELECTED', '');
+		}
+		$template->parse('group_list', 'group_list_block', true);
+	}
+} else {
+	$template->set_var('ID', 'disabled');
+	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
+	$template->parse('group_list', 'group_list_block', true);
+}
+
+// Insert language values
+$template->set_block('main_block', 'language_list_block', 'language_list');
 if($handle = opendir(WB_PATH.'/languages/')) {
-   while (false !== ($file = readdir($handle))) {
-		if($file != '.' AND $file != '..' AND $file != 'CVS' AND $file != 'index.php') {
-			// Get language name
-			require(WB_PATH.'/languages/'.$file);
-			// Insert code and name
-			$template->set_var(array(
-											'CODE' => $language_code,
-											'NAME' => $language_name
-											)
-									);
-			// Check if it is selected
-			if(DEFAULT_LANGUAGE == $language_code) {
-				$template->set_var('SELECTED', ' selected');
-			} else {
-				$template->set_var('SELECTED', '');
-			}
-			$template->parse('language_list', 'language_list_block', true);
-		}
-	}
-	// Restore language to original file
-	require(WB_PATH.'/languages/'.LANGUAGE.'.php');
-}
-
-// Insert default timezone values
-require(ADMIN_PATH.'/interface/timezones.php');
-$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
-foreach($TIMEZONES AS $hour_offset => $title) {
-	// Make sure we dont list "System Default" as we are setting this value!
-	if($hour_offset != '-20') {
-		$template->set_var('VALUE', $hour_offset);
-		$template->set_var('NAME', $title);
-		if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
-			$template->set_var('SELECTED', 'selected');
-		} else {
-			$template->set_var('SELECTED', '');
-		}
-		$template->parse('timezone_list', 'timezone_list_block', true);
-	}
-}
-
-// Insert date format list
-require(ADMIN_PATH.'/interface/date_formats.php');
-$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
-foreach($DATE_FORMATS AS $format => $title) {
-	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
-	if($format != 'system_default') {
-		$template->set_var('VALUE', $format);
-	} else {
-		$template->set_var('VALUE', '');
-	}
-	$template->set_var('NAME', $title);
-	if(DEFAULT_DATE_FORMAT == $format) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('date_format_list', 'date_format_list_block', true);
-}
-
-// Insert time format list
-require(ADMIN_PATH.'/interface/time_formats.php');
-$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
-foreach($TIME_FORMATS AS $format => $title) {
-	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
-	if($format != 'system_default') {
-		$template->set_var('VALUE', $format);
-	} else {
-		$template->set_var('VALUE', '');
-	}
-	$template->set_var('NAME', $title);
-	if(DEFAULT_TIME_FORMAT == $format) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('time_format_list', 'time_format_list_block', true);
-}
-
-// Insert templates
-$template->set_block('main_block', 'template_list_block', 'template_list');
+   while (false !== ($file = readdir($handle))) {
+		if($file != '.' AND $file != '..' AND !is_dir($file) AND $file != 'index.php') {
+			// Get language name
+			require(WB_PATH.'/languages/'.$file);
+			// Insert code and name
+			$template->set_var(array(
+											'CODE' => $language_code,
+											'NAME' => $language_name
+											)
+									);
+			// Check if it is selected
+			if(DEFAULT_LANGUAGE == $language_code) {
+				$template->set_var('SELECTED', ' selected');
+			} else {
+				$template->set_var('SELECTED', '');
+			}
+			$template->parse('language_list', 'language_list_block', true);
+		}
+	}
+	// Restore language to original file
+	require(WB_PATH.'/languages/'.LANGUAGE.'.php');
+}
+
+// Insert default timezone values
+require(ADMIN_PATH.'/interface/timezones.php');
+$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
+foreach($TIMEZONES AS $hour_offset => $title) {
+	// Make sure we dont list "System Default" as we are setting this value!
+	if($hour_offset != '-20') {
+		$template->set_var('VALUE', $hour_offset);
+		$template->set_var('NAME', $title);
+		if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
+			$template->set_var('SELECTED', 'selected');
+		} else {
+			$template->set_var('SELECTED', '');
+		}
+		$template->parse('timezone_list', 'timezone_list_block', true);
+	}
+}
+
+// Insert date format list
+require(ADMIN_PATH.'/interface/date_formats.php');
+$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
+foreach($DATE_FORMATS AS $format => $title) {
+	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
+	if($format != 'system_default') {
+		$template->set_var('VALUE', $format);
+	} else {
+		$template->set_var('VALUE', '');
+	}
+	$template->set_var('NAME', $title);
+	if(DEFAULT_DATE_FORMAT == $format) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('date_format_list', 'date_format_list_block', true);
+}
+
+// Insert time format list
+require(ADMIN_PATH.'/interface/time_formats.php');
+$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
+foreach($TIME_FORMATS AS $format => $title) {
+	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
+	if($format != 'system_default') {
+		$template->set_var('VALUE', $format);
+	} else {
+		$template->set_var('VALUE', '');
+	}
+	$template->set_var('NAME', $title);
+	if(DEFAULT_TIME_FORMAT == $format) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('time_format_list', 'time_format_list_block', true);
+}
+
+// Insert templates
+$template->set_block('main_block', 'template_list_block', 'template_list');
 if($handle = opendir(WB_PATH.'/templates/')) {
 	while (false !== ($file = readdir($handle))) {
-		if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
-			include(WB_PATH."/templates/$file/info.php");
-			$template->set_var('FILE', $file);
-			$template->set_var('NAME', $template_name);
-			if($file == DEFAULT_TEMPLATE ? $selected = ' selected' : $selected = '');
-			$template->set_var('SELECTED', $selected);
-			$template->parse('template_list', 'template_list_block', true);
-		}
-	}
-}
-
-// Insert templates for search settings
-$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
-if($search_template == '') { $selected = ' selected'; } else { $selected = ''; }
-$template->set_var(array('FILE' => '', 'NAME' => $TEXT['SYSTEM_DEFAULT'], 'SELECTED' => $selected));
-$template->parse('search_template_list', 'search_template_list_block', true);
+		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
+			include(WB_PATH."/templates/$file/info.php");
+			$template->set_var('FILE', $file);
+			$template->set_var('NAME', $template_name);
+			if($file == DEFAULT_TEMPLATE ? $selected = ' selected' : $selected = '');
+			$template->set_var('SELECTED', $selected);
+			$template->parse('template_list', 'template_list_block', true);
+		}
+	}
+}
+
+// Insert templates for search settings
+$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
+if($search_template == '') { $selected = ' selected'; } else { $selected = ''; }
+$template->set_var(array('FILE' => '', 'NAME' => $TEXT['SYSTEM_DEFAULT'], 'SELECTED' => $selected));
+$template->parse('search_template_list', 'search_template_list_block', true);
 if($handle = opendir(WB_PATH.'/templates/')) {
 	while (false !== ($file = readdir($handle))) {
-		if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
-			include(WB_PATH."/templates/$file/info.php");
-			$template->set_var('FILE', $file);
-			$template->set_var('NAME', $template_name);
-			if($file == $search_template ? $selected = ' selected' : $selected = '');
-			$template->set_var('SELECTED', $selected);
-			$template->parse('search_template_list', 'search_template_list_block', true);
-		}
-	}
-}
-
-// Insert default error reporting values
-require(ADMIN_PATH.'/interface/er_levels.php');
-$template->set_block('main_block', 'error_reporting_list_block', 'error_reporting_list');
-foreach($ER_LEVELS AS $value => $title) {
-	$template->set_var('VALUE', $value);
-	$template->set_var('NAME', $title);
-	if(ER_LEVEL == $value) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
-}
-
-// Insert permissions values
-if($admin->get_permission('settings_advanced') != true) {
-	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
-}
-
-// Insert page level limits
-$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
-for($i = 1; $i <= 10; $i++) {
-	$template->set_var('NUMBER', $i);
-	if(PAGE_LEVEL_LIMIT == $i) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
-}
-
-// Work-out if multiple menus feature is enabled
-if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
-	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked');
-} else {
-	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked');
-}
-
-// Work-out if page languages feature is enabled
-if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
-	$template->set_var('PAGE_LANGUAGES_ENABLED', ' checked');
-} else {
-	$template->set_var('PAGE_LANGUAGES_DISABLED', ' checked');
-}
-
-// Work-out if smart login feature is enabled
-if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
-	$template->set_var('SMART_LOGIN_ENABLED', ' checked');
-} else {
-	$template->set_var('SMART_LOGIN_DISABLED', ' checked');
-}
-
-// Work-out if section blocks feature is enabled
-if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
-	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked');
-} else {
-	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked');
-}
-
-// Work-out if homepage redirection feature is enabled
-if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
-	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked');
-} else {
-	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked');
-}
-
-// Work-out which server os should be checked
-if(OPERATING_SYSTEM == 'linux') {
-	$template->set_var('LINUX_SELECTED', ' checked');
-} elseif(OPERATING_SYSTEM == 'windows') {
-	$template->set_var('WINDOWS_SELECTED', ' checked');
-}
-
-// Work-out if manage sections feature is enabled
-if(MANAGE_SECTIONS) {
-	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked');
-} else {
-	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked');
-}
-
-// Work-out if intro feature is enabled
-if(INTRO_PAGE) {
-	$template->set_var('INTRO_PAGE_ENABLED', ' checked');
-} else {
-	$template->set_var('INTRO_PAGE_DISABLED', ' checked');
-}
-
-// Work-out if frontend login feature is enabled
-if(FRONTEND_LOGIN) {
-	$template->set_var('PRIVATE_ENABLED', ' checked');
-} else {
-	$template->set_var('PRIVATE_DISABLED', ' checked');
-}
-
-// Work-out if page trash feature is disabled, in-line, or separate
-if(PAGE_TRASH == 'disabled') {
-	$template->set_var('PAGE_TRASH_DISABLED', ' checked');
-} elseif(PAGE_TRASH == 'inline') {
-	$template->set_var('PAGE_TRASH_INLINE', ' checked');
-} elseif(PAGE_TRASH == 'separate') {
-	$template->set_var('PAGE_TRASH_SEPARATE', ' checked');
-}
-
-// Work-out if media home folde feature is enabled
-if(HOME_FOLDERS) {
-	$template->set_var('HOME_FOLDERS_ENABLED', ' checked');
-} else {
-	$template->set_var('HOME_FOLDERS_DISABLED', ' checked');
-}
-
-// Insert search select
-if(SEARCH == 'private') {
-	$template->set_var('PRIVATE_SEARCH', 'selected');
-} elseif(SEARCH == 'registered') {
-	$template->set_var('REGISTERED_SEARCH', 'selected');
-} elseif(SEARCH == 'none') {
-	$template->set_var('NONE_SEARCH', 'selected');
-}
-
-// Work-out if 777 permissions are set
-if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
-	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked');
-}
-
-// Work-out which file mode boxes are checked
-if(extract_permission(STRING_FILE_MODE, 'u', 'r')) {
-	$template->set_var('FILE_U_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'u', 'w')) {
-	$template->set_var('FILE_U_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'u', 'e')) {
-	$template->set_var('FILE_U_E_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'g', 'r')) {
-	$template->set_var('FILE_G_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'g', 'w')) {
-	$template->set_var('FILE_G_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'g', 'e')) {
-	$template->set_var('FILE_G_E_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'o', 'r')) {
-	$template->set_var('FILE_O_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'o', 'w')) {
-	$template->set_var('FILE_O_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'o', 'e')) {
-	$template->set_var('FILE_O_E_CHECKED', 'checked');
-}
-// Work-out which dir mode boxes are checked
-if(extract_permission(STRING_DIR_MODE, 'u', 'r')) {
-	$template->set_var('DIR_U_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'u', 'w')) {
-	$template->set_var('DIR_U_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'u', 'e')) {
-	$template->set_var('DIR_U_E_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'g', 'r')) {
-	$template->set_var('DIR_G_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'g', 'w')) {
-	$template->set_var('DIR_G_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'g', 'e')) {
-	$template->set_var('DIR_G_E_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'o', 'r')) {
-	$template->set_var('DIR_O_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'o', 'w')) {
-	$template->set_var('DIR_O_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'o', 'e')) {
-	$template->set_var('DIR_O_E_CHECKED', 'checked');
-}
-
-// Insert WYSIWYG style value into template
-$template->set_var('WYSIWYG_STYLE', stripslashes(WYSIWYG_STYLE));
-
-// Insert Server Email value into template
-$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
-
-// Insert language headings
-$template->set_var(array(
-								'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
-								'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
-								'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
-								'HEADING_FILESYSTEM_SETTINGS' => $HEADING['FILESYSTEM_SETTINGS']
-								)
-						);
-// Insert language text and messages
-$template->set_var(array(
-								'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
-								'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
-								'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
-								'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
-								'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
-								'TEXT_HEADER' => $TEXT['HEADER'],
-								'TEXT_FOOTER' => $TEXT['FOOTER'],
-								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
-								'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
-								'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
-								'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
-								'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
-								'TEXT_TEXT' => $TEXT['TEXT'],
-								'TEXT_DEFAULT' => $TEXT['DEFAULT'],
-								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
-								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
-								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
-								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
-								'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
-								'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
-								'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
-								'TEXT_FRONTEND' => $TEXT['FRONTEND'],
-								'TEXT_LOGIN' => $TEXT['LOGIN'],
-								'TEXT_SIGNUP' => $TEXT['SIGNUP'],
-								'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
-								'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
-								'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
-								'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
-								'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
-								'TEXT_WINDOWS' => $TEXT['WINDOWS'],
-								'TEXT_ADMIN' => $TEXT['ADMIN'],
-								'TEXT_TYPE' => $TEXT['TYPE'],
-								'TEXT_DATABASE' => $TEXT['DATABASE'],
-								'TEXT_HOST' => $TEXT['HOST'],
-								'TEXT_USERNAME' => $TEXT['USERNAME'],
-								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
-								'TEXT_NAME' => $TEXT['NAME'],
-								'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
-								'TEXT_SAVE' => $TEXT['SAVE'],
-								'TEXT_RESET' => $TEXT['RESET'],
-								'TEXT_CHANGES' => $TEXT['CHANGES'],
-								'TEXT_ENABLED' => $TEXT['ENABLED'],
-								'TEXT_DISABLED' => $TEXT['DISABLED'],
-								'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
-								'TEXT_MANAGE' => $TEXT['MANAGE'],
-								'TEXT_SEARCH' => $TEXT['SEARCH'],
-								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
-								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
-								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
-								'TEXT_NONE' => $TEXT['NONE'],
-								'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
-								'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
-								'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
-								'TEXT_USER' => $TEXT['USER'],
-								'TEXT_GROUP' => $TEXT['GROUP'],
-								'TEXT_OTHERS' => $TEXT['OTHERS'],
-								'TEXT_READ' => $TEXT['READ'],
-								'TEXT_WRITE' => $TEXT['WRITE'],
-								'TEXT_EXECUTE' => $TEXT['EXECUTE'],
-								'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
-								'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
-								'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
-								'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
-								'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
-								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
-								'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
-								'TEXT_INLINE' => $TEXT['INLINE'],
-								'TEXT_SEPARATE' => $TEXT['SEPARATE'],
-								'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
-								'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
-								'TEXT_SERVER_EMAIL' => $TEXT['SERVER_EMAIL'],
-								'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
-								'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
-								'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING']
-								)
-						);
-
-// Parse template objects output
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
-$admin->print_footer();
-
-?>
\ No newline at end of file
+		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
+			include(WB_PATH."/templates/$file/info.php");
+			$template->set_var('FILE', $file);
+			$template->set_var('NAME', $template_name);
+			if($file == $search_template ? $selected = ' selected' : $selected = '');
+			$template->set_var('SELECTED', $selected);
+			$template->parse('search_template_list', 'search_template_list_block', true);
+		}
+	}
+}
+
+// Insert default error reporting values
+require(ADMIN_PATH.'/interface/er_levels.php');
+$template->set_block('main_block', 'error_reporting_list_block', 'error_reporting_list');
+foreach($ER_LEVELS AS $value => $title) {
+	$template->set_var('VALUE', $value);
+	$template->set_var('NAME', $title);
+	if(ER_LEVEL == $value) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
+}
+
+// Insert permissions values
+if($admin->get_permission('settings_advanced') != true) {
+	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
+}
+
+// Insert page level limits
+$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
+for($i = 1; $i <= 10; $i++) {
+	$template->set_var('NUMBER', $i);
+	if(PAGE_LEVEL_LIMIT == $i) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
+}
+
+// Work-out if multiple menus feature is enabled
+if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
+	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked');
+} else {
+	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked');
+}
+
+// Work-out if page languages feature is enabled
+if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
+	$template->set_var('PAGE_LANGUAGES_ENABLED', ' checked');
+} else {
+	$template->set_var('PAGE_LANGUAGES_DISABLED', ' checked');
+}
+
+// Work-out if smart login feature is enabled
+if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
+	$template->set_var('SMART_LOGIN_ENABLED', ' checked');
+} else {
+	$template->set_var('SMART_LOGIN_DISABLED', ' checked');
+}
+
+// Work-out if section blocks feature is enabled
+if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
+	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked');
+} else {
+	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked');
+}
+
+// Work-out if homepage redirection feature is enabled
+if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
+	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked');
+} else {
+	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked');
+}
+
+// Work-out which server os should be checked
+if(OPERATING_SYSTEM == 'linux') {
+	$template->set_var('LINUX_SELECTED', ' checked');
+} elseif(OPERATING_SYSTEM == 'windows') {
+	$template->set_var('WINDOWS_SELECTED', ' checked');
+}
+
+// Work-out if manage sections feature is enabled
+if(MANAGE_SECTIONS) {
+	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked');
+} else {
+	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked');
+}
+
+// Work-out if intro feature is enabled
+if(INTRO_PAGE) {
+	$template->set_var('INTRO_PAGE_ENABLED', ' checked');
+} else {
+	$template->set_var('INTRO_PAGE_DISABLED', ' checked');
+}
+
+// Work-out if frontend login feature is enabled
+if(FRONTEND_LOGIN) {
+	$template->set_var('PRIVATE_ENABLED', ' checked');
+} else {
+	$template->set_var('PRIVATE_DISABLED', ' checked');
+}
+
+// Work-out if page trash feature is disabled, in-line, or separate
+if(PAGE_TRASH == 'disabled') {
+	$template->set_var('PAGE_TRASH_DISABLED', ' checked');
+} elseif(PAGE_TRASH == 'inline') {
+	$template->set_var('PAGE_TRASH_INLINE', ' checked');
+} elseif(PAGE_TRASH == 'separate') {
+	$template->set_var('PAGE_TRASH_SEPARATE', ' checked');
+}
+
+// Work-out if media home folde feature is enabled
+if(HOME_FOLDERS) {
+	$template->set_var('HOME_FOLDERS_ENABLED', ' checked');
+} else {
+	$template->set_var('HOME_FOLDERS_DISABLED', ' checked');
+}
+
+// Insert search select
+if(SEARCH == 'private') {
+	$template->set_var('PRIVATE_SEARCH', 'selected');
+} elseif(SEARCH == 'registered') {
+	$template->set_var('REGISTERED_SEARCH', 'selected');
+} elseif(SEARCH == 'none') {
+	$template->set_var('NONE_SEARCH', 'selected');
+}
+
+// Work-out if 777 permissions are set
+if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
+	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked');
+}
+
+// Work-out which file mode boxes are checked
+if(extract_permission(STRING_FILE_MODE, 'u', 'r')) {
+	$template->set_var('FILE_U_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'u', 'w')) {
+	$template->set_var('FILE_U_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'u', 'e')) {
+	$template->set_var('FILE_U_E_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'g', 'r')) {
+	$template->set_var('FILE_G_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'g', 'w')) {
+	$template->set_var('FILE_G_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'g', 'e')) {
+	$template->set_var('FILE_G_E_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'o', 'r')) {
+	$template->set_var('FILE_O_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'o', 'w')) {
+	$template->set_var('FILE_O_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'o', 'e')) {
+	$template->set_var('FILE_O_E_CHECKED', 'checked');
+}
+// Work-out which dir mode boxes are checked
+if(extract_permission(STRING_DIR_MODE, 'u', 'r')) {
+	$template->set_var('DIR_U_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'u', 'w')) {
+	$template->set_var('DIR_U_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'u', 'e')) {
+	$template->set_var('DIR_U_E_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'g', 'r')) {
+	$template->set_var('DIR_G_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'g', 'w')) {
+	$template->set_var('DIR_G_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'g', 'e')) {
+	$template->set_var('DIR_G_E_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'o', 'r')) {
+	$template->set_var('DIR_O_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'o', 'w')) {
+	$template->set_var('DIR_O_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'o', 'e')) {
+	$template->set_var('DIR_O_E_CHECKED', 'checked');
+}
+
+// Insert WYSIWYG style value into template
+$template->set_var('WYSIWYG_STYLE', stripslashes(WYSIWYG_STYLE));
+
+// Insert Server Email value into template
+$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
+
+// Insert language headings
+$template->set_var(array(
+								'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
+								'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
+								'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
+								'HEADING_FILESYSTEM_SETTINGS' => $HEADING['FILESYSTEM_SETTINGS']
+								)
+						);
+// Insert language text and messages
+$template->set_var(array(
+								'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
+								'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
+								'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
+								'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
+								'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
+								'TEXT_HEADER' => $TEXT['HEADER'],
+								'TEXT_FOOTER' => $TEXT['FOOTER'],
+								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
+								'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
+								'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
+								'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
+								'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
+								'TEXT_TEXT' => $TEXT['TEXT'],
+								'TEXT_DEFAULT' => $TEXT['DEFAULT'],
+								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
+								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
+								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
+								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
+								'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
+								'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
+								'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
+								'TEXT_FRONTEND' => $TEXT['FRONTEND'],
+								'TEXT_LOGIN' => $TEXT['LOGIN'],
+								'TEXT_SIGNUP' => $TEXT['SIGNUP'],
+								'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
+								'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
+								'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
+								'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
+								'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
+								'TEXT_WINDOWS' => $TEXT['WINDOWS'],
+								'TEXT_ADMIN' => $TEXT['ADMIN'],
+								'TEXT_TYPE' => $TEXT['TYPE'],
+								'TEXT_DATABASE' => $TEXT['DATABASE'],
+								'TEXT_HOST' => $TEXT['HOST'],
+								'TEXT_USERNAME' => $TEXT['USERNAME'],
+								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
+								'TEXT_NAME' => $TEXT['NAME'],
+								'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
+								'TEXT_SAVE' => $TEXT['SAVE'],
+								'TEXT_RESET' => $TEXT['RESET'],
+								'TEXT_CHANGES' => $TEXT['CHANGES'],
+								'TEXT_ENABLED' => $TEXT['ENABLED'],
+								'TEXT_DISABLED' => $TEXT['DISABLED'],
+								'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
+								'TEXT_MANAGE' => $TEXT['MANAGE'],
+								'TEXT_SEARCH' => $TEXT['SEARCH'],
+								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
+								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
+								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
+								'TEXT_NONE' => $TEXT['NONE'],
+								'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
+								'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
+								'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
+								'TEXT_USER' => $TEXT['USER'],
+								'TEXT_GROUP' => $TEXT['GROUP'],
+								'TEXT_OTHERS' => $TEXT['OTHERS'],
+								'TEXT_READ' => $TEXT['READ'],
+								'TEXT_WRITE' => $TEXT['WRITE'],
+								'TEXT_EXECUTE' => $TEXT['EXECUTE'],
+								'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
+								'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
+								'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
+								'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
+								'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
+								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
+								'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
+								'TEXT_INLINE' => $TEXT['INLINE'],
+								'TEXT_SEPARATE' => $TEXT['SEPARATE'],
+								'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
+								'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
+								'TEXT_SERVER_EMAIL' => $TEXT['SERVER_EMAIL'],
+								'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
+								'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
+								'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING']
+								)
+						);
+
+// Parse template objects output
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
+$admin->print_footer();
+
+?>
Index: trunk/wb/admin/preferences/index.php
===================================================================
--- trunk/wb/admin/preferences/index.php	(revision 7)
+++ trunk/wb/admin/preferences/index.php	(revision 8)
@@ -1,160 +1,158 @@
-<?php
-
-// $Id: index.php,v 1.2 2005/04/02 06:25:37 rdjurovich Exp $
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Preferences');
-
-// Create new template object for the preferences form
-$template = new Template(ADMIN_PATH.'/preferences');
-$template->set_file('page', 'template.html');
-$template->set_block('page', 'main_block', 'main');
-
-// Get existing value from database
-$database = new database();
-$query = "SELECT display_name,email FROM ".TABLE_PREFIX."users WHERE user_id = '".$admin->get_user_id()."'";
-$results = $database->query($query);
-if($database->is_error()) {
-	$admin->print_error($database->get_error(), 'index.php');
-}
-$details = $results->fetchRow();
-
-// Insert values into form
-$template->set_var('DISPLAY_NAME', $details['display_name']);
-$template->set_var('EMAIL', $details['email']);
-
-// Insert language values
-$template->set_block('main_block', 'language_list_block', 'language_list');
+<?php
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2005, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Preferences');
+
+// Create new template object for the preferences form
+$template = new Template(ADMIN_PATH.'/preferences');
+$template->set_file('page', 'template.html');
+$template->set_block('page', 'main_block', 'main');
+
+// Get existing value from database
+$database = new database();
+$query = "SELECT display_name,email FROM ".TABLE_PREFIX."users WHERE user_id = '".$admin->get_user_id()."'";
+$results = $database->query($query);
+if($database->is_error()) {
+	$admin->print_error($database->get_error(), 'index.php');
+}
+$details = $results->fetchRow();
+
+// Insert values into form
+$template->set_var('DISPLAY_NAME', $details['display_name']);
+$template->set_var('EMAIL', $details['email']);
+
+// Insert language values
+$template->set_block('main_block', 'language_list_block', 'language_list');
 if($handle = opendir(WB_PATH.'/languages/')) {
-   while (false !== ($file = readdir($handle))) {
-		if($file != '.' AND $file != '..' AND $file != 'CVS' AND $file != 'index.php') {
-			// Get language name
-			require(WB_PATH.'/languages/'.$file);
-			// Insert code and name
-			$template->set_var(array(
-											'CODE' => $language_code,
-											'NAME' => $language_name
-											)
-									);
-			// Check if it is selected
-			if(LANGUAGE == $language_code) {
-				$template->set_var('SELECTED', ' selected');
-			} else {
-				$template->set_var('SELECTED', '');
-			}
-			$template->parse('language_list', 'language_list_block', true);
-		}
-	}
-	// Restore language to original file
-	require(WB_PATH.'/languages/'.LANGUAGE.'.php');
-}
-
-// Insert default timezone values
-require(ADMIN_PATH.'/interface/timezones.php');
-$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
-foreach($TIMEZONES AS $hour_offset => $title) {
-	$template->set_var('VALUE', $hour_offset);
-	$template->set_var('NAME', $title);
-	if($admin->get_timezone() == $hour_offset*60*60) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('timezone_list', 'timezone_list_block', true);
-}
-
-// Insert date format list
-$user_time = true;
-require(ADMIN_PATH.'/interface/date_formats.php');
-$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
-foreach($DATE_FORMATS AS $format => $title) {
-	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
-	if($format != 'system_default') {
-		$template->set_var('VALUE', $format);
-	} else {
-		$template->set_var('VALUE', '');
-	}
-	$template->set_var('NAME', $title);
-	if(DATE_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
-		$template->set_var('SELECTED', 'selected');
-	} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('date_format_list', 'date_format_list_block', true);
-}
-
-// Insert time format list
-require(ADMIN_PATH.'/interface/time_formats.php');
-$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
-foreach($TIME_FORMATS AS $format => $title) {
-	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
-	if($format != 'system_default') {
-		$template->set_var('VALUE', $format);
-	} else {
-		$template->set_var('VALUE', '');
-	}
-	$template->set_var('NAME', $title);
-	if(TIME_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
-		$template->set_var('SELECTED', 'selected');
-	} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('time_format_list', 'time_format_list_block', true);
-}
-
-// Insert language headings
-$template->set_var(array(
-								'HEADING_MY_SETTINGS' => $HEADING['MY_SETTINGS'],
-								'HEADING_MY_EMAIL' => $HEADING['MY_EMAIL'],
-								'HEADING_MY_PASSWORD' => $HEADING['MY_PASSWORD']
-								)
-						);
-// Insert language text and messages
-$template->set_var(array(
-								'TEXT_SAVE' => $TEXT['SAVE'],
-								'TEXT_RESET' => $TEXT['RESET'],
-								'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
-								'TEXT_EMAIL' => $TEXT['EMAIL'],
-								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
-								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
-								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
-								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
-								'TEXT_CURRENT_PASSWORD' => $TEXT['CURRENT_PASSWORD'],
-								'TEXT_NEW_PASSWORD' => $TEXT['NEW_PASSWORD'],
-								'TEXT_RETYPE_NEW_PASSWORD' => $TEXT['RETYPE_NEW_PASSWORD']
-								)
-						);
-
-// Parse template for preferences form
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
-$admin->print_footer();
-
-?>
\ No newline at end of file
+   while (false !== ($file = readdir($handle))) {
+		if($file != '.' AND $file != '..' AND !is_dir($file) AND $file != 'index.php') {
+			// Get language name
+			require(WB_PATH.'/languages/'.$file);
+			// Insert code and name
+			$template->set_var(array(
+											'CODE' => $language_code,
+											'NAME' => $language_name
+											)
+									);
+			// Check if it is selected
+			if(LANGUAGE == $language_code) {
+				$template->set_var('SELECTED', ' selected');
+			} else {
+				$template->set_var('SELECTED', '');
+			}
+			$template->parse('language_list', 'language_list_block', true);
+		}
+	}
+	// Restore language to original file
+	require(WB_PATH.'/languages/'.LANGUAGE.'.php');
+}
+
+// Insert default timezone values
+require(ADMIN_PATH.'/interface/timezones.php');
+$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
+foreach($TIMEZONES AS $hour_offset => $title) {
+	$template->set_var('VALUE', $hour_offset);
+	$template->set_var('NAME', $title);
+	if($admin->get_timezone() == $hour_offset*60*60) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('timezone_list', 'timezone_list_block', true);
+}
+
+// Insert date format list
+$user_time = true;
+require(ADMIN_PATH.'/interface/date_formats.php');
+$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
+foreach($DATE_FORMATS AS $format => $title) {
+	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
+	if($format != 'system_default') {
+		$template->set_var('VALUE', $format);
+	} else {
+		$template->set_var('VALUE', '');
+	}
+	$template->set_var('NAME', $title);
+	if(DATE_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
+		$template->set_var('SELECTED', 'selected');
+	} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('date_format_list', 'date_format_list_block', true);
+}
+
+// Insert time format list
+require(ADMIN_PATH.'/interface/time_formats.php');
+$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
+foreach($TIME_FORMATS AS $format => $title) {
+	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
+	if($format != 'system_default') {
+		$template->set_var('VALUE', $format);
+	} else {
+		$template->set_var('VALUE', '');
+	}
+	$template->set_var('NAME', $title);
+	if(TIME_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
+		$template->set_var('SELECTED', 'selected');
+	} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('time_format_list', 'time_format_list_block', true);
+}
+
+// Insert language headings
+$template->set_var(array(
+								'HEADING_MY_SETTINGS' => $HEADING['MY_SETTINGS'],
+								'HEADING_MY_EMAIL' => $HEADING['MY_EMAIL'],
+								'HEADING_MY_PASSWORD' => $HEADING['MY_PASSWORD']
+								)
+						);
+// Insert language text and messages
+$template->set_var(array(
+								'TEXT_SAVE' => $TEXT['SAVE'],
+								'TEXT_RESET' => $TEXT['RESET'],
+								'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
+								'TEXT_EMAIL' => $TEXT['EMAIL'],
+								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
+								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
+								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
+								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
+								'TEXT_CURRENT_PASSWORD' => $TEXT['CURRENT_PASSWORD'],
+								'TEXT_NEW_PASSWORD' => $TEXT['NEW_PASSWORD'],
+								'TEXT_RETYPE_NEW_PASSWORD' => $TEXT['RETYPE_NEW_PASSWORD']
+								)
+						);
+
+// Parse template for preferences form
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
+$admin->print_footer();
+
+?>
Index: trunk/wb/admin/modules/install.php
===================================================================
--- trunk/wb/admin/modules/install.php	(revision 7)
+++ trunk/wb/admin/modules/install.php	(revision 8)
@@ -98,7 +98,7 @@
 $dir = dir($module_dir);
 while (false !== $entry = $dir->read()) {
 	// Skip pointers
-	if(substr($entry, 0, 1) != '.' AND $entry != 'CVS' AND !is_dir($module_dir.'/'.$entry)) {
+	if(substr($entry, 0, 1) != '.' AND $entry != '.svn' AND !is_dir($module_dir.'/'.$entry)) {
 		// Chmod file
 		change_mode($module_dir.'/'.$entry, 'file');
 	}
@@ -115,4 +115,4 @@
 // Print admin footer
 $admin->print_footer();
 
-?>
\ No newline at end of file
+?>
Index: trunk/wb/admin/modules/index.php
===================================================================
--- trunk/wb/admin/modules/index.php	(revision 7)
+++ trunk/wb/admin/modules/index.php	(revision 8)
@@ -1,84 +1,84 @@
-<?php
-
-// $Id: index.php,v 1.2 2005/04/02 06:25:37 rdjurovich Exp $
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, Ryan Djurovich
-
- Website Baker is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Website Baker is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Print admin header
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-$admin = new admin('Addons', 'modules');
-
-// Setup template object
-$template = new Template(ADMIN_PATH.'/modules');
-$template->set_file('page', 'template.html');
-$template->set_block('page', 'main_block', 'main');
-
-// Insert values into module list
-$template->set_block('main_block', 'module_list_block', 'module_list');
+<?php
+
+// $Id: index.php,v 1.2 2005/04/02 06:25:37 rdjurovich Exp $
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2005, Ryan Djurovich
+
+ Website Baker is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Website Baker is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Print admin header
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+$admin = new admin('Addons', 'modules');
+
+// Setup template object
+$template = new Template(ADMIN_PATH.'/modules');
+$template->set_file('page', 'template.html');
+$template->set_block('page', 'main_block', 'main');
+
+// Insert values into module list
+$template->set_block('main_block', 'module_list_block', 'module_list');
 if($handle = opendir(WB_PATH.'/modules/')) {
 	while (false !== ($file = readdir($handle))) {
-		if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
-			// Include the modules info file
-			require(WB_PATH.'/modules/'.$file.'/info.php');
-			$template->set_var('VALUE', $file);
-			$template->set_var('NAME', $module_name);
-			$template->parse('module_list', 'module_list_block', true);
-		}
-	}
-}
-
-// Insert permissions values
-if($admin->get_permission('modules_install') != true) {
-	$template->set_var('DISPLAY_INSTALL', 'hide');
-}
-if($admin->get_permission('modules_uninstall') != true) {
-	$template->set_var('DISPLAY_UNINSTALL', 'hide');
-}
-if($admin->get_permission('modules_view') != true) {
-	$template->set_var('DISPLAY_LIST', 'hide');
-}
-
-// Insert language headings
-$template->set_var(array(
-								'HEADING_INSTALL_MODULE' => $HEADING['INSTALL_MODULE'],
-								'HEADING_UNINSTALL_MODULE' => $HEADING['UNINSTALL_MODULE'],
-								'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS']
-								)
-						);
-// Insert language text and messages
-$template->set_var(array(
-								'TEXT_INSTALL' => $TEXT['INSTALL'],
-								'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
-								'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
-								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT']
-								)
-						);
-
-// Parse template object
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
-// Print admin footer
-$admin->print_footer();
-
-?>
\ No newline at end of file
+		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
+			// Include the modules info file
+			require(WB_PATH.'/modules/'.$file.'/info.php');
+			$template->set_var('VALUE', $file);
+			$template->set_var('NAME', $module_name);
+			$template->parse('module_list', 'module_list_block', true);
+		}
+	}
+}
+
+// Insert permissions values
+if($admin->get_permission('modules_install') != true) {
+	$template->set_var('DISPLAY_INSTALL', 'hide');
+}
+if($admin->get_permission('modules_uninstall') != true) {
+	$template->set_var('DISPLAY_UNINSTALL', 'hide');
+}
+if($admin->get_permission('modules_view') != true) {
+	$template->set_var('DISPLAY_LIST', 'hide');
+}
+
+// Insert language headings
+$template->set_var(array(
+								'HEADING_INSTALL_MODULE' => $HEADING['INSTALL_MODULE'],
+								'HEADING_UNINSTALL_MODULE' => $HEADING['UNINSTALL_MODULE'],
+								'HEADING_MODULE_DETAILS' => $HEADING['MODULE_DETAILS']
+								)
+						);
+// Insert language text and messages
+$template->set_var(array(
+								'TEXT_INSTALL' => $TEXT['INSTALL'],
+								'TEXT_UNINSTALL' => $TEXT['UNINSTALL'],
+								'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'],
+								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT']
+								)
+						);
+
+// Parse template object
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
+// Print admin footer
+$admin->print_footer();
+
+?>
Index: trunk/wb/framework/functions.php
===================================================================
--- trunk/wb/framework/functions.php	(revision 7)
+++ trunk/wb/framework/functions.php	(revision 8)
@@ -74,7 +74,7 @@
 	$dir = dir($directory);
 	while (false !== $entry = $dir->read()) {
 		// Skip pointers
-		if(substr($entry, 0, 1) == '.' || $entry == 'CVS') {
+		if(substr($entry, 0, 1) == '.' || $entry == '.svn') {
 			continue;
 		}
 		// Add dir and contents to list
@@ -98,7 +98,7 @@
 	$dir = dir($directory);
 	while (false !== $entry = $dir->read()) {
 		// Skip pointers
-		if(substr($entry, 0, 1) == '.' || $entry == 'CVS') {
+		if(substr($entry, 0, 1) == '.' || $entry == '.svn') {
 			continue;
 		}
 		// Chmod the sub-dirs contents
@@ -163,7 +163,7 @@
 			if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.$directory)) {
 				// Loop through the dirs to check the home folders sub-dirs are not shown
 			   while(false !== ($file = readdir($handle))) {
-					if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
+					if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
 						if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
 							if($directory != '/') { $file = $directory.'/'.$file; } else { $file = '/'.$file; }
 							foreach($home_folders AS $hf) {
