0) { $ns_tmp = implode(':',$elems); $test = $ns_tmp . ':*'; $AUTH = auth_aclcheck($test,$dwfck_client,$usergrps); if($AUTH < 4) { if(!$ns) { $ns = $ns_tmp; break; } $AUTH = $prev_auth; break; } $prev_auth = $AUTH; $ns = $ns_tmp; array_pop($elems); } if($ns) { if(strpos($ns, ':')) { return str_replace(':', '/', $ns); } $AUTH = auth_aclcheck(':*', $dwfck_client,$usergrps); if($AUTH >= 8) return ""; return $ns; } $AUTH = auth_aclcheck(':*', $dwfck_client,$usergrps); return ""; } function setUpMediaPaths() { global $Config; global $isWindows; global $useWinStyle; global $AUTH; global $dwfck_client; global $useNixStyle; if($useNixStyle) { $useWinStyle=false; $isWindows = false; } $ALLOWED_MIMES = DOKU_INC . 'conf/mime.conf'; if(!file_exists($ALLOWED_MIMES)) { $ALLOWED_MIMES = DOKU_CONF . '/mime.conf'; $MIMES_LOCAL = DOKU_CONF . '/mime.local.conf'; } $out=@file($ALLOWED_MIMES,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if(file_exists(DOKU_INC . 'conf/mime.local.conf')) { $out_local = @file(DOKU_INC . 'conf/mime.local.conf',FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $out = array_merge($out,$out_local); } elseif(isset($MIMES_LOCAL) && file_exists($MIMES_LOCAL)) { $out_local = @file($MIMES_LOCAL,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $out = array_merge($out,$out_local); } $extensions = array(); $image_extensions = array(); foreach($out as $line) { if(strpos($line,'#') === false) { list($ext,$mtype) = preg_split('/\s+/', $line); $extensions[] = $ext; if(strpos($mtype,'image')!==false) { $image_extensions[] = $ext; } } } // if !$dwfck_client then the file browser is not restricted to the client's permissions if(!$dwfck_client) { $unrestricted_browser = true; } else $unrestricted_browser = false; if(isset($_REQUEST['DWFCK_usergrps'])) { $usergrps = get_conf_array($_REQUEST['DWFCK_usergrps']); } else $usergrps = array(); $Config['AllowedExtensions']['File'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'docx','fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'png', 'ppt', 'psd', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip') ; if(count($extensions) ) { $Config['AllowedExtensions']['File'] = array_merge($Config['AllowedExtensions']['File'],$extensions); } $Config['DeniedExtensions']['File'] = array() ; $Config['AllowedExtensions']['Image'] = array_merge(array('bmp','gif','jpeg','jpg','png'),$image_extensions) ; $Config['DeniedExtensions']['Image'] = array() ; $Config['AllowedExtensions']['Flash'] = array('swf','flv') ; $Config['DeniedExtensions']['Flash'] = array() ; $Config['AllowedExtensions']['Media'] = array_merge(array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv') ,$image_extensions); $Config['DeniedExtensions']['Media'] = array() ; $DWFCK_MediaTypes = array('File','Image', 'Flash','Media'); $DWFCK_use_acl = true; if($unrestricted_browser) $DWFCK_use_acl = false; $current__Folder = ""; if($DWFCK_use_acl && isset($_COOKIE['FCK_NmSp'])) { if(strpos($_COOKIE['FCK_NmSp'], ':')) { $current__Folder=get_start_dir(); } } $sess_id = session_id(); if(!isset($sess_id) || $sess_id != $_COOKIE['FCK_NmSp_acl']) { session_id($_COOKIE['FCK_NmSp_acl']); session_start(); } //file_put_contents('session.txt',print_r($_SESSION,true)); if($_SESSION['dwfck_openfb'] == 'y') { $current__Folder = ""; } $topLevelFolder=$current__Folder ? $current__Folder : '/'; if($current__Folder) $current__Folder .= '/'; if($unrestricted_browser) $AUTH = 255; setcookie("TopLevel", "$topLevelFolder;;$AUTH", time()+3600, '/'); foreach($DWFCK_MediaTypes as $type) { $abs_type_dir = strtolower($type) . '/'; if($isWindows || $useWinStyle) { $abs_type_dir = ""; } else { $abs_type_dir = strtolower($type) . '/'; } $Config['FileTypesPath'][$type] = $Config['UserFilesPath'] . $abs_type_dir; // $dir_type; $Config['FileTypesAbsolutePath'][$type] = $Config['UserFilesAbsolutePath'] . $abs_type_dir; // $abs_type_dir ; $Config['QuickUploadPath'][$type] = $Config['UserFilesPath'] . $abs_type_dir; // $dir_type ; $Config['QuickUploadAbsolutePath'][$type]= $Config['UserFilesAbsolutePath'] . $abs_type_dir; $Config['FileTypesPath'][$type] = $Config['UserFilesPath'] . $abs_type_dir; //$dir_type; $Config['FileTypesAbsolutePath'][$type] = $Config['UserFilesAbsolutePath'] . $abs_type_dir ; } } function getBaseURL_fck(){ if(substr($_SERVER['SCRIPT_NAME'],-4) == '.php'){ $dir = dirname($_SERVER['SCRIPT_NAME']); }elseif(substr($_SERVER['PHP_SELF'],-4) == '.php'){ $dir = dirname($_SERVER['PHP_SELF']); }elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){ $dir = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','', $_SERVER['SCRIPT_FILENAME']); $dir = dirname('/'.$dir); }else{ $dir = '.'; //probably wrong } $dir = str_replace('\\','/',$dir); // bugfix for weird WIN behaviour $dir = preg_replace('#//+#','/',"/$dir/"); // ensure leading and trailing slashes //handle script in lib/exe dir $dir = preg_replace('!lib/exe/$!','',$dir); //handle script in lib/plugins dir $dir = preg_replace('!lib/plugins/.*$!','',$dir); //finish here for relative URLs return $dir; } function DWFCK_isWinOS() { global $Config; if(isset($_SERVER['WINDIR']) && $_SERVER['WINDIR']) { return true; } elseif(stristr(PHP_OS, 'WIN') && !DWFCK_is_OS('DARWIN')) { return true; } return false; } function DWFCK_is_OS($os) { $os = strtolower($os); $_OS = strtolower(PHP_OS); if($os == $_OS || stristr(PHP_OS, $os) || stristr($os,PHP_OS) ) { return true; } return false; } function doku_config_values() { $dwphp = DOKU_INC . 'conf/dokuwiki.php'; if(!file_exists($dwphp)) { $dwphp = DOKU_CONF . 'dokuwiki.php'; $localphp = DOKU_CONF . 'local.php'; } else $localphp = DOKU_INC . 'conf/local.php'; if(file_exists($dwphp)) { include($dwphp); if(file_exists($localphp)) { include($localphp); } if(trim($conf['savedir'],'/.\/') != 'data') { $conf['ckg_savedir']= $conf['savedir']; } return $conf; } return false; } function DWFCK_cfg_dbg($fname) { global $Config; global $Dwfck_conf_values; $request = print_r($_REQUEST,true); $request .= "\n" . print_r($Dwfck_conf_values,true); file_put_contents($fname, $Config['UserFilesAbsolutePath'] . "\r\n" . $Config['UserFilesPath'] . "\r\n" .$request ."\r\n"); } function config_write_debug($what) { return; if(is_array($what)) { $what = print_r($what,true); } $dwfckFHandle = fopen("fbrowser_dbg.txt", "a"); fwrite($dwfckFHandle, "$what\n"); fclose($dwfckFHandle); } ?>