diff options
author | adam.danischewski@gmail.com <adam.danischewski@code.google.com> | 2015-12-26 12:40:32 -0500 |
---|---|---|
committer | adam.danischewski@gmail.com <adam.danischewski@code.google.com> | 2015-12-26 12:40:32 -0500 |
commit | f35abd23e29ffc28b0b82e92ccd1c82d0ab37399 (patch) | |
tree | e639c22f328dc605de526c6671e240207ce5a417 | |
parent | a064cb660e7ec00d5f105b899cbf7572afd15eeb (diff) |
Updated code to use the directory where it lives to find the info2html and infocat scripts. Updated comment header.
-rwxr-xr-x | routing.php | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/routing.php b/routing.php index 521f54f..b8ec8d0 100755 --- a/routing.php +++ b/routing.php @@ -1,9 +1,13 @@ <?php +//--------------------------------------------------------- +// routing.php +//--------------------------------------------------------- // -// Copyrighted by A.M.Danischewski 2015+ (c) -// You may reuse this code without limit, provided this notice remain in tact. +// PURPOSE +// This php script routes calls to the info2html scripts, infocat and +// info2html for the PHP built-in webserver (like a PHP mod_rewrite). // -// Description: routing.php +// DESCRIPTION // How to use: // * Start the php webserver, wherever this file is found, or provide full path: // $> php -S localhost:8000 -t / routing.php @@ -13,14 +17,31 @@ // info2html Perl script. // Also make sure that your info share directory is listed in the // info2html.conf file (mine wasn't I had to add /usr/share/info). +// +// AUTHORS +// 2015.12.25 +A.M.Danischewski <adam_ lastname@not gamil.com> +// +// ORIGINAL AUTHOR +// 2015.12.25 +A.M.Danischewski <adam_ lastname@not gamil.com> +// +// HISTORY +// 2015.12.25 V2.1 Initial version +// +A.M.Danischewski <adam_ lastname@not gamil.com> +// +// Copyrighted by A.M.Danischewski 2015+ (c) +// You may reuse this code without limit, provided this notice remain in tact. // -$info2html="/mnt/samsung22/software/info2html-2.0/info2html"; ### EDIT THIS +$info2html_basepath=realpath(dirname(__FILE__)); $page=""; if (preg_match('/info2html/', $_SERVER["REQUEST_URI"])) { if (isset($_SERVER['QUERY_STRING'])) $page=$_SERVER["QUERY_STRING"]; else print_r($_SERVER); // Calls info2html, same as if info2html were called from the commmand line. - System($info2html." \"".$page."\""); -} else { + System($info2html_basepath."/info2html \"".$page."\""); +} else if (preg_match('/infocat/', $_SERVER["REQUEST_URI"])) { + // Calls infocat, same as if info2html were called from the commmand line. + System($info2html_basepath."/infocat"); +} +else { return FALSE; } ?> |