IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2013, 4:16:39 PM (13 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20130307

Location:
trunk/dvodist/www-util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/dvodist/www-util/dvodist.page.mkd

    r34748 r35415  
    1212$fromProxy = $_SERVER['HTTP_X_FORWARDED_FOR'] && ($_SERVER['REMOTE_ADDR'] == $ifaProxy);
    1313if ($fromProxy) {
    14   $rootdir = "";
     14  $rootdir = "@ROOTWWW@";
    1515 } else {
    16   $rootdir = "@ROOTDIR@";
     16  $rootdir = "@ROOTWWW@@ROOTDIR@";
    1717 }
    1818
     
    2020
    2121$script = basename($_SERVER[SCRIPT_NAME]);
    22 do_markdown ($script);
     22do_markdown ($script, $rootdir);
    2323
    2424menu_end();
  • trunk/dvodist/www-util/ipp.php

    r35238 r35415  
    11<?php
    2 
    3 global $rootdir;
    42
    53function head ($title) {
     
    2220  echo "<body>\n";
    2321
     22  echo "<!-- Start eXTReMe Pro Tracker Code V3/7\n";
     23  echo "Login:    emagnier\n";
     24  echo "Help:     https://www.extremetracking.com\n";
     25  echo "Installation instructions:\n";
     26  echo "Copy and paste this code between the two body tags into the\n";
     27  echo "*source* of your pages or in your footer/template. Best is\n";
     28  echo "to use a normal text editor such as notepad. -->\n";
     29  echo "<script type=\"text/javascript\"><!--\n";
     30  echo "EXd=document;location.protocol==\"https:\"?EXp=\"https\":EXp=\"http\";EXs=\"src\";\n";
     31  echo "EXd.write(\"<img \"+EXs+\"=\"+EXp+\"://nht-2.extreme-dm.com/n2.g?login=emagnier\",\n";
     32  echo "\"&url=\"+escape(EXd.URL)+\"&jv=\"+navigator.javaEnabled()+\"&\",\n";
     33  echo "\"d=\"+screen.width+\"x\"+screen.height+\"&c=\"+screen.colorDepth+\"\",\n";
     34  echo "\"&l=\"+escape(EXd.referrer)+\" width=0 height=0>\");//-->\n";
     35  echo "</script><noscript><img height=\"1\" width=\"1\" alt=\"\"\n";
     36  echo "src=\"http://nht-2.extreme-dm.com/n2.g?login=emagnier&amp;url=nojs\">\n";
     37  echo "</noscript>\n";
     38  echo "<!-- End eXTReMe Pro Tracker Code -->\n";
     39
    2440  if (! $project) { $project = "none"; }
    2541
    26   // echo "<p style=\"font-size:50%\">host: $WWWHOST, db: $DBHOST</p>\n";
     42  // echo "<p style=\"font-size:50%\">host: $root</p>\n";
    2743  echo "<table class=page cellspacing=10px><tr><td valign=top>\n";
    2844  echo "<table class=menu cellspacing=0px>\n";
     
    7692    }
    7793
    78     global $rootdir;
    79 
    8094    // hi-lite the current page (use select-style, not style)
    8195    $thisname = $_SERVER[SCRIPT_NAME];
    82     $page = $rootdir . $base;
     96    $page = $root . $base;
    8397    if ($page == $thisname) {
    8498      $style = trim($line[1]);
     
    92106      break;
    93107    case 'picture':
    94       // prepend the rootdir if needed (reference to /)
     108      // prepend the root if needed (reference to /)
    95109      if ($name[0] == '/') {
    96110        $name = $root . $name;
     
    99113      break;
    100114    case 'piclink':
    101       // prepend the rootdir if needed (reference to /)
     115      // prepend the root if needed (reference to /)
    102116      if ($name[0] == '/') {
    103117        $name = $root . $name;
     
    249263
    250264// lines which start with @ are processed by 'dirlist', all others are processed by Markdown
    251 function do_markdown ($source) {
     265function do_markdown ($source, $root) {
     266
    252267  if (!file_exists($source)) return;
    253268
     
    258273  $to_dirlist = "";
    259274  while ($line = fgets ($file, 1024)) {
     275    // replace @WWWHOST@ with $root
     276    $line = str_replace ("@WWWHOST@", $root, $line);
     277
    260278    // echo "line: $line";
    261279    if (!strncmp($line, "@", 1)) {
  • trunk/dvodist/www-util/ippdata.page.mkd

    r34748 r35415  
    77// if we come in directly, the top-level directory should be /dvodist
    88// if we come in from the ippops1 proxy, we need to set the root to /
    9 $ifaProxy = "128.171.227.208";
     9$realHost = "ipp.ifa.hawaii.edu";
    1010
    11 // is the request coming from our proxY?
    12 $fromProxy = $_SERVER['HTTP_X_FORWARDED_FOR'] && ($_SERVER['REMOTE_ADDR'] == $ifaProxy);
    13 if ($fromProxy) {
    14   $rootdir = "";
    15  } else {
    16   $rootdir = "@ROOTDIR@";
    17  }
     11// is the request coming from our proxy?
     12if ($_SERVER['SERVER_NAME'] == $realHost) {
     13  $rootdir = "@ROOTWWW@";
     14} else {
     15  $rootdir = "@ROOTWWW@@ROOTDIR@";
     16}
    1817
    1918menu("$utils/ippdata.menu.dat", 'Pan-STARRS 1 Data Distribution Server', $rootdir, "$rootdir/ipp.css", '', '');
    2019
    2120$script = basename($_SERVER[SCRIPT_NAME]);
    22 do_markdown ($script);
     21do_markdown ($script, $rootdir);
    2322
    2423menu_end();
    2524?>
    26 
    27 // generic proxy detection
    28 // if ( $_SERVER['HTTP_X_FORWARDED_FOR']
    29 //      || $_SERVER['HTTP_X_FORWARDED']
    30 //      || $_SERVER['HTTP_FORWARDED_FOR']
    31 //      || $_SERVER['HTTP_CLIENT_IP']
    32 //      || $_SERVER['HTTP_VIA']
    33 //      || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
    34 //      || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30))
    35 //   {
    36 //     exit('Proxy detected');
    37 //   }
    38 
    39 // list server info:
    40 // $varlist = array ('SCRIPT_NAME', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_VIA', 'REMOTE_ADDR');
    41 //
    42 // foreach ($varlist as $name) {
    43 //   echo "$name : $_SERVER[$name]<br>\n";
    44 // }
    45 //
    46 // echo "get list<br>\n";
    47 // foreach ($_GET as $key => $value) {
    48 //   echo "$key : $value<br>\n";
    49 // }
    50 
Note: See TracChangeset for help on using the changeset viewer.