home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / install.php < prev    next >
Encoding:
PHP Script  |  2004-07-07  |  20.5 KB  |  854 lines

  1. <?php
  2.  
  3. /* 
  4. #### Installer PHP  1.4 RC2  #### 
  5. #### Author: Kay Vogelgesang for www.apachefriends.org 2004 ####  
  6. */    
  7.  
  8. print "\r\n  ########################################################################\n
  9.   # ApacheFriends XAMPP setup win32 Version 1.4                          #\r\n
  10.   #----------------------------------------------------------------------#\r\n
  11.   # Copyright (c) 2002-2004 Apachefriends                                #\r\n
  12.   #----------------------------------------------------------------------#\r\n
  13.   # Authors: Kay Vogelgesang <kvo@apachefriends.org>                     #\r\n
  14.   #          Oswald Kai Seidler <oswald@apachefriends.org>               #\r\n
  15.   ########################################################################\r\n\r\n"; 
  16.  
  17. /// Where I stand? ///
  18. $curdir = getcwd();
  19. list ($partition, $nonpartition) = split (':', $curdir);
  20. list ($partwampp, $directorwampp) = spliti ('\\\install', $curdir);
  21. $awkpart = eregi_replace ("\\\\","\\\\",$partwampp);
  22. $awkpartslash = ereg_replace ("\\\\","/",$partwampp);
  23. $phpdir = $partwampp;
  24. $dir = ereg_replace ("\\\\","/",$partwampp);
  25. $ppartition="$partition:";
  26.  
  27. /// I need the install.sys + update.sys for more xampp informations
  28. $installsys="install.sys";
  29. $installsysroot=$partwampp."\install\\".$installsys;
  30.  
  31. /// Some addon|update.sys files 
  32. $perlupdatesys="perlupdate.sys";
  33. $pythonupdatesys="pythonupdate.sys";
  34. $serverupdatesys="serverupdate.sys";
  35. $utilsupdatesys="utilsupdate.sys";
  36. $javaupdatesys="javaupdate.sys";
  37. $otherupdatesys="otherupdate.sys";
  38.  
  39.  
  40. /// XAMPP main directrory is ... 
  41. $substit="\\\\\\\\xampp";
  42. $substitslash="/xampp";
  43.  
  44. /// Globale variables
  45. global $BS; 
  46. $BS = 0;
  47. global $CS; 
  48. $CS = 0;
  49. global $slashi;
  50. $slashi=1;
  51. global $bslashi;
  52. $bslashi=1;
  53. $awkexe=".\install\awk.exe";
  54. $awk=".\install\config.awk";
  55. // $awkexe="$partwampp\install\awk.exe";
  56. // $awk="$partwampp\install\config.awk";
  57. $awknewdir="\"".$awkpart."\"";
  58. $awkslashdir="\"".$awkpartslash."\"";
  59. global $xamppversion;
  60. if (file_exists("$partwampp\install\.version")) 
  61. { include_once("$partwampp\install\.version"); }
  62. $confhttpdroot=$partwampp."\apache\\conf\\httpd.conf";
  63.  
  64.  
  65. // Find the install status for xampp basic package in the install.sys file
  66. if (file_exists($installsysroot)) 
  67. {
  68. $i=0;
  69. $datei = fopen($installsysroot,'r');
  70. while(!feof($datei)) 
  71.     {
  72. $zeile = fgets($datei,255);
  73. $sysroot[]=$zeile; 
  74. $i+=1; 
  75.     }
  76. fclose($datei);
  77. list ($left, $right) = split (' = ', $sysroot[0]);
  78. // $right = eregi_replace (" ","",$right);
  79. $right = eregi_replace ("\r\n","",$right);
  80. if (strtolower($partwampp)==strtolower($right))
  81.     {
  82.     $xamppinstaller="nothingtodo";
  83.     }
  84. else
  85.     { 
  86.     $xamppinstaller="newpath";
  87.     $substit = eregi_replace ("\\\\","\\\\\\\\",$right);
  88.     $substitslash = eregi_replace("\\\\","/",$right);
  89.     }
  90. }
  91. else
  92.     $installsys = fopen($installsysroot,'w');
  93.     $wamppinfo = "DIR = $partwampp\r\nxampp = $xamppversion\r\nserver = 0\r\nperl = 0\r\npython = 0\r\nutils = 0\r\njava = 0\r\nother = 0"; 
  94.     fputs($installsys,$wamppinfo); 
  95.     fclose($installsys);
  96.     $xamppinstaller="newinstall"; 
  97. }
  98.  
  99.  
  100. /// Find some *update.sys files and modify the install.sys ...
  101.  
  102. $path=$partwampp."\install\\";
  103. $hdl=opendir($path);
  104. while ($res = readdir ($hdl)) { $array[]=$res; } //Searching all xampp sys files
  105. closedir($hdl); 
  106. $werte=count($array);
  107. for ($q=2; $q<$werte; $q++)
  108. {
  109. if ($array[$q]==$perlupdatesys || $array[$q]==$pythonupdatesys || $array[$q]==$serverupdatesys || $array[$q]==$utilsupdatesys || $array[$q]==$javaupdatesys || $array[$q]==$otherupdatesys)
  110.     {
  111.  
  112. $updatesysroot=$partwampp."\install\\".$array[$q];
  113.  
  114. if (file_exists($updatesysroot)) 
  115. {
  116.     $datei = fopen($updatesysroot,'r');
  117.     unset($updatezeile);
  118.     
  119.     $i=0;
  120.     while(!feof($datei)) 
  121.     {
  122.  
  123.     $zeile = fgets($datei,255);
  124.     $updatezeile[]=$zeile;
  125.     list ($left, $right) = split ('=', $updatezeile[0]);
  126.     // $right = eregi_replace (" ","",$right);
  127.     $left = eregi_replace (" ","",$left);
  128.     $left = eregi_replace ("\r\n","",$left);
  129.     $right = eregi_replace ("\r\n","",$right);        
  130.     $update=$left;
  131.     $update=strtolower($update); 
  132.     $updateversion=$right;
  133.     $updateversionzahl = eregi_replace ("\.","",$updateversion);
  134.     $updateinc="xampp".$update.".inc";
  135.     $updateconf=$update.".conf";
  136.     echo "  Configure for $update $updateversion\r\n";
  137.     $i++;
  138.     }
  139.     fclose($datei);    
  140.  
  141.     if (file_exists($installsysroot)) 
  142.     {
  143.     $datei = fopen($installsysroot,'r');
  144.     unset($newzeile);
  145.     $i=0;
  146.     while(!feof($datei)) 
  147.     {
  148.     $zeile = fgets($datei,255);
  149.     $newzeile[]=$zeile; 
  150.     $i++; 
  151.     }
  152.     fclose($datei);
  153.  
  154.         /// Analyze install.sys to *update.syse for todo     
  155.         $datei = fopen($installsysroot,'w'); 
  156.         if($datei) 
  157.             { 
  158.                 for($z=0;$z<$i+1;$z++) 
  159.                 { 
  160.                     if (eregi($update,$newzeile[$z]))
  161.                     {
  162.                         list ($left, $right) = split ('=', $newzeile[$z]);
  163.                         // $right = eregi_replace (" ","",$right);
  164.                         $left = eregi_replace (" ","",$left);
  165.                         $left = eregi_replace ("\r\n","",$left);
  166.                         $right = eregi_replace ("\r\n","",$right);
  167.                         $currentversionzahl = eregi_replace ("\.","",$right);
  168.                         if ($currentversionzahl == 0 )
  169.                         {
  170.                             $updatemake="makenew"; // New installation
  171.                             $putnew="$update = $updateversion\r\n";
  172.                             fputs($datei, $putnew);
  173.                         }
  174.                         elseif ($currentversionzahl < $updateversionzahl)
  175.                         {
  176.                             $updatemake="update";  // Update installation
  177.                             $putnew="perl = $updateversion\r\n";
  178.                             fputs($datei, $putnew);
  179.                         }
  180.                         else
  181.                         {
  182.                             $updatemake="doppelt"; // Installation is current
  183.                             fputs($datei,$newzeile[$z]); 
  184.                         }
  185.  
  186.                     }
  187.                     else 
  188.                     { 
  189.                     fputs($datei,$newzeile[$z]); 
  190.                     }
  191.                 }
  192.             }
  193.     fclose($datei);
  194.     
  195.     if ($updatemake=="makenew" || $updatemake=="doppelt")
  196.     { 
  197.         include_once("$partwampp\install\\$updateinc"); 
  198.     }
  199.  
  200.     
  201.     }
  202. // httpd.conf modification for Perl, Python or Java (only single)
  203. if ($update=="perl")
  204.     {
  205.     $includehttpdconf="\r\n\r\nInclude conf/perl.conf";
  206.     }
  207.     if ($update=="python")
  208.     {
  209.     $includehttpdconf="\r\n\r\nInclude conf/python.conf";
  210.     }
  211.     if ($update=="java")
  212.     {
  213.     $includehttpdconf="\r\n\r\nInclude conf/java.conf";
  214.     }
  215.     
  216. if (($update=="perl" || $update=="python" || $update=="java") && $updatemake=="makenew")
  217.     {
  218.     $datei = fopen($confhttpdroot,'a'); 
  219.     if($datei) 
  220.             { 
  221.             fputs($datei, $includehttpdconf);
  222.             }
  223.     fclose($datei);
  224.     }
  225.  
  226.  
  227. unlink ($updatesysroot);
  228. }
  229. }
  230.  
  231.  
  232.  
  233.  
  234. if ($xamppinstaller=="newinstall" || $xamppinstaller=="newpath")
  235. {
  236. if ($xamppinstaller=="newinstall")
  237.     {
  238.     /// First initialization only main packages 
  239.     if (file_exists("$partwampp\install\\xamppbasic.inc")) 
  240.         { include_once("$partwampp\install\\xamppbasic.inc"); }
  241.  
  242.     }
  243.     
  244.     else
  245.     {
  246. /// Find all the packages 
  247. if (file_exists("$partwampp\install\\xamppbasic.inc")) 
  248. { include_once("$partwampp\install\\xamppbasic.inc"); }
  249. if (file_exists("$partwampp\install\\xamppserver.inc")) 
  250. { include_once("$partwampp\install\\xamppserver.inc"); }
  251. if (file_exists("$partwampp\install\\xamppperl.inc")) 
  252. { include_once("$partwampp\install\\xamppperl.inc"); }
  253. if (file_exists("$partwampp\install\\xampppython.inc")) 
  254. { include_once("$partwampp\install\\xampppython.inc"); }
  255. if (file_exists("$partwampp\install\\xampputils.inc")) 
  256. { include_once("$partwampp\install\\xampputils.inc"); }
  257. if (file_exists("$partwampp\install\\xamppjava.inc")) 
  258. { include_once("$partwampp\install\\xamppjava.inc"); }
  259. if (file_exists("$partwampp\install\\xamppother.inc")) 
  260. { include_once("$partwampp\install\\xamppother.inc"); }
  261. $updatemake="nothingtodo";
  262.     }
  263. }
  264.  
  265. $scount=count($slash);
  266. $bcount=count($backslash);
  267.  
  268. /////////////////// xampp path is changing ///////////////////
  269. if ($xamppinstaller=="newpath")
  270. {
  271. set_time_limit(0);
  272. define('STDIN',fopen("php://stdin","r"));
  273.     while($BS == "0")
  274.     {
  275.     echo "\n  Do you want to refresh the XAMPP installation?\n";
  276.     echo "  Soll die XAMPP Installation jetzt aktualisiert werden?\n\n";
  277.     echo "  1) Refresh now! (Jetzt aktualisieren!)\n";
  278.     echo "  x) Exit (Beenden)\n";
  279.  
  280.         switch(trim(fgets(STDIN,256)))
  281.         {
  282.         case 1:
  283.         $BS = 1;
  284.         echo "\r\n  XAMPP is refreshing now ...\r\n";
  285.         echo "  XAMPP wird nun aktualisiert ...\r\n\r\n";
  286.         sleep(1);
  287.         break;
  288.  
  289.         case "x":
  290.         echo "\r\n  The refresh is terminating on demand ...  exit\r\n";
  291.         echo "  Die Aktualisierung wurde auf Wunsch abgebrochen ...\r\n";
  292.         sleep(3);
  293.         exit();
  294.  
  295.         default: 
  296.         exit();
  297.         }
  298.     }
  299. fclose(STDIN);
  300. }
  301.  
  302. /////////////////// You can configure the addon modules for httpd ///////////////////
  303. if (file_exists($installsysroot)) 
  304.     {
  305.     $datei = fopen($installsysroot,'r');
  306.     unset($newzeile);
  307.     $i=0;
  308.         while(!feof($datei)) 
  309.         {
  310.         $zeile = fgets($datei,255);
  311.         list ($left, $right) = split ('=', $zeile);
  312.         // $right = eregi_replace (" ","",$right);
  313.         $left = eregi_replace (" ","",$left);
  314.         $left = eregi_replace ("\r\n","",$left);
  315.         $right = eregi_replace ("\r\n","",$right);
  316.         $right = eregi_replace ("\.","",$right);
  317.         if (strtolower($right) > 0)
  318.             {
  319.             if (strtolower($left)=="perl")
  320.                 {
  321.                 $perlactive="yes";
  322.                 
  323.                 }
  324.                 if (strtolower($left)=="python")
  325.                 {
  326.                 $pythonactive="yes";
  327.                 }
  328.                 if (strtolower($left)=="java")
  329.                 {
  330.                 $javaactive="yes";
  331.                 }
  332.             } 
  333.         }
  334. fclose($datei);
  335.     }
  336.  
  337.  
  338.  
  339.  
  340. /////////////////// Case new install ///////////////////
  341. if ($xamppinstaller=="newinstall" || $BS==1 || $updatemake=="makenew" || $updatemake=="doppelt")
  342. {
  343.  
  344. if ($BS=="1")
  345. { echo "  Refreshing all paths in config files ... \r\n\r\n";  }
  346.  
  347. echo "  Configure XAMPP with awk for ";
  348. $system = system ("echo '%os%'");
  349. if ($system!="'Windows_NT'")
  350. {$system = "Windows"; echo "  $system 98/ME/HOME (not NT)";} 
  351. echo "  Please wait ...";
  352. if ($xamppinstaller=="newinstall")
  353. {
  354. if ($system=="Windows")
  355. {
  356.     $confhttpdroot=$partwampp."\apache\\conf\\httpd.conf";
  357.     $includewin="Win32DisableAcceptEx ON\r\n";
  358.     echo "\r\n  Disable AcceptEx Winsocks v2 support (only NT)";
  359.     $datei = fopen($confhttpdroot,'r');
  360.     unset($newzeile);
  361.     $i=0;
  362.     while(!feof($datei)) 
  363.     {
  364.     $zeile = fgets($datei,255);
  365.     $newzeile[]=$zeile; 
  366.     $i++; 
  367.     }
  368.     fclose($datei);
  369.      $datei = fopen($confhttpdroot,'w'); 
  370.         if($datei) 
  371.             { 
  372.                 for($z=0;$z<$i+1;$z++) 
  373.                 { 
  374.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  375.                     {
  376.                         fputs($datei, $includewin);
  377.                     }
  378.                     else 
  379.                     { 
  380.                     fputs($datei,$newzeile[$z]); 
  381.                     }
  382.                 }
  383.             }
  384.     fclose($datei);
  385.  
  386.     $confhttpdroot=$partwampp."\php\\php4\\httpd4.conf";
  387.     if (file_exists($confhttpdroot))
  388.     {
  389.     $includewin="Win32DisableAcceptEx ON\r\n";
  390.     $datei = fopen($confhttpdroot,'r');
  391.     unset($newzeile);
  392.     $i=0;
  393.     while(!feof($datei)) 
  394.     {
  395.     $zeile = fgets($datei,255);
  396.     $newzeile[]=$zeile; 
  397.     $i++; 
  398.     }
  399.     fclose($datei);
  400.      $datei = fopen($confhttpdroot,'w'); 
  401.         if($datei) 
  402.             { 
  403.                 for($z=0;$z<$i+1;$z++) 
  404.                 { 
  405.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  406.                     {
  407.                         fputs($datei, $includewin);
  408.                     }
  409.                     else 
  410.                     { 
  411.                     fputs($datei,$newzeile[$z]); 
  412.                     }
  413.                 }
  414.             }
  415.     fclose($datei);
  416.     }
  417.     $confhttpdroot=$partwampp."\php\\httpd5.conf";
  418.     if (file_exists($confhttpdroot))
  419.     {
  420.     $includewin="Win32DisableAcceptEx ON\r\n";
  421.     $datei = fopen($confhttpdroot,'r');
  422.     unset($newzeile);
  423.     $i=0;
  424.     while(!feof($datei)) 
  425.     {
  426.     $zeile = fgets($datei,255);
  427.     $newzeile[]=$zeile; 
  428.     $i++; 
  429.     }
  430.     fclose($datei);
  431.      $datei = fopen($confhttpdroot,'w'); 
  432.         if($datei) 
  433.             { 
  434.                 for($z=0;$z<$i+1;$z++) 
  435.                 { 
  436.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  437.                     {
  438.                         fputs($datei, $includewin);
  439.                     }
  440.                     else 
  441.                     { 
  442.                     fputs($datei,$newzeile[$z]); 
  443.                     }
  444.                 }
  445.             }
  446.     fclose($datei);
  447.     }
  448. }
  449. else
  450. {
  451.     $confhttpdroot=$partwampp."\apache\\conf\\httpd.conf";
  452.     $includewin="# Win32DisableAcceptEx ON\r\n";
  453.     echo "\r\n  Enable AcceptEx Winsocks v2 support for NT systems";
  454.     $datei = fopen($confhttpdroot,'r');
  455.     $i=0;
  456.     unset($newzeile);
  457.     while(!feof($datei)) 
  458.     {
  459.     $zeile = fgets($datei,255);
  460.     $newzeile[]=$zeile; 
  461.     $i++; 
  462.     }
  463.     fclose($datei);
  464.      $datei = fopen($confhttpdroot,'w'); 
  465.         if($datei) 
  466.             { 
  467.                 for($z=0;$z<$i+1;$z++) 
  468.                 { 
  469.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  470.                     {
  471.                         fputs($datei, $includewin);
  472.                     }
  473.                     else 
  474.                     { 
  475.                     fputs($datei,$newzeile[$z]); 
  476.                     }
  477.                 }
  478.             }
  479.     fclose($datei);
  480.  
  481.     $confhttpdroot=$partwampp."\php\\php4\\httpd4.conf";
  482.     if (file_exists($confhttpdroot))
  483.     {
  484.     $includewin="# Win32DisableAcceptEx ON\r\n";
  485.     $datei = fopen($confhttpdroot,'r');
  486.     $i=0;
  487.     unset($newzeile);
  488.     while(!feof($datei)) 
  489.     {
  490.     $zeile = fgets($datei,255);
  491.     $newzeile[]=$zeile; 
  492.     $i++; 
  493.     }
  494.     fclose($datei);
  495.      $datei = fopen($confhttpdroot,'w'); 
  496.         if($datei) 
  497.             { 
  498.                 for($z=0;$z<$i+1;$z++) 
  499.                 { 
  500.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  501.                     {
  502.                         fputs($datei, $includewin);
  503.                     }
  504.                     else 
  505.                     { 
  506.                     fputs($datei,$newzeile[$z]); 
  507.                     }
  508.                 }
  509.             }
  510.     fclose($datei);
  511.     }
  512.     $confhttpdroot=$partwampp."\php\\httpd5.conf";
  513.     if (file_exists($confhttpdroot))
  514.     {
  515.     $includewin="# Win32DisableAcceptEx ON\r\n";
  516.     $datei = fopen($confhttpdroot,'r');
  517.     $i=0;
  518.     unset($newzeile);
  519.     while(!feof($datei)) 
  520.     {
  521.     $zeile = fgets($datei,255);
  522.     $newzeile[]=$zeile; 
  523.     $i++; 
  524.     }
  525.     fclose($datei);
  526.      $datei = fopen($confhttpdroot,'w'); 
  527.         if($datei) 
  528.             { 
  529.                 for($z=0;$z<$i+1;$z++) 
  530.                 { 
  531.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  532.                     {
  533.                         fputs($datei, $includewin);
  534.                     }
  535.                     else 
  536.                     { 
  537.                     fputs($datei,$newzeile[$z]); 
  538.                     }
  539.                 }
  540.             }
  541.     fclose($datei);
  542.     }
  543. }
  544. }
  545. $substit="\"".$substit."\"";
  546. for ($i=1;$i<=$bcount;$i++)
  547. {
  548.  
  549.  
  550.  
  551.  
  552. $temp=$backslash[$i];
  553. $awkconfig=$backslashrootawk[$temp].$backslash[$i]."\"";
  554. $awkconfigtemp=$backslashrootawk[$temp].$backslash[$i]."temp\"";
  555. $configreal=$backslashrootreal[$temp].$backslash[$i];
  556. $configtemp=$backslashrootreal[$temp].$backslash[$i]."temp";
  557.  
  558.  
  559. ///////////// Section SET  NEW configfiles for addons/update OR DELETE /////////////
  560. $configrealnew=$backslashrootreal[$temp].$backslash[$i].".new";
  561. if (!file_exists($configreal) && file_exists($configrealnew))
  562.     { 
  563.             
  564.             if (!@copy($configrealnew, $configreal)) 
  565.                 {}            
  566.             else { unlink ($configrealnew); }
  567.         
  568.     }
  569.     elseif (file_exists($configrealnew))
  570.     { unlink ($configrealnew); }
  571.  
  572. if ($updatemake=="doppelt")
  573.     { break; }
  574.  
  575.  
  576. $awkrealm=$awkexe." -v DIR=".$awknewdir." -v CONFIG=".$awkconfig. " -v CONFIGNEW=".$awkconfigtemp. "  -v SUBSTIT=".$substit." -f ".$awk;  
  577.  
  578.  
  579.  
  580. if (file_exists($awk) && file_exists($awkexe) && file_exists($configreal)) 
  581. {        
  582.     shell_exec("$awkrealm");
  583.  
  584.     if (file_exists($configtemp) && file_exists($configreal))
  585.     {
  586.     if (!@copy($configtemp, $configreal)) 
  587.         {
  588.         // echo "\r\n\r\n$configtemp could not be copied to $configreal";
  589.         }
  590.         else { unlink ($configtemp); }
  591.     } 
  592. }
  593.  
  594.  
  595. $substitslash="\"".$substitslash."\"";
  596. for ($i=1;$i<=$scount;$i++)
  597. {
  598. $temp=$slash[$i];
  599. $awkconfig=$slashrootawk[$temp].$slash[$i]."\"";
  600. $awkconfigtemp=$slashrootawk[$temp].$slash[$i]."temp\"";
  601. $configreal=$slashrootreal[$temp].$slash[$i];
  602. $configtemp=$slashrootreal[$temp].$slash[$i]."temp";
  603.  
  604. ///////////// Section SET  NEW configfiles for addons/update OR DELETE /////////////
  605. $configrealnew=$slashrootreal[$temp].$slash[$i].".new";
  606. if (!file_exists($configreal) && file_exists($configrealnew))
  607.     { 
  608.             
  609.             if (!@copy($configrealnew, $configreal)) 
  610.                 {}            
  611.             else { unlink ($configrealnew); }
  612.         
  613.     }
  614.     elseif (file_exists($configrealnew))
  615.     { unlink ($configrealnew); }
  616.  
  617.     if ($updatemake=="doppelt")
  618.     { break; }
  619.  
  620. $awkrealm=$awkexe." -v DIR=".$awkslashdir." -v CONFIG=".$awkconfig. " -v CONFIGNEW=".$awkconfigtemp. "  -v SUBSTIT=".$substitslash." -f ".$awk;  
  621.  
  622.  
  623. if (file_exists($awk) && file_exists($awkexe) && file_exists($configreal)) 
  624. {
  625.     shell_exec("$awkrealm");
  626.  
  627.     if (file_exists($configtemp) && file_exists($configreal))
  628.     {
  629.     if (!@copy($configtemp, $configreal)) 
  630.         {
  631.         // echo "\r\n\r\n$configtemp could not be copied to $configreal";
  632.         }
  633.         else { unlink ($configtemp); }
  634.     } 
  635. }
  636.  
  637.  
  638.     
  639.     if ($xamppinstaller=="newpath" || $BS==1)
  640.     {
  641.         if (file_exists($installsysroot)) 
  642.         {
  643.         $datei = fopen($installsysroot,'r');
  644.         unset($newzeile);
  645.         $i=0;
  646.         while(!feof($datei)) 
  647.         {
  648.         $zeile = fgets($datei,255);
  649.         $newzeile[]=$zeile; 
  650.         $i++; 
  651.         }
  652.         fclose($datei);
  653.         }
  654.         
  655.         $datei = fopen($installsysroot,'w'); 
  656.         if($datei) 
  657.             { 
  658.                 for($z=0;$z<$i+1;$z++) 
  659.                 { 
  660.                     if (eregi("DIR",$newzeile[$z]))
  661.                     {
  662.                         $includenewdir="DIR = $partwampp\r\n";
  663.                         fputs($datei, $includenewdir);
  664.                     }
  665.                     else 
  666.                     { 
  667.                     $includenewdir=$newzeile[$z];
  668.                     fputs($datei, $includenewdir); 
  669.                     }
  670.                 }
  671.             }
  672.             fclose($datei);
  673.     }
  674.  
  675. ////////// Replace (copy) some newer files ////////////////
  676.     $phpbin=$partwampp."\apache\bin\php.ini";
  677.     $phpcgi=$partwampp."\php\php.ini";
  678.     $workersbin=$partwampp."\\tomcat\\conf\workers.properties";
  679.     $workersjk=$partwampp."\\tomcat\\conf\jk\workers.properties";
  680.         if (file_exists($phpbin)) 
  681.         {
  682.         copy($phpbin,$phpcgi);
  683.         }
  684.         if (file_exists($workersbin)) 
  685.         {
  686.         copy($workersbin,$workersjk);
  687.         }
  688.  
  689.     echo "  DONE!\r\n\r\n";
  690. echo "\r\n  ##### Have fun with ApacheFriends XAMPP! #####\r\n\r\n\r\n";
  691. sleep(3);
  692. exit();
  693. }
  694.  
  695.  
  696.  
  697. //////////////// Selection for modules  ////////////////
  698. if (($perlactive=="yes" || $pythonactive=="yes" || $javaactive=="yes") && $update=="")
  699. {
  700. $u=1;
  701.  
  702. if ($perlactive=="yes")
  703.     {
  704.     $moduleconf="conf/perl.conf";
  705.     $moduleconfigure="MOD_PERL";
  706.     $u++;
  707.     }
  708. if ($pythonactive=="yes")
  709.     {
  710.     $moduleconf="conf/pyton.conf";
  711.     $moduleconfigure="MOD_PYTHON";
  712.     $u++;
  713.     }
  714. if ($javaactive=="yes")
  715.     {
  716.     $moduleconf="conf/java.conf";
  717.     $moduleconfigure="MOD_JDK";
  718.     $u++;
  719.     }
  720.  
  721. set_time_limit(0);
  722. define('NEWSTDIN',fopen("php://stdin","r"));
  723. while($CS == "0")
  724. {
  725. echo "\n  Please select your choice!\n";
  726. echo "  Bitte jetzt auswaehlen!\n\n";
  727. if ($perlactive=="yes")
  728.     {
  729.     echo "  1) Configuration with MOD_PERL (mit MOD_PERL)\n";
  730.     echo "  2) Configuration without MOD_PERL (ohne MOD MOD_PERL)\n";
  731.     }
  732.     if ($pythonactive=="yes")
  733.     {
  734.     echo "  3) Configuration with MOD_PYTHON (mit MOD_PYTHON)\n";
  735.     echo "  4) Configuration without MOD_PYTHON (ohne MOD_PYTHON)\n";
  736.     }
  737.     if ($javaactive=="yes")
  738.     {
  739.     echo "  5) Configuration with MOD_JDK (mit MOD_JDK)\n";
  740.     echo "  6) Configuration without MOD_JDK (ohne MOD_JDK)\n";
  741.     }
  742.     echo "  x) Exit (Beenden)\n";
  743.  
  744. switch(trim(fgets(NEWSTDIN,256)))
  745. {
  746. case 1:
  747. $CS = 1;
  748. echo "\r\n  Starting configure XAMPP with MOD_PERL ...\r\n";
  749. sleep(1);
  750. break;
  751.  
  752. case 2:
  753. $CS = 2;
  754. echo "\r\n  Starting configure XAMPP without MOD_PERL ...\r\n";
  755. sleep(1);
  756. break;
  757.  
  758. case 3:
  759. $CS = 3;
  760. echo "\r\n  Starting configure XAMPP with MOD_PYTHON ...\r\n";
  761. sleep(1);
  762. break;
  763.  
  764. case 4:
  765. $CS = 4;
  766. echo "\r\n  Starting configure XAMPP without MOD_PYTHON ...\r\n";
  767. sleep(1);
  768. break;
  769.  
  770. case 5:
  771. $CS = 5;
  772. echo "\r\n  Starting configure XAMPP with MOD_JDK ...\r\n";
  773. sleep(1);
  774. break;
  775.  
  776. case 6:
  777. $CS = 6;
  778. echo "\r\n  Starting configure XAMPP without MOD_JDK ...\r\n";
  779. sleep(1);
  780. break;
  781.  
  782. case "x":
  783. echo "\r\n  Setup is terminating on demand ...  exit\r\n";
  784. echo "  Das Setup wurde auf Wunsch abgebrochen ...\r\n";
  785. sleep(3);
  786. exit();
  787.  
  788. default: 
  789. exit();
  790. }
  791. }
  792. fclose(NEWSTDIN);
  793.  
  794. if ($CS == 1)
  795.     { $include = "Include conf/perl.conf"; $searchstring="conf/perl.conf";}
  796. if ($CS == 2)
  797.     { $include = "# Include conf/perl.conf"; $searchstring="conf/perl.conf";}
  798. if ($CS == 3)
  799.     { $include = "Include conf/python.conf"; $searchstring="conf/python.conf"; }
  800. if ($CS == 4)
  801.     { $include = "# Include conf/python.conf"; $searchstring="conf/python.conf";}
  802. if ($CS == 5)
  803.     { $include = "Include conf/java.conf"; $searchstring="conf/java.conf";}
  804. if ($CS == 6)
  805.     { $include = "# Include conf/java.conf"; $searchstring="conf/java.conf";}
  806.  
  807.  
  808.  
  809.  
  810. if ($CS > 0)
  811. {    
  812.     $i=0;    
  813.     $datei = fopen($confhttpdroot,'r');
  814.     while(!feof($datei)) 
  815.     {
  816.     $zeile = fgets($datei,255);
  817.     $newzeile[]=$zeile; 
  818.     $i++; 
  819.     }
  820.     fclose($datei);
  821.      $datei = fopen($confhttpdroot,'w'); 
  822.         if($datei) 
  823.             { 
  824.                 for($z=0;$z<$i+1;$z++) 
  825.                 { 
  826.                     if (eregi($searchstring,$newzeile[$z]))
  827.                     {
  828.                         fputs($datei, $include);
  829.                     }
  830.                     else 
  831.                     { 
  832.                     fputs($datei,$newzeile[$z]); 
  833.                     }
  834.                 }
  835.             }
  836.     fclose($datei);
  837.     echo "  Done!\r\n\r\n";    
  838. }
  839. }
  840.  
  841. if ($updatemake=="")
  842.         {  $updatemake="nothingtodo"; }
  843.  
  844. if ($updatemake=="nothingtodo" && $xamppinstaller=="nothingtodo" && ($CS < 1 || $CS == ""))
  845. { echo "\r\n\r\n Sorry, but ... nothing to do!\r\n\r\n\r\n";  }
  846.  
  847.  
  848. exit();
  849. ?>
  850.