[Openfirst-cvscommit] base/config install.php,1.20,1.21
Brought to you by:
xtimg
From: Astronouth7303 <ast...@us...> - 2005-05-15 20:17:44
|
Update of /cvsroot/openfirst/base/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26491/config Modified Files: install.php Log Message: New Module system Index: install.php =================================================================== RCS file: /cvsroot/openfirst/base/config/install.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** install.php 15 May 2005 05:25:57 -0000 1.20 --- install.php 15 May 2005 20:17:03 -0000 1.21 *************** *** 39,114 **** <h1>Module Installer</h1> <p>This utility will create the tables required for certain openFIRST components ! to run.<br> ! Select the modules you would like to install.<br> ! <br> ! <font color="#FF0000">Once installed, modules must be enabled from the <a href="modules.php"><strong>Module ! Administrator</strong></a>.</font></p> <form method="post" action="install.php"> <table> ! <tr><th>Module Name</th><th>Response</th></tr> <?php ! if(function_exists("glob")) { ! $files = glob("../*/openfirst.info.php"); ! if (count($files) < 1) { ! ?> ! <p>You have no modules to install or are misconfigured. You can go to <a href="http://www.openfirst.org/">openFIRST.org</a> to download them.</p> ! <?php ! die(include($footer)); ! } ! foreach ($files as $filename) { ! $sqlf = str_replace(".", "-", str_replace(".$dbasetype", "",substr(strrchr($filename, "/"), 1))); ! $dir = str_replace(".", "-", str_replace(".$dbasetype", "", substr(strchr($filename, "/"), 1))); ! echo("<tr><td><br /> <input type='checkbox' name='$dir'>$sqlf - $dir</input></td>"); ! if(isset($_POST[$dir]) == true && $_POST[$dir] == "on") { ! $sf = fopen($filename, "r"); ! $query = ""; ! while($line = fgets($sf)) { ! if(substr($line, 0, 2) != "--" && substr($line, 0, 1) != "#" && strlen($line) > 0) { ! $q = ofirst_dbquery(trim($line)); ! } ! } ! fclose($sf); ! echo("<td><b><font color='Green'>Module Installed</font></b></td></tr>"); ! }else{ ! echo "<td>--</td></tr>"; ! } ! } ! } 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 != "" && strpos($fil, $dbasetype) > 0) { ! $filename = "../$file/setup/$fil"; ! $sqlf = str_replace(".", "-", str_replace(".$dbasetype", "",substr(strrchr($filename, "/"), 1))); ! $dir = str_replace(".", "-", str_replace(".$dbasetype", "", substr(strchr($filename, "/"), 1))); ! echo("<br /> <input type='checkbox' name='$dir'>$sqlf - $dir</input>"); ! if(isset($_POST[$dir]) == true && $_POST[$dir] == "on") { ! $q = ofirst_dbquery("CREATE table IF NOT EXISTS `ofirst_config` (`modulename` CHAR(25) NOT NULL, ! `showonmenu` BOOL, `active` BOOL, `adminnavigation` TEXT, ! `modulenavigation` TEXT, `includes` TEXT, PRIMARY KEY (`modulename`));"); ! $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) { ! $q = ofirst_dbquery(trim($line)); ! } ! } ! echo(" - <b>Submitted, and added.</b>"); ! fclose($sf); ! $filename = "../$file/setup/$fil"; ! } ! } ! } ! } } } --- 39,97 ---- <h1>Module Installer</h1> <p>This utility will create the tables required for certain openFIRST components ! to run.<br /> ! Select the modules you would like to install.<br /> ! <br /> ! <span style="color:red;">Once installed, modules must be enabled from the <a href="modules.php"><strong>Module ! Administrator</strong></a>.</span></p> <form method="post" action="install.php"> <table> ! <colgroup> ! <col /> ! <col /> ! <col class="file" /> ! </colgroup> ! <colgroup> ! <col /> ! </colgroup> ! <thead> ! <tr><th colspan="3">Module Name</th><th>Status</th></tr> ! </thead> ! <tbody> <?php ! $files = glob("$fbasepath/*/openfirst.info.php"); ! if (count($files) < 1) { ! ?> ! <p class="error">You have no modules to install or are misconfigured. You can go to <a href="http://www.openfirst.org/">openFIRST.org</a> to download them.</p> ! <?php ! die(include($footer)); ! } ! $InstalledModules = $Modules; ! # Get the meta data ! foreach ($files as $filename) { ! include($filename); ! } ! foreach($Modules as $code => $info) { ! $dir = "$fbasepath/$code"; ! $sqlf = "$dir/setup.$dbasetype"; ! $IsInstalled = array_key_exists($code, $InstalledModules); ! echo '<tr><td><input type="checkbox" name="'.htmlentities($code).'" '; ! if ($IsInstalled) echo 'checked="checked" '; ! echo '/><label for="'.htmlentities($code).'">'.htmlentities($info['name']).'</label></td> ! <td>('.htmlentities($info['ver']).')'.'</td> ! <td>'.htmlentities($code)."</td>"; ! if(isset($_POST[$code]) == true && $_POST[$code] == "on" && !$IsInstalled) { ! ! ofirst_dbexec_file($sqlf); ! echo('<td style="background-color: lime; color:white; font-weight:bold;">Module Installed successfully!</td></tr>'); ! } else if ($IsInstalled) { ! echo('<td style="background-color: green; color:white;">Module Installed</td></tr>'); ! } else { ! echo('<td style="background-color: gray; color:white;">Module available</td></tr>'); } } |