public function insert() { $id = parent::insert(); $fpath = apache_lookup_uri($_SERVER['JASONWANG826_CONFIG']['CKEDITOR_USERFILE_ALIAS'] . "/")->filename . 'member/' . $id; if (!is_dir($fpath) && !file_exists($fpath)) { mkdir($fpath); } return $id; }
function Server_MapPath($path) { // This function is available only for Apache if (function_exists('apache_lookup_uri')) { $info = apache_lookup_uri($path); return $info->filename . $info->path_info; } // This isn't correct but for the moment there's no other solution // If this script is under a virtual directory or symlink it will detect the problem and stop return GetRootPath() . $path; }
public static function static_file($file = null) { $file = $file == null ? self::$static_file : $file; $basename = basename($file); $info = apache_lookup_uri($basename); // see if exists, else use imagesize if file exists. if (isset($info->content_type)) { header("Content-type: " . $info->content_type); header("Pragma: no-cache"); header("Expires: 0"); readfile($file); } exit; }
function check_accept_path_info() { if (function_exists('apache_lookup_uri')) { $extrapath = "/test_path_info/"; $object = apache_lookup_uri($_SERVER['REQUEST_URI'] . $extrapath); if ($object->path_info == $extrapath) { return true; } return false; } else { $ariadne = ''; @(include "../ariadne.inc"); if ($ariadne != '') { require_once $ariadne . '/ar.php'; // checking if path_info could be available $testuri = new ar_url('http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); $testuri->query = ''; $testuri->path = str_replace('/index.php', '/', $testuri->path) . "serverinfo.php"; $testuri = (string) $testuri; $result1 = json_decode(ar_http::get($testuri), true); $result2 = json_decode(ar_http::get($testuri . '/my/path/info'), true); if (is_array($result1) && is_array($result2)) { // self request works // pathinfo could work if ($result2['server']['PATH_INFO'] == '/my/path/info') { return true; } else { return false; } } elseif (is_array($result1) && is_null($result2)) { // self request works // request with pathinfo fails return false; } else { // self request fails // should return 'check via browser' return false; } } } return false; }
function find_local_path() { if (function_exists('apache_lookup_uri')) { $localInfo = apache_lookup_uri('/custom/'); $localPath = preg_replace("/(.*)\\/custom.*\$/", "\$1", $localInfo->filename); } elseif (isset($_SERVER['AMP_LOCAL_PATH'])) { $localPath = $_SERVER['AMP_LOCAL_PATH']; } $customPath = isset($localPath) ? $localPath . DIRECTORY_SEPARATOR . 'custom' : ''; $searchPath = '.'; $depth = 0; while (!is_dir($customPath) && $depth++ < 4) { $customPath = $searchPath . DIRECTORY_SEPARATOR . 'custom'; $localPath = realpath($searchPath); $searchPath = '..' . DIRECTORY_SEPARATOR . $searchPath; } if ($depth >= 4) { return null; } if (DIRECTORY_SEPARATOR != '/') { $localPath = str_replace('/', DIRECTORY_SEPARATOR, $localPath); } return $localPath; }
$page = 0; } $list = preg_replace("/[^a-zA-Z0-9_\\-]/", "", $list); $page = intval($page); if (file_exists($list . ".cycle")) { $alist = file($list . ".cycle"); if ($page >= count($alist)) { $page = 0; } $nextpage = $page + 1; if ($nextpage >= count($alist)) { $nextpage = 0; } header("Refresh: " . $delay . "; URL=" . $_SERVER['SCRIPT_NAME'] . "?delay=" . urlencode($delay) . "&list=" . urlencode($list) . "&page=" . urlencode($nextpage)); if ($page < count($alist)) { $info = apache_lookup_uri(trim($alist[$page])); if (isset($info->filename) && file_exists($info->filename)) { header("Content-Type: " . $info->content_type); readfile($info->filename); exit; } } } header("HTTP/1.0 404 Not Found"); ?> <HTML> <HEAD><TITLE>404 Not Found</TITLE></HEAD> <BODY>404 Not Found (<?php print trim($alist[$page]); ?> )</BODY>
function WikiConfig($conf) { $frontpage = 'FrontPage'; $sitename = 'UnnamedWiki'; $upload_dir = 'pds'; $data_dir = './data'; $query_prefix = '/'; $umask = 0770; $charset = 'utf-8'; $lang = 'auto'; $dba_type = "db3"; $text_dir = $data_dir . '/text'; $cache_dir = $data_dir . '/cache'; $user_dir = $data_dir . '/user'; $vartmp_dir = '/var/tmp'; $intermap = $data_dir . '/intermap.txt'; $interwikirule = ''; $editlog_name = $data_dir . '/editlog'; $shared_intermap = $data_dir . "/text/InterMap"; $shared_metadb = $data_dir . "/metadb"; $url_prefix = '/moniwiki'; $imgs_dir = $url_prefix . '/imgs'; $css_dir = 'css'; $css_url = $url_prefix . '/css/default.css'; $kbd_script = $url_prefix . '/css/kbd.js'; $logo_img = $imgs_dir . '/moniwiki-logo.png'; $logo_page = $frontpage; $logo_string = '<img src="' . $logo_img . '" alt="[logo]" class="wikiLogo" />'; $metatags = '<meta name="robots" content="noindex,nofollow" />'; $doctype = <<<EOS <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> EOS; $hr = "<hr class='wikiHr' />"; $date_fmt = 'Y-m-d'; $date_fmt_rc = 'D d M Y'; $date_fmt_blog = 'M d, Y'; $datetime_fmt = 'Y-m-d H:i:s'; $default_markup = 'wiki'; //$changed_time_fmt = ' . . . . [h:i a]'; $changed_time_fmt = ' [h:i a]'; # used by RecentChanges macro $admin_passwd = 'daEPulu0FLGhk'; # default value moniwiki $purge_passwd = ''; $rcs_user = '******'; $actions = array('DeletePage', 'LikePages'); $show_hosts = TRUE; $iconset = 'moni'; $css_friendly = '0'; $goto_type = ''; $goto_form = ''; $template_regex = '[a-z]Template$'; $category_regex = '^Category[A-Z]'; $notify = 0; $trail = 0; $origin = 0; $arrow = " › "; $home = 'Home'; $diff_type = 'fancy'; $hr_type = 'simple'; $nonexists = 'simple'; $use_smileys = 1; $smiley = 'wikismiley'; $use_counter = 0; $use_category = 1; $use_camelcase = 1; $use_sistersites = 1; $use_singlebracket = 1; $use_twinpages = 1; $use_hostname = 1; $use_group = 1; $email_guard = 'hex'; $pagetype = array(); $convmap = array(0xac00, 0xd7a3, 0x0, 0xffff); /* for euc-kr */ $theme = ''; $inline_latex = 0; $processors = array(); $perma_icon = '#'; $purple_icon = '#'; $use_purple = 0; $version_class = 'RCS'; $titleindexer_class = 'text'; $title_rule = '((?<=[a-z0-9]|[B-Z]{2})([A-Z][a-z]))'; $login_strict = 1; $use_fakemtime = 0; // dir mtime emulation for FAT filesytem. $purge_passwd = $admin_passwd; $default = get_defined_vars(); unset($default['conf']); $config = new StdClass(); if (is_array($conf)) { // override config with user-specified configurations $conf = array_merge($default, $conf); // read configurations foreach ($conf as $k => $v) { if ($k[0] == '_') { continue; } // ignore internal variables $config->{$k} = $v; } } else { foreach ($default as $k => $v) { $config->{$k} = $v; } } // // set default config variables // if (!empty($config->use_wikiwyg) and empty($config->sectionedit_attr)) { $config->sectionedit_attr = 1; } if (empty($config->menu)) { $config->menu = array($config->frontpage => "accesskey='1'", 'FindPage' => "accesskey='4'", 'TitleIndex' => "accesskey='3'", 'RecentChanges' => "accesskey='2'"); $config->menu_bra = ''; $config->menu_cat = '|'; $config->menu_sep = '|'; } // for backward compatibility empty($config->imgs_dir_url) ? $config->imgs_dir_url = $config->imgs_dir . '/' : null; $config->imgs_url_interwiki = $config->imgs_dir_url; if (empty($config->upload_dir_url)) { $config->upload_dir_url = $config->url_prefix . '/' . $config->upload_dir; } if (empty($config->imgs_real_dir)) { if (function_exists('apache_lookup_uri')) { $info = apache_lookup_uri($config->imgs_dir_url); if (isset($info->filename)) { if (preg_match('@/$@', $info->filename) or is_dir($info->filename)) { $config->imgs_real_dir = $info->filename; } else { $config->imgs_real_dir = dirname($info->filename); } } } else { // fix for nginx etc. $config->imgs_real_dir = substr($config->imgs_dir, strlen($config->url_prefix) + 1); } } if (is_dir($config->imgs_real_dir . '/interwiki/')) { $config->imgs_url_interwiki = $config->imgs_dir_url . '/interwiki/'; } if (empty($config->icon)) { $iconset = $config->iconset; // for backward compatibility $ext = 'png'; if (is_dir($config->imgs_real_dir . '/' . $iconset)) { $iconset .= '/'; } else { $iconset .= '-'; } if (file_exists($config->imgs_real_dir . '/' . $iconset . 'http.png')) { $config->imgs_url = $config->imgs_dir_url . '/' . $iconset; } $imgdir = rtrim($config->imgs_dir_url, '/'); if (!file_exists($config->imgs_real_dir . '/' . $iconset . 'home.png')) { $ext = 'gif'; } $config->icon['upper'] = "<img src='{$imgdir}/{$iconset}upper.{$ext}' alt='U' class='wikiIcon' />"; $config->icon['edit'] = "<img src='{$imgdir}/{$iconset}edit.{$ext}' alt='E' class='wikiIcon' />"; $config->icon['diff'] = "<img src='{$imgdir}/{$iconset}diff.{$ext}' alt='D' class='wikiIcon' />"; $config->icon['del'] = "<img src='{$imgdir}/{$iconset}deleted.{$ext}' alt='(del)' class='wikiIcon' />"; $config->icon['info'] = "<img src='{$imgdir}/{$iconset}info.{$ext}' alt='I' class='wikiIcon' />"; $config->icon['rss'] = "<img src='{$imgdir}/{$iconset}rss.{$ext}' alt='RSS' class='wikiIcon' />"; $config->icon['show'] = "<img src='{$imgdir}/{$iconset}show.{$ext}' alt='R' class='wikiIcon' />"; $config->icon['find'] = "<img src='{$imgdir}/{$iconset}search.{$ext}' alt='S' class='wikiIcon' />"; $config->icon['help'] = "<img src='{$imgdir}/{$iconset}help.{$ext}' alt='H' class='wikiIcon' />"; $config->icon['pref'] = "<img src='{$imgdir}/{$iconset}pref.{$ext}' alt='C' class='wikiIcon' />"; $config->icon['backlinks'] = "<img src='{$imgdir}/{$iconset}backlinks.{$ext}' alt=',' class='wikiIcon' />"; $config->icon['random'] = "<img src='{$imgdir}/{$iconset}random.{$ext}' alt='A' class='wikiIcon' />"; $config->icon['www'] = "<img src='{$imgdir}/{$iconset}www.{$ext}' alt='www' class='wikiIcon' />"; $config->icon['mailto'] = "<img src='{$imgdir}/{$iconset}email.{$ext}' alt='M' class='wikiIcon' />"; $config->icon['create'] = "<img src='{$imgdir}/{$iconset}create.{$ext}' alt='N' class='wikiIcon' />"; $config->icon['new'] = "<img src='{$imgdir}/{$iconset}new.{$ext}' alt='U' class='wikiIcon' />"; $config->icon['updated'] = "<img src='{$imgdir}/{$iconset}updated.{$ext}' alt='U' class='wikiIcon' />"; $config->icon['user'] = "******"; $config->icon['home'] = "<img src='{$imgdir}/{$iconset}home.{$ext}' alt='M' class='wikiIcon' />"; $config->icon['main'] = "<img src='{$imgdir}/{$iconset}main.{$ext}' class='icon' alt='^' class='wikiIcon' />"; $config->icon['print'] = "<img src='{$imgdir}/{$iconset}print.{$ext}' alt='P' class='wikiIcon' />"; $config->icon['scrap'] = "<img src='{$imgdir}/{$iconset}scrap.{$ext}' alt='S' class='wikiIcon' />"; $config->icon['unscrap'] = "<img src='{$imgdir}/{$iconset}unscrap.{$ext}' alt='S' class='wikiIcon' />"; $config->icon['attach'] = "<img src='{$imgdir}/{$iconset}attach.{$ext}' alt='@' class='wikiIcon' />"; $config->icon['locked'] = "<img src='{$imgdir}/{$iconset}locked.{$ext}' alt='E' class='wikiIcon' />"; $config->icon['external'] = "<img class='externalLink' src='{$imgdir}/{$iconset}external.{$ext}' alt='[]' class='wikiIcon' />"; $config->icon_sep = " "; $config->icon_bra = " "; $config->icon_cat = " "; } if (empty($config->icons)) { $config->icons = array('edit' => array("", "?action=edit", $config->icon['edit'], "accesskey='e'"), 'diff' => array("", "?action=diff", $config->icon['diff'], "accesskey='c'"), 'show' => array("", "", $config->icon['show']), 'backlinks' => array("", "?action=backlinks", $config->icon['backlinks']), 'random' => array("", "?action=randompage", $config->icon['random']), 'find' => array("FindPage", "", $config->icon['find']), 'info' => array("", "?action=info", $config->icon['info'])); if (!empty($config->notify)) { $config->icons['subscribe'] = array("", "?action=subscribe", $config->icon['mailto']); } $config->icons['help'] = array("HelpContents", "", $config->icon['help']); $config->icons['pref'] = array("UserPreferences", "", $config->icon['pref']); } // some alias if (!empty($config->use_captcha)) { $config->use_ticket = $config->use_captcha; } return get_object_vars($config); }
// // Codendi // Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved // http://www.codendi.com // // $Id: // // Originally written by Stephane Bouhet 2002, Codendi Team, Xerox // require_once 'pre.php'; $lang = $current_user->getShortLocale(); // Retrieve the user language if not guest // TODO // if section param not given then defaults to index.html if (!isset($section)) { $section = "index.html"; } $help_url = get_server_url() . '/doc/' . $lang . "/user-guide/" . $section; // Check if the file exist - Don't use fopen because it doesn't // understand the https protocol $cl = apache_lookup_uri($help_url); if ($cl->status == 200) { // The file exists. Fine! Redirect to the help page header("location: " . $help_url); } else { // Display error message ... echo help_header($Language->getText('help_show_help', 'page_not_found', $GLOBALS['sys_name'])); echo $Language->getText('help_show_help', 'page_not_available', array($section, $GLOBALS['sys_email_admin'], $GLOBALS['sys_name'])); echo help_footer(); }
static public function URLfpath($url) { return apache_lookup_uri( $url )->filename; }
<? require_once( './local.inc' ); $f=apache_lookup_uri( $_GET['fpath'] )->filename; $filename=basename($f); $fname = iconv('utf-8','big5',$_GET['fname']).".".JWStdio::fileExtension($filename); header( "Content-Type: application/octet-stream" ); header( 'Content-Disposition: attachment; filename="' . $fname . '"' ); header( 'Pragma: no-cache' ); readfile( $f ); ?>
$alias = str_replace('www.', '', $alias); $domains = array('subdomain1.domain' => 'content_one', 'subdomain2.domain' => 'content_two', 'domain' => 'content_three'); if (isset($domains[$alias])) { define('CPATH', $domains[$alias]); $request = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : ''; $folder = CPATH . $request; } else { echo $alias . ' handler'; exit; } $_base = basename($request); $_dir = strrchr($request, '/'); if (strpos($_base, '.') === false && $_dir != '/') { $folder .= '/'; } $info = apache_lookup_uri($folder); if (!$info || strpos($info->filename, 'redirect') !== false || !file_exists($info->filename)) { echo 'path not found <pre>'; print_r($folder); print_r($info); echo '</pre>'; exit; } $path = (object) pathinfo($info->filename); chdir($path->dirname); $unparsed = $info->unparsed_uri; $_unparsed = strrchr($unparsed, '/'); if ($_unparsed != '/') { $unparsed = dirname($unparsed); } $_unparsed = strrchr($unparsed, '/');
function ResolveFilenameToAbsolute($filename) { $IsWindows = (bool) (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'); if ($IsWindows && substr($filename, 1, 1) == ':') { // absolute pathname (Windows) $AbsoluteFilename = $filename; } elseif ($IsWindows && (substr($filename, 0, 2) == '//' || substr($filename, 0, 2) == '\\\\')) { // absolute pathname (Windows) $AbsoluteFilename = $filename; } elseif (substr($filename, 0, 1) == '/') { if (!file_exists($this->config_document_root . $filename) && file_exists($filename)) { // absolute filename (*nix) $AbsoluteFilename = $filename; } elseif (substr($filename, 1, 1) == '~') { // /~user/path $AbsoluteFilename = $this->config_document_root . $filename; if ($apache_lookup_uri_object = apache_lookup_uri($filename)) { $AbsoluteFilename = $apache_lookup_uri_object->filename; } } else { // relative filename (any OS) $AbsoluteFilename = $this->config_document_root . $filename; } } else { // relative to current directory (any OS) $AbsoluteFilename = $this->config_document_root . dirname(@$_SERVER['PHP_SELF']) . '/' . $filename; if (substr(dirname(@$_SERVER['PHP_SELF']), 0, 2) == '/~') { if ($apache_lookup_uri_object = apache_lookup_uri(dirname(@$_SERVER['PHP_SELF']))) { $AbsoluteFilename = $apache_lookup_uri_object->filename . '/' . $filename; } } } return $AbsoluteFilename; }
<?php # @(#) proposal.php ... Show one proposal require_once 'lib/setup.inc'; require_once 'lib/subs.inc'; require_once 'lib/proposal_class.inc'; # Get the newsgroup name $x = apache_lookup_uri($REQUEST_URI); $y = $x->path_info; # $y ... "/newsgroup_name/something" $ng = $proposal; if (file_exists("{$AUSADMIN_HOME}/vote/{$ng}")) { # Read it and weep $rfd = get_rfd($ng); } if ($rfd == false) { # Substitute ... $rfd = "No RFD is available for this group, sorry!<br>\n"; } ?> <html> <head> <title>Newsgroup <?php echo $ng; ?> </title> </head> <body> <table border="1" bgcolor="#ffffe0" cellspacing="0" cellpadding="3" width="98%"> <tr>
/** * @param string * @return string * @access private */ function _truePath($path) { if (php_sapi_name() == 'apache') { $uri = apache_lookup_uri($path); return $uri->filename; } else { return $_SERVER['DOCUMENT_ROOT'] . '/' . $path; } }
function htaccess_php($uri,$htaccess=null) { global $HTACCESS; $htaccess=($htaccess!=null)?$htaccess:((isset($HTACCESS))?$HTACCESS:'.htaccess'); $PHP_CONFIG=array(); $htls= file( dirname(apache_lookup_uri($uri)->filename)."/{$htaccess}" ); foreach( $htls as $l ) { if($l[0]=='#') continue; $_pattern="/^\s*php_value\s+(\S+)\s+(\"[^\"]*\"|\S*)\s*$/i"; $_pattern2="/^\s*php_flag\s+(\S+)\s+(\"[^\"]*\"|\S*)\s*$/i"; $quote_pattern="/^\"([^\"]*)\"$/i"; if ( preg_match($_pattern,$l,$m) ) { if ( preg_match($quote_pattern,$m[2],$m2) ) $PHP_CONFIG[$m[1]]=$m2[1]; else $PHP_CONFIG[$m[1]]=$m[2]; } else if ( preg_match($_pattern2,$l,$m) ) { if ( preg_match($quote_pattern,$m[2],$m2) ) $v=$m2[1]; else $v=$m[2]; if( $v=='on' || $v=='1' || $v=='true' ) $v=1; else if( $v=='off' || $v=='0' || $v=='false' ) $v=0; $PHP_CONFIG[$m[1]]=$v; } } return $PHP_CONFIG; }
function ApacheLookupURIarray($filename) { // apache_lookup_uri() only works when PHP is installed as an Apache module. if (php_sapi_name() == 'apache') { $keys = array('status', 'the_request', 'status_line', 'method', 'content_type', 'handler', 'uri', 'filename', 'path_info', 'args', 'boundary', 'no_cache', 'no_local_copy', 'allowed', 'send_bodyct', 'bytes_sent', 'byterange', 'clength', 'unparsed_uri', 'mtime', 'request_time'); if ($apacheLookupURIobject = @apache_lookup_uri($filename)) { $apacheLookupURIarray = array(); foreach ($keys as $key) { $apacheLookupURIarray[$key] = @$apacheLookupURIobject->{$key}; } return $apacheLookupURIarray; } } return false; }
/** * XDaRk Core webPhar rewriter. * * @param string $uri_or_path_info Passed in by webPhar. * The `$uri` is either `$_SERVER['REQUEST_URI']` or `$_SERVER['PATH_INFO']`. * See: {@link http://docs.php.net/manual/en/phar.webphar.php}. * * @note We ignore `$uri_or_path_info` from webPhar. * We determine this on our own; hopefully more effectively. * * @return string|boolean Boolean An internal URI; else FALSE if denying access. * A FALSE return value causes webPhar to issue a 403 forbidden response. * * @throws exception If this is NOT a PHAR file (which really should NOT happen). * @throws exception If the PHAR extension is not possible for any reason. */ public static function web_phar_rewriter($uri_or_path_info) { // Current PHAR file w/stream prefix. $is_phar = $phar = self::n_dir_seps(self::is_phar()); if (!$is_phar) { // A couple of quick sanity checks. throw new exception(self::__('This is NOT a PHAR file.')); } if (!self::can_phar()) { throw new exception(self::cant_phar_msg()); } // Determine path info. if (!empty($_SERVER['PATH_INFO'])) { $path_info = (string) $_SERVER['PATH_INFO']; } else { if (function_exists('apache_lookup_uri') && !empty($_SERVER['REQUEST_URI'])) { $_apache_lookup = apache_lookup_uri((string) $_SERVER['REQUEST_URI']); if (!empty($_apache_lookup->path_info)) { $path_info = (string) $_apache_lookup->path_info; } unset($_apache_lookup); // Housekeeping. } } $path_info = !empty($path_info) ? $path_info : '/' . basename(__FILE__); // Normalize directory separators; and force a leading slash on all internal URIs. // We allow a trailing slash; so it's easier to parse directory indexes. $internal_uri = self::n_dir_seps($path_info, TRUE); $internal_uri = '/' . ltrim($internal_uri, '/'); // Absolute (e.g. a URI). if (substr($internal_uri, -1) === '/') { // Handle directory indexes. $internal_uri .= 'index.php'; } $internal_uri_basename = basename($internal_uri); $internal_uri_extension = self::extension($internal_uri); // Here we'll try to make webPhar a little more security-conscious. if (strpos($internal_uri, '..') !== FALSE) { return FALSE; } // Do NOT allow relative dots; 403 (forbidden). if (strpos($internal_uri_basename, '.') === 0) { return FALSE; } // Do NOT serve DOT files; 403 (forbidden). if (substr($internal_uri_basename, -1) === '~') { return FALSE; } // Do NOT serve backups; 403 (forbidden). $phar_dir = self::n_dir_seps_up($phar); // We'll need this below. for ($_i = 0, $_dir = self::n_dir_seps_up($phar . $internal_uri); $_i <= 100; $_i++) { if ($_i > 0 && $_dir === $phar_dir) { break; } // Search complete now. if ($_i > 0) { // Up one directory now? $_dir = self::n_dir_seps_up($_dir, 1, TRUE); } if (!$_dir || $_dir === '.' || substr($_dir, -1) === ':') { break; } // Search complete now. $_dir_basename = basename($_dir); if (strpos($_dir_basename, '.') === 0) { return FALSE; } // Dotted; 403 (forbidden). if (substr($_dir_basename, -1) === '~') { return FALSE; } // Backup dir; 403 (forbidden). if (strcasecmp($_dir_basename, 'app_data') === 0) { return FALSE; } // Private; 403 (forbidden). if (is_file($_dir . '/.htaccess')) { if (!is_readable($_dir . '/.htaccess')) { return FALSE; } // Unreadable; 403 (forbidden). if (stripos(file_get_contents($_dir . '/.htaccess'), 'require all denied') !== FALSE) { return FALSE; } // Private; 403 (forbidden). if (stripos(file_get_contents($_dir . '/.htaccess'), 'deny from all') !== FALSE) { return FALSE; } // Private; 403 (forbidden). if (stripos(file_get_contents($_dir . '/.htaccess'), 'require all granted') !== FALSE) { break; } // Break; this directory explicitly allows access. if (stripos(file_get_contents($_dir . '/.htaccess'), 'allow from all') !== FALSE) { break; } // Break; this directory explicitly allows access. } if (substr($_dir, -1) === '/') { // Root directory or scheme? break; } // Search complete (there is nothing more to search after this). } unset($_i, $_dir, $_dir_basename); // Housekeeping. // Process MIME-type headers. $mime_types = self::mime_types(); $cacheable_mime_types = self::cacheable_mime_types(); if ($internal_uri_extension && !empty($mime_types[$internal_uri_extension])) { header('Content-Type: ' . $mime_types[$internal_uri_extension]); } // Handle cacheable MIME-types. if (!empty($cacheable_mime_types[$internal_uri_extension])) { header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('+1 year')) . ' GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: max-age=' . 86400 * 365); header('Pragma: public'); } return $internal_uri; // Final value (internal URI). }
/** * Indirect Check of allow override * * @access public * */ public function checkRewrite() { if (!function_exists('apache_lookup_uri')) { return true; } $url = ILIAS_HTTP_PATH . '/goto_' . CLIENT_ID . '_root_1.html'; $status_info = @apache_lookup_uri($url); // fallback for php as cgi (and available remote fopen) if ($status_info === false && ini_get('allow_url_fopen')) { // fopen respects HTTP error codes $fp = @fopen($url, 'r'); if ($fp) { fclose($fp); return true; } return false; } return $status_info->status == 200; }
echo '<img src="moz-icon://.', $Ext, '?size=16" alt="" width="16" height="16" /> '; } else { echo '<img src="?action=img&ext=.', $Ext, '" alt="" width="16" height="16" /> '; } echo htmlspecialchars($_GET['file']), ' <a target="_blank" href="?action=download&dir=', $SCDIR, '&file=', urlencode($_GET['file']), '"> <img src="?action=img&image=down" width="20" height="20" alt="Download" /> </a> </h3> MIME Type: '; if (class_exists('finfo')) { $finfo = new finfo(FILEINFO_MIME); echo $finfo->file($_REQUEST['file']); } elseif (function_exists('mime_content_type')) { echo mime_content_type($_REQUEST['file']); } elseif (function_exists('apache_lookup_uri')) { $Info = apache_lookup_uri($_REQUEST['file']); echo $Info->content_type; } else { echo 'N/A'; } echo '<br /> File Perms: <a href="?action=file&dir=', $SCDIR, '&file=', urlencode($_GET['file']), '&act=chmod"> <font'; $A = GetPerms($_REQUEST['file']); $B = substr($A, 7); if ($B === '--x' || $B === '---') { echo ' color="red">'; } elseif ($B === 'rwx' || $B === 'rw-') { echo ' color="green">'; } else {