blob: 8535a6f4f6ae73ea3ee2d6e117dc8bde147dc314 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?php
/**
* Phar stub file for bdrem. Handles startup of the .phar file.
*
* PHP version 5
*
* @category Tools
* @package Bdrem
* @author Christian Weiske <cweiske@cweiske.de>
* @copyright 2014 Christian Weiske
* @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
* @link http://cweiske.de/bdrem.htm
*/
if (!in_array('phar', stream_get_wrappers()) || !class_exists('Phar', false)) {
echo "Phar extension not avaiable\n";
exit(255);
}
$web = 'www/index.php';
$cli = 'bin/phar-bdrem.php';
/**
* Rewrite the HTTP request path to an internal file.
* Maps "" and "/" to "www/index.php".
*
* @param string $path Path from the browser, relative to the .phar
*
* @return string Internal path.
*/
function rewritePath($path)
{
if ($path == '' || $path == '/') {
return 'www/index.php';
}
return $path;
}
//Phar::interceptFileFuncs();
set_include_path(
'phar://' . __FILE__
. PATH_SEPARATOR . 'phar://' . __FILE__ . '/lib/'
);
Phar::webPhar(null, $web, null, array(), 'rewritePath');
//work around https://bugs.php.net/bug.php?id=52322
if (php_sapi_name() == 'cgi-fcgi') {
require 'phar://' . __FILE__ . '/' . $web;
exit();
}
require 'phar://' . __FILE__ . '/' . $cli;
__HALT_COMPILER();
?>
|