irm/lib/Config.php
/** Return an "absolute" web location for $file (given relative to
     * the root of the IRM installation.
     *
     * Assumes:
     *   # That the PHP script file is located within the IRM
     *    installation tree; and
     *   # That the file that this method exists in is one level
     *    down from the root of the IRM installation.
     *
     * I swear this code made sense to me when I wrote it.
     *
     * You can also give AbsLoc a set of arguments to be passed to the
     * file specified, and they'll be appended in the usual URL manner. 
     * Make $args an associative array of name => value pairs.
     *
     * Warning: Do *not* pass any arguments as part of the filename if
     * you want to give an array of arguments -- Bad Things will happen.
     */
Return an "absolute" web location for $file (given relative to
the root of the IRM installation.

# That the PHP script file is located within the IRM
installation tree; and
# That the file that this method exists in is one level
down from the root of the IRM installation.

I swear this code made sense to me when I wrote it.

You can also give AbsLoc a set of arguments to be passed to the
file specified, and they'll be appended in the usual URL manner.
Make $args an associative array of name => value pairs.

Do *not* pass any arguments as part of the filename if
you want to give an array of arguments -- Bad Things will happen.
Return an " absolute " web location for $file ( given relative to the root of the IRM installation . # That the PHP script file is located within the IRM installation tree ; and # That the file that this method exists in is one level down from the root of the IRM installation . I swear this code made sense to me when I wrote it . You can also give AbsLoc a set of arguments to be passed to the file specified and they ' ll be appended in the usual URL manner . Make $args an associative array of name = > value pairs . Do * not * pass any arguments as part of the filename if you want to give an array of arguments -- Bad Things will happen .
static function AbsLoc($file, $args = NULL)
    {
        $sloc = $_SERVER['SCRIPT_NAME'];
        $sfile = @$_SERVER['SCRIPT_FILENAME'];
        if (!$sfile)
        {
            $sfile = @$_SERVER['PATH_TRANSLATED'];
        }
        $sfile = realpath($sfile);
        if (Config::onWindows())
        {
            $sfile = str_replace('\\', '/', $sfile);
        }
        $instroot = dirname(dirname(__FILE__));
        if (Config::onWindows())
        {
            $instroot = str_replace('\\', '/', $instroot);
        }
        $relativescript = preg_replace("^$instroot^", '', $sfile);
        $webroot = str_replace($relativescript, '', $sloc);
        if ($args !== NULL)
        {
            $arglist = array();
            foreach ($args as $k => $v)
            {
                $arglist[] = urlencode($k) . "=" . urlencode($v);
            }
            $file = "$file?" . join('&', $arglist);
        }
        return "$webroot/$file";
    }
static function AbsLoc ( $ file , $ args = NULL ) { $ sloc = $ _SERVER [ 'SCRIPT_NAME' ] ; $ sfile = @ $ _SERVER [ 'SCRIPT_FILENAME' ] ; if ( ! $ sfile ) { $ sfile = @ $ _SERVER [ 'PATH_TRANSLATED' ] ; } $ sfile = realpath ( $ sfile ) ; if ( Config :: onWindows ( ) ) { $ sfile = str_replace ( '\\' , '/' , $ sfile ) ; } $ instroot = dirname ( dirname ( __FILE__ ) ) ; if ( Config :: onWindows ( ) ) { $ instroot = str_replace ( '\\' , '/' , $ instroot ) ; } $ relativescript = preg_replace ( " ^ $ instroot ^ " , '' , $ sfile ) ; $ webroot = str_replace ( $ relativescript , '' , $ sloc ) ; if ( $ args !== NULL ) { $ arglist = array ( ) ; foreach ( $ args as $ k => $ v ) { $ arglist [ ] = urlencode ( $ k ) . " = " . urlencode ( $ v ) ; } $ file = " $ file ? " . join ( '&' , $ arglist ) ; } return " $ webroot / $ file " ; }
Return an "absolute" web location for $file (given relative to
 the root of the IRM installation.
Return an " absolute " web location for $file ( given relative to the root of the IRM installation .
// First, work out the filesystem location of the root of // the IRM installation // Next, get the name of the script file relative to the root // of the IRM installation // ***5 was ereg_replace, needs delimiter at end // Now, we can get the web location of the root of the IRM // installation by stripping out the script-file specific // portion from the web location of the script //$webroot = preg_replace("$relativescript\$", '', $sloc);