Пример #1
0
 function getWebRoot()
 {
     static $web_root = null;
     if (is_null($web_root)) {
         //		assert('$_SERVER["SCRIPT_NAME"]');
         //		$web_root = dirname($_SERVER['SCRIPT_NAME']);
         $web_root = realpath(dirname(__FILE__));
         $web_root = str_replace("\\", '/', $web_root);
         if (strpos($web_root, fbWeb::getDocRoot()) === 0) {
             $web_root = substr($web_root, strlen(fbWeb::getDocRoot()));
         }
     }
     return $web_root;
 }
Пример #2
0
<?php

// $CVSHeader: _freebeer/www/lib/tests/_header.php,v 1.3 2004/03/08 04:29:18 ross Exp $
// Copyright (c) 2002-2004, Ross Smith.  All rights reserved.
// Licensed under the BSD or LGPL License. See license.txt for details.
defined('FREEBEER_BASE') || define('FREEBEER_BASE', getenv('FREEBEER_BASE') ? getenv('FREEBEER_BASE') : dirname(dirname(dirname(dirname(__FILE__)))));
require_once FREEBEER_BASE . '/lib/HTTP.php';
require_once FREEBEER_BASE . '/www/fbWeb.php';
$www_root = fbWeb::getWebRoot();
$doc_root = fbWeb::getDocRoot();
//$root_dir = $doc_root . $www_root;
if (isset($test_name)) {
    $test_name = $www_root . $test_name;
}
fbHTTP::sendNoCacheHeaders();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<!--
$CVSHeader: _freebeer/www/lib/tests/_header.php,v 1.3 2004/03/08 04:29:18 ross Exp $

Copyright (c) 2001-2003, Ross Smith.  All rights reserved.
Licensed under the BSD or LGPL License. See doc/license.txt for details.
-->
  <head>
    <title><?php 
echo $test_name;
?>
Test Suite</title>
Пример #3
0
<?php

// $CVSHeader: _freebeer/www/lib/tests/index.php,v 1.3 2004/03/08 04:29:18 ross Exp $
// Copyright (c) 2002-2004, Ross Smith.  All rights reserved.
// Licensed under the BSD or LGPL License. See license.txt for details.
error_reporting(2047);
defined('FREEBEER_BASE') || define('FREEBEER_BASE', getenv('FREEBEER_BASE') ? getenv('FREEBEER_BASE') : dirname(dirname(dirname(dirname(__FILE__)))));
// no longer required, right?
// require_once FREEBEER_BASE . '/lib/Pear/Pear.php';
require_once FREEBEER_BASE . '/lib/File.php';
// scandir()
require_once FREEBEER_BASE . '/www/fbWeb.php';
$www_root = fbWeb::getWebRoot();
$rootdir = $www_root . '/lib/tests/';
$files = fbFile::scandir('.', null, true);
$files2 = array();
$files3 = array();
foreach ($files as $file) {
    $file = substr($file, 2);
    /// \todo change to DIRECTORY_SEPARATOR, or remove
    $file = strtr($file, "\\", '/');
    if (!preg_match('/\\.(php|htm|html)$/i', $file)) {
        continue;
    }
    if (preg_match('/^index\\.php$/i', $file)) {
        continue;
    }
    if (preg_match('/^_.*\\.php$/i', $file)) {
        continue;
    }
    $path = $rootdir . $file;
Пример #4
0
function html_header($hash, $included_files = null, $path = null, $no_cache = true)
{
    $www_root = fbWeb::getWebRoot();
    if (preg_match('/wget/i', $_SERVER['HTTP_USER_AGENT'])) {
        @ini_set('html_errors', false);
    }
    @ini_set('html_errors', false);
    include_once FREEBEER_BASE . '/lib/HTTP.php';
    // required for Opera 7.x
    fbHTTP::sendNoCacheHeaders();
    @ini_set('implicit_flush', true);
    @ini_set('max_execution_time', 60);
    $path2 = '';
    /*
    	if ($path == null) {
    		$path = '';
    	}
    	if (!strpos($path, '://')) {
    		$path2 = $path;
    		$home_url = $path . '..';
    		$demo_url = $path;
    	} else {
    		$path2 = '';
    		$home_url = $path;
    		$demo_url = $path;
    	}
    */
    $page_title = '';
    $header = '';
    foreach ($hash as $label => $url) {
        if ($page_title) {
            $page_title .= ' &gt; ';
            $header .= ' &gt; ';
        }
        $page_title .= $label;
        $header .= $url ? sprintf("<a href='%s'>%s</a>", $url, $label) : $label;
    }
    $files = get_included_files();
    #	$files[] = $_SERVER['SCRIPT_NAME'];
    if (!is_array($included_files)) {
        $included_files = array($included_files);
    }
    static $skip_files = array('HTTP.php', 'System.php', 'fbWeb.php', '_demo.php', '_header.php');
    $script_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $hfiles = '';
    foreach ($files as $file) {
        $bfile = basename($file);
        if (in_array($bfile, $skip_files)) {
            continue;
        }
        if (substr($file, 0, 1) != '/') {
            $file = $script_dir . '/' . $file;
        }
        $rfile = realpath($file);
        if (!$rfile) {
            $bfile = "<blink><i>{$bfile}</i></blink>";
        }
        $encfile = urlencode($rfile);
        $hfiles .= sprintf("\n&nbsp;\n<a target='%s' href='%s/_source.php?file=%s'>%s</a>", $file, fbWeb::getWebRoot(), $encfile, $bfile);
    }
    foreach ($included_files as $file) {
        $bfile = basename($file);
        if (substr($file, 0, 1) != '/') {
            $file = $script_dir . '/' . $file;
        }
        $rfile = realpath($file);
        if (!$rfile) {
            $bfile = "<blink><i>{$bfile}</i></blink>";
        }
        $encfile = urlencode($rfile);
        $hfiles .= sprintf("\n&nbsp;\n<a target='%s' href='%s/%s_source.php?file=%s'>%s</a>", $file, fbWeb::getWebRoot(), $path2, $encfile, $bfile);
    }
    if (preg_match('/wget/i', $_SERVER['HTTP_USER_AGENT'])) {
        $header = '';
        $hfiles = '';
    }
    $html = <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2001-2003, Ross Smith.  All rights reserved.
Licensed under the BSD or LGPL License. See doc/license.txt for details.
-->
<html lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>{$page_title}</title>
<!-- meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' / -->
<meta name="MSSmartTagsPreventParsing" content="TRUE" /><!-- ! -->
<!--
    <meta name="robots" content="noindex, nofollow" />
    <meta name="googlebot" content="noarchive" />
    <link rel='stylesheet' href='example.css' type='text/css' />
    <style type='text/css'>
    @import 'example.css';
    </style>
    <link rel='icon' href='favicon.png' type='image/png' />
    -->
<script language='JavaScript' type='text/javascript'>
    <!-- // <![CDATA[
        // JavaScript code goes here
    // ]]> -->

</script>
<link rel='stylesheet' href='{$www_root}/main.css' type='text/css' />
</head>
<body>
<table width='100%' border='0'>
 <tr>
  <td align='left'>
  \t{$header}
  </td>
  <td align='right'>
   {$hfiles}
  </td>
 </tr>
</table>
<hr />
EOD;
    return $html;
}
Пример #5
0
<?php

// $CVSHeader: _freebeer/www/_source.php,v 1.2 2004/03/07 17:51:33 ross Exp $
// Copyright (c) 2002-2004, Ross Smith.  All rights reserved.
// Licensed under the BSD or LGPL License. See license.txt for details.
error_reporting(2047);
defined('FREEBEER_BASE') || define('FREEBEER_BASE', getenv('FREEBEER_BASE') ? getenv('FREEBEER_BASE') : dirname(dirname(__FILE__)));
require_once FREEBEER_BASE . '/lib/HTTP.php';
require_once './_header.php';
// required for Opera 7.x
fbHTTP::sendNoCacheHeaders();
$file = isset($_REQUEST['file']) ? $_REQUEST['file'] : false;
if (strpos($file, fbWeb::getDocRoot()) !== 0) {
    exit;
}
if (!preg_match('/\\.(php|js)$/i', $file)) {
    exit;
}
highlight_file($file);