Revision 546
Added by doc almost 18 years ago
| functions.php | ||
|---|---|---|
| 5 | 5 |
/* |
| 6 | 6 |
|
| 7 | 7 |
Website Baker Project <http://www.websitebaker.org/> |
| 8 |
Copyright (C) 2004-2008, Ryan Djurovich
|
|
| 8 |
Copyright (C) 2004-2007, Ryan Djurovich
|
|
| 9 | 9 |
|
| 10 | 10 |
Website Baker is free software; you can redistribute it and/or modify |
| 11 | 11 |
it under the terms of the GNU General Public License as published by |
| ... | ... | |
| 156 | 156 |
$home_folders = array(); |
| 157 | 157 |
// Only return home folders is this feature is enabled |
| 158 | 158 |
// and user is not admin |
| 159 |
if(HOME_FOLDERS AND ($_SESSION['GROUP_ID']!='1')) {
|
|
| 159 |
// if(HOME_FOLDERS AND ($_SESSION['GROUP_ID']!='1')) {
|
|
| 160 |
if(HOME_FOLDERS AND (!in_array('1',split(",",$_SESSION['GROUPS_ID'])))) {
|
|
| 161 |
|
|
| 160 | 162 |
$query_home_folders = $database->query("SELECT home_folder FROM ".TABLE_PREFIX."users WHERE home_folder != '".$admin->get_home_folder()."'");
|
| 161 | 163 |
if($query_home_folders->numRows() > 0) {
|
| 162 | 164 |
while($folder = $query_home_folders->fetchRow()) {
|
| ... | ... | |
| 879 | 881 |
function page_filename($string) {
|
| 880 | 882 |
$string = entities_to_7bit(umlauts_to_entities($string)); |
| 881 | 883 |
// Now replace spaces with page spcacer |
| 882 |
$string = trim($string); |
|
| 883 |
$string = preg_replace('/(\s)+/', PAGE_SPACER, $string);
|
|
| 884 |
$string = str_replace(' ', PAGE_SPACER, $string);
|
|
| 884 | 885 |
// Now remove all bad characters |
| 885 | 886 |
$bad = array( |
| 886 | 887 |
'\'', /* / */ '"', /* " */ '<', /* < */ '>', /* > */ |
| ... | ... | |
| 893 | 894 |
$string = str_replace($bad, '', $string); |
| 894 | 895 |
// Now convert to lower-case |
| 895 | 896 |
$string = strtolower($string); |
| 897 |
// Now remove multiple page spacers |
|
| 898 |
$string = str_replace(PAGE_SPACER.PAGE_SPACER, PAGE_SPACER, $string); |
|
| 899 |
// Clean any page spacers at the end of string |
|
| 900 |
$string = str_replace(PAGE_SPACER, ' ', $string); |
|
| 901 |
$string = trim($string); |
|
| 902 |
$string = str_replace(' ', PAGE_SPACER, $string);
|
|
| 896 | 903 |
// If there are any weird language characters, this will protect us against possible problems they could cause |
| 897 | 904 |
$string = str_replace(array('%2F', '%'), array('/', ''), urlencode($string));
|
| 898 | 905 |
// Finally, return the cleaned string |
| ... | ... | |
| 1193 | 1200 |
|
| 1194 | 1201 |
// Unlink the page access file and directory |
| 1195 | 1202 |
$directory = WB_PATH.PAGES_DIRECTORY.$link; |
| 1196 |
$filename = $directory.PAGE_EXTENSION;
|
|
| 1203 |
$filename = $directory.'.php';
|
|
| 1197 | 1204 |
$directory .= '/'; |
| 1198 |
if(file_exists($filename)) {
|
|
| 1205 |
if(file_exists($filename) && substr($filename,0,1<>'.')) {
|
|
| 1199 | 1206 |
if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/')) {
|
| 1200 | 1207 |
$admin->print_error($MESSAGE['PAGES']['CANNOT_DELETE_ACCESS_FILE']); |
| 1201 | 1208 |
} else {
|
| 1202 | 1209 |
unlink($filename); |
| 1203 |
if(file_exists($directory) && rtrim($directory,'/')!=WB_PATH.PAGES_DIRECTORY) {
|
|
| 1210 |
if(file_exists($directory)) {
|
|
| 1204 | 1211 |
rm_full_dir($directory); |
| 1205 | 1212 |
} |
| 1206 | 1213 |
} |
Also available in: Unified diff
added the "users in multiple groups" feature (closes parts of ticket #546)