1   <?php
  2   ##############################################################
  3   ##In-portal                                                                                                     ##
  4   ##############################################################
  5   ##                                            In-portal                                                 ##
  6   ##                                      Intechnic Corporation                                   ##
  7   ##                         All Rights Reserved, 1998-2002                               ##
  8   ##                                                                                                                      ##      
  9   ##      No portion of this code may be copied, reproduced or    ##      
  10   ##         otherwise redistributed without proper written               ##
  11   ##        consent of Intechnic Corporation.  Violation will             ##
  12   ##         result in revocation of the license and support              ##
  13   ##       privileges along maximum prosecution allowed by law.   ##
  14   ##############################################################
  15   $pathtoroot = "";
  16   if(!strlen($pathtoroot))
  17   {
  18     $path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
  19     if(strlen($path))
  20     {
  21       /* determine the OS type for path parsing */
  22       $pos = strpos($path,":");
  23       if ($pos === false)
  24       {
  25         $gOS_TYPE="unix";
  26         $pathchar = "/";
  27       }
  28       else
  29       {
  30         $gOS_TYPE="win";
  31         $pathchar="\\";
  32       }
  33       $p = $path.$pathchar;
  34       /*Start looking for the root flag file */
  35       while(!strlen($pathtoroot) && strlen($p))
  36       {
  37         $sub = substr($p,strlen($pathchar)*-1);
  38         if($sub==$pathchar)
  39         {
  40           $filename = $p."root.flg";
  41         }
  42         else
  43           $filename = $p.$pathchar."root.flg";
  44         if(file_exists($filename))
  45         {
  46           $pathtoroot = $p;
  47         }
  48         else
  49         {
  50           $parent = realpath($p.$pathchar."..".$pathchar);
  51           if($parent!=$p)
  52           {
  53             $p = $parent;
  54           }
  55           else
  56             $p = "";
  57         }
  58       }
  59       if(!strlen($pathtoroot))
  60         $pathtoroot = ".".$pathchar;
  61     }
  62     else
  63     {
  64       $pathtoroot = ".".$pathchar;
  65     }
  66   }
  67  
  68   if (!file_exists($pathtoroot."/config.php")) {
  69           echo "In-Portal is probably not installed, or configuration file is missing.<br>";
  70           echo "Please use the installation script to fix the problem.<br><br>";
  71           echo "<a href='install.php'>Go to installation script</a><br><br>";
  72           flush();
  73           die();
  74   }
  75  
  76   $sub = substr($pathtoroot,strlen($pathchar)*-1);
  77   if($sub!=$pathchar)
  78   {
  79     $pathtoroot = $pathtoroot.$pathchar;
  80   }
  81   //echo "<PRE>"; print_r($_POST); echo "</PRE>";
  82   require_once("../kernel/startup.php");
  83  
  84   $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
  85   $admin = substr($path,strlen($pathtoroot));
  86   $objConfig->Set("AdminDirectory",$admin,0,TRUE);
  87   $objConfig->Save();
  88  
  89   //echo "Setting admin to $admin <br>\n";
  90   $localURL=$rootURL."kernel/";
  91   $adminURL = $rootURL.$admin;
  92   $imagesURL = $adminURL."/images";
  93   $browseURL = $adminURL."/browse";
  94   $cssURL = $adminURL."/include";
  95  
  96  
  97   if (!admin_login())
  98   {           
  99       if(!headers_sent())
  100         setcookie("sid"," ",time()-3600);
  101       $objSession->Logout();
  102      
  103           require_once("login.php");
  104   }
  105  
  106   $envar = "env=" . BuildEnv();
  107  
  108   require_once ("include/elements.php");
  109   require_once ("../kernel/admin/include/navmenu.php");
  110  
  111   $pathtolocal = $pathtoroot;
  112  
  113   ?>
  114  
  115   <html>
  116  
  117           <head>
  118                   <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
  119                   <meta name="generator" content="kwrite">
  120                   <link rel="stylesheet" type="text/css" href="include/style.css">
  121                   <title>In-portal Administration</title>
  122           </head>
  123   <script type="text/javascript">
  124           window.name = 'main_frame';
  125   </script>
  126   <script language="JavaScript1.2">
  127  
  128   lala = navigator.appVersion.substring(0,1);
  129  
  130   if (navigator.appName == "Netscape") {
  131           if (lala != "5") {
  132                   document.write("<frameset rows='96,*' framespacing='0' scrolling='no' frameborder='0'>");
  133           } else {
  134                   document.write("<frameset rows='95,*' framespacing='0' scrolling='no' frameborder='0'>");
  135           }
  136   } else {
  137           document.write("<frameset rows='94,*' framespacing='0' scrolling='no' frameborder='0'>");
  138   }
  139   </script>
  140           <!--<frameset rows="92,*" border="0">-->
  141                   <frame src="head.php?<?php echo $envar; ?>" name="head" scrolling="no" noresize>                
  142                   <frameset cols="200,*" border="0">
  143                           <frame src="tree/tree.php?<?php echo $envar; ?>" name="menu" target="_main" noresize scrolling="auto" marginwidth="0" marginheight="0">
  144                           <frame src="subitems.php?<?php echo $envar."&section=in-portal:root"; ?>" name="main" marginwidth="0" marginheight="0" frameborder="NO" noresize scrolling="auto">
  145                   </frameset>
  146           </frameset>
  147           <noframes>
  148                   <body bgcolor="#ffffff">
  149                           <p></p>
  150                   </body>
  151           </noframes>
  152   </html>