Menu

[r36]: / trunk / phpython.lib.php  Maximize  Restore  History

Download this file

35 lines (29 with data), 921 Bytes

 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
<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/python/python.lib.php");
function phpython_index() {
$url = parse_url($_SERVER["REQUEST_URI"]);
$url["script"] = $url["path"];
$url["script"] = dirname(__FILE__)."/www/".substr($url["script"],strlen(__PHPYTHON_BASE_PATH__));
$url["script"] = substr($url["script"],-1)=="/" ? $url["script"]."index.py" : $url["script"];
$url["script"] = is_dir($url["script"]) ? $url["script"]."/index.py" : $url["script"];
if (file_exists($url["script"])) {
python_exec($url["script"]);
} else {
header('HTTP/1.0 404 Not Found');
echo "<h1>404 Not Found</h1>";
echo "The page that you have requested could not be found.";
echo "<hr/>";
echo $url["script"];
exit ();
}
}
function phpython_build() {
python_build();
}
function phpython_start() {
python_start();
}
function phpython_run($file) {
python_exec($file);
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.