[Openfirst-cvscommit] base/config install.php,1.2,1.3
Brought to you by:
xtimg
From: <xt...@us...> - 2003-06-21 20:07:08
|
Update of /cvsroot/openfirst/base/config In directory sc8-pr-cvs1:/tmp/cvs-serv24359 Modified Files: install.php Log Message: Allow use of installer on systems without the glob() functions, as a result of their sheer ubiquitousness. Index: install.php =================================================================== RCS file: /cvsroot/openfirst/base/config/install.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** install.php 21 Jun 2003 15:48:35 -0000 1.2 --- install.php 21 Jun 2003 20:07:06 -0000 1.3 *************** *** 34,38 **** if($user->membertype == "administrator") { ! ?> <h1>SQL Install</h1> --- 34,38 ---- if($user->membertype == "administrator") { ! ?> <h1>SQL Install</h1> *************** *** 43,46 **** --- 43,47 ---- <form method="post" action="install.php"> <?php + if(function_exists(glob)) { foreach (glob("../*/setup/*.mysql") as $filename) { *************** *** 62,74 **** } } else { ! echo("<p>Sorry, but your version of PHP does not have the <b>glob</b> function required by ! this module. Please submit a bug report.</p>"); ! } ?> <br /><input type="submit" value="Create Tables" /> </form> ! <?php } else { showlogin(); } include($footer); ?> --- 63,106 ---- } } else { ! chdir(".."); ! $handle=@opendir(getcwd()); ! while ($file = readdir($handle)){ ! if(is_dir("$file") && $file != "." && $file != "..") { ! $handl=@opendir(getcwd() . "/$file/setup/"); ! while ($fil = @readdir($handl)){ ! if($fil != ".." && $fil != "." && $fil != "") { ! $filename = "../$file/setup/$fil"; ! ! ! $sqlf = str_replace(".", "-", str_replace(".mysql", "",substr(strrchr($filename, "/"), 1))); ! $dir = str_replace(".", "-", str_replace(".mysql", "", substr(strchr($filename, "/"), 1))); ! echo("<br /> <input type='checkbox' name='$dir'>$sqlf - $dir</input>"); ! if($_POST[$dir] == "on") { ! // This doesn't quite work. I'm not sure why. ! echo getcwd(); ! $filename = "$file/setup/$fil"; ! $sf = fopen($filename, "r"); ! $query = ""; ! while($line = fgets($sf, 4096)) { ! if(substr($line, 0, 2) != "--" && substr($line, 0, 1) != "#" && strlen($line) > 0) { ! echo $line; ! $q = mysql_query(trim($line)); ! } ! } ! echo(" - <b>Submitted, and added.</b>"); ! fclose($sf); ! $filename = "../$file/setup/$fil"; ! }} ! }} ! } ! ?> <br /><input type="submit" value="Create Tables" /> </form> ! <?php } } else { showlogin(); } + + include($footer); ?> |