[Openfirst-cvscommit] update selectinstalldir.php,1.1,1.2
Brought to you by:
xtimg
From: Tim G. <xt...@us...> - 2004-11-30 16:15:14
|
Update of /cvsroot/openfirst/update In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20562 Modified Files: selectinstalldir.php Log Message: Add some more steps towards a working configuration generator similar to first.php but done remotely. Index: selectinstalldir.php =================================================================== RCS file: /cvsroot/openfirst/update/selectinstalldir.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** selectinstalldir.php 19 Nov 2004 22:03:18 -0000 1.1 --- selectinstalldir.php 30 Nov 2004 16:14:59 -0000 1.2 *************** *** 23,26 **** --- 23,438 ---- echo "Install directory for $system->displayname updated."; mysql_query("UPDATE ofirst_systems SET installdirectory='" . $_REQUEST["dir"] . "' WHERE id='$system->id' AND owner='$user->id';"); + // Check whether an install is there or not. + if( + ftp_size($ftpreachable, $_REQUEST["dir"] . "/config/globals.php") == -1 + && ftp_size($ftpreachable, $_REQUEST["dir"] . "/config/globals-default.php") == -1 + ) { + echo "<p>There is not currently an openFIRST install in the directory."; + echo "<p>Please specify this configuration information:"; + + } else { + echo "<p>There is already an installation in that directory. + <p>Attempting to read the settings from that configuration... (please + verify these values:)"; + $syscfg = ""; + $cfg = fopen("ftp://" . $system->ftpusername . ":" . $system->ftppassword . "@" . $system->ftpserver . + substr($_REQUEST["dir"] . "/config/globals.php", 1), "r"); + if($cfg) { + while(! feof($cfg)) { + $line = fgets($cfg, 2048); + if(strpos($line, "dbasetype")) { + $lin = explode("\"", $line); + $syscfg->dbasetype = $lin[1]; + } elseif(strpos($line, "peardb = false")) { + $syscfg->peardb = 'false'; + } elseif(strpos($line, "peardb = true")) { + $syscfg->peardb = 'true'; + } elseif(strpos($line, "\$ostype = ")) { + $lin = explode("'", $line); + $syscfg->ostype = $lin[1]; + } elseif(strpos($line, "encryption")) { + $lin = explode("'", $line); + $syscfg->encryption = $lin[1]; + } elseif(strpos($line, "title")) { + $lin = explode("'", $line); + $syscfg->title = $lin[1]; + } elseif(strpos($line, "\$version")) { + $lin = explode("'", $line); + $syscfg->version = $lin[1]; + } elseif(strpos($line, "\$sqlserver = ")) { + $lin = explode("'", $line); + $syscfg->sqlserver = $lin[1]; + } elseif(strpos($line, "\$sqluser = ")) { + $lin = explode("'", $line); + $syscfg->sqluser = $lin[1]; + } elseif(strpos($line, "\$sqlpassword = ")) { + $lin = explode("'", $line); + $syscfg->sqlpassword = $lin[1]; + } elseif(strpos($line, "\$sqldatabase =")) { + $lin = explode("'", $line); + $syscfg->sqldatabase = $lin[1]; + } elseif(strpos($line, "regenabled=true")) { + $syscfg->regenabled = true; + } elseif(strpos($line, "regenabled=false")) { + $syscfg->regenabled = false; + } elseif(strpos($line, "\$home =")) { + $lin = explode("'", $line); + $syscfg->home = $lin[1]; + } elseif(strpos($line, "\$header = ")) { + $lin = explode("'", $line); + $syscfg->header = $lin[1]; + } elseif(strpos($line, "\$footer = ")) { + $lin = explode("'", $line); + $syscfg->footer = $lin[1]; + } elseif(strpos($line, "mailnotify")) { + $lin = explode("'", $line); + $syscfg->mailnotify = $lin[1]; + } elseif(strpos($line, "mailfrom")) { + $lin = explode("'", $line); + $syscfg->mailfrom = $lin[1]; + } elseif(strpos($line, "\$fbasepath =")) { + $lin = explode("'", $line); + $syscfg->fbasepath = $lin[1]; + } elseif(strpos($line, "\$basepath = ")) { + $lin = explode("'", $line); + $syscfg->basepath = $lin[1]; + } + + } + } else { + echo "Cannot open file"; + } + } + + // check if isset for each variable. + if(! isset($syscfg->dbasetype)) { + $syscfg->dbasetype = $system->dbasetype; + } + if(! isset($syscfg->peardb)) { + $syscfg->peardb = $system->peardb; + } + if(! isset($syscfg->ostype)) { + $syscfg->ostype = $system->ostype; + } + if(! isset($syscfg->encryption)) { + $syscfg->encryption = $system->encryption; + } + if(! isset($syscfg->title)) { + $syscfg->title = $system->title; + } + if(! isset($syscfg->version)) { + $syscfg->version = $system->version; + } + if(! isset($syscfg->sqlserver)) { + $syscfg->sqlserver = $system->sqlserver; + } + if(! isset($syscfg->sqluser)) { + $syscfg->sqluser = $system->sqluser; + } + if(! isset($syscfg->sqlpassword)) { + $syscfg->sqlpassword = $system->sqlpassword; + } + if(! isset($syscfg->sqldatabase)) { + $syscfg->sqldatabase = $system->sqldatabase; + } + if(! isset($syscfg->regenabled)) { + $syscfg->regenabled = $system->regenabled; + } + if(! isset($syscfg->home)) { + $syscfg->home = $system->home; + } + if(! isset($syscfg->header)) { + $syscfg->header = $system->header; + } + if(! isset($syscfg->footer)) { + $syscfg->footer = $system->footer; + } + if(! isset($syscfg->mailnotify)) { + $syscfg->mailnotify = $system->mailnotify; + } + if(! isset($syscfg->mailfrom)) { + $syscfg->mailfrom = $system->mailfrom; + } + if(! isset($syscfg->fbasepath)) { + $syscfg->fbasepath = $system->fbasepath; + } + if(! isset($syscfg->dbasetype)) { + $syscfg->basepath = $system->basepath; + } + + + // Very similar to first.php (submitting this form should update + // the database and create then upload a new globals.php file) + + + ?> + <h1>Base Configuration</h1> + <p><form action="<?php echo($_SERVER["PHP_SELF"]); ?>" method="post"> + Congratulations on your choice of openFIRST software. Please proceed through + this setup wizard to get your new openFIRST portal software set up and working + quickly and painlessly. Also please make sure that before installing this script + that you have the appropriate permissions set on config/globals.php (if not + then you may receive a collection of errors after submitting this form).<br> + <br> + <table width="608"> + <tr> + <th width="390">Option</th> + <th width="206">Value</th> + </tr> + <tr> + <td class="sub"><div align="center">Database Setup</div></td> + <td class="sub"> </td> + </tr> + <tr> + <td>Operating System of Web Server</td> + <td><select name="ostype"> + <?php + if ($syscfg->ostype == "windows") { + echo("<option value='unix'>UNIX</option> + <option value='windows' selected='selected'>Windows</option>"); + } else { + echo("<option value='unix' selected='selected'>UNIX</option> + <option value='windows'>Windows</option>"); + } + ?> + </select> <font size="2">(UNIX includes variants, such as Linux, Mac OS + X, and BeOS) </font></td> + </tr> + <tr> + <td>Database Type + <?php + if($syscfg->peardb == "true") { + echo ("<br>The PEAR Database Abstraction layer exists and will be used."); + } + ?> + </td> + <td><?php if(! $syscfg->peardb == "true") { ?> + <input type='hidden' name='peardb' value='false'> + <select name="dbasetype"> + <option value="mysql" + <?php if($syscfg->dbasetype == "mysql") { ?> selected="selected"<?php } ?> + >MySQL</option> + <option value="mssql" + <?php if($syscfg->dbasetype == "mssql") { ?> selected="selected"<?php } ?> + >Microsoft SQL</option> + <option value="odbc" + <?php if($syscfg->dbasetype == "odbc") { ?> selected="selected"<?php } ?> + >ODBC</option> + </select> + + <?php } else { ?> + <input type='hidden' name='peardb' value='true'> + <select name="dbasetype"> + <option value="dbase" + <?php if($syscfg->dbasetype == "dbase") { ?> selected="selected"<?php } ?> + + >dBase (through PEAR DB)</option> + <option value="fbsql" + <?php if($syscfg->dbasetype == "fbsql") { ?> selected="selected"<?php } ?> + + >FrontBase (through PEAR DB)</option> + <option value="ibase" + <?php if($syscfg->dbasetype == "ibase") { ?> selected="selected"<?php } ?> + + >InterBase (through PEAR DB)</option> + <option value="ifx" + <?php if($syscfg->dbasetype == "ifx") { ?> selected="selected"<?php } ?> + + >Informix (through PEAR DB)</option> + <option value="msql" + <?php if($syscfg->dbasetype == "msql") { ?> selected="selected"<?php } ?> + + >Mini SQL (through PEAR DB)</option> + <option value="mssql" + <?php if($syscfg->dbasetype == "mssql") { ?> selected="selected"<?php } ?> + + >Microsoft SQL Server (through PEAR DB)</option> + <option value="mysql" + <?php if($syscfg->dbasetype == "mysql") { ?> selected="selected"<?php } ?> + + >MySQL (for servers running MySQL <= 4.0) (through PEAR DB)</option> + <option value="mysqli" + <?php if($syscfg->dbasetype == "mysqli") { ?> selected="selected"<?php } ?> + + >MySQL (for servers running MySQL >= 4.1) (through PEAR DB)</option> + <option value="oci8" + <?php if($syscfg->dbasetype == "oci8") { ?> selected="selected"<?php } ?> + + >Oracle 7/8/9 (through PEAR DB)</option> + <option value="odbc" + <?php if($syscfg->dbasetype == "odbc") { ?> selected="selected"<?php } ?> + + >ODBC (Open Database Connectivity) (through PEAR DB)</option> + <option value="pgsql" + <?php if($syscfg->dbasetype == "pgsql") { ?> selected="selected"<?php } ?> + >PostgreSQL (through PEAR DB)</option> + <option value="sqlite" + <?php if($syscfg->dbasetype == "sqlite") { ?> selected="selected"<?php } + ?> + + >SQLite (through PEAR DB)</option> + <option value="sybase" + <?php if($syscfg->dbasetype == "sybase") { ?> selected="selected"<?php } + ?> + + >Sybase (through PEAR DB)</option> + </select> + <?php } ?> + <tr> + <td>Title of Website</td> + <td><input type="text" name="title" value="<?php echo $syscfg->title; ?>" /></td> + </tr> + <tr> + <td>Version of Website</td> + <td><input type="text" name="version" value="<?php echo $syscfg->version; ?>" /></td> + </tr> + <tr> + <td>Database Server Address</td> + <td><input type="text" name="sqlserver" value="<?php + echo $syscfg->sqlserver; ?>" /></td> + </tr> + <tr> + <td>Database User Name</td> + <td><input type="text" name="sqluser" value="<?php + echo($syscfg->sqluser); + ?>" /></td> + </tr> + <tr> + <td>Database User Password</td> + <td><input type="password" name="sqlpassword" value="<?php + echo $syscfg->sqlpassword; + ?>" /></td> + </tr> + <tr> + <td>Database Name<br> <font size="1">(if this database does not already exist, the user entered above + must have access to create it)</font></td> + <td><input type="text" name="sqldatabase" value="<?php + echo $syscfg->sqldatabase; + ?>" /></td> + </tr> + <tr> + <td class="sub"><div align="center">Linking Options</div></td> + <td class="sub"> </td> + </tr> + <tr> + <td>Home Site<br> <font size="1">(the address scripts will use for linking + to your main page) <em>Note:</em> Do not place a slash after the link + ie. http://www.yoursite.com</font></td> + <td> <input type="text" name="home" value="<?php echo($syscfg->home); ?>" ></td> + </tr> + <tr> + <td>Header file<br> <font size="1">(this should be a full system path) ie. + c:\inetpub\wwwroot\openfirst\config\header.php or /home/site/public_html/openfirst/config/headers.php</font></td> + <td><input type="text" name="header" value="<?php echo($syscfg->header); ?>" /></td> + </tr> + <tr> + <td>Footer file<br> <font size="1">(this should be a full system path) ie. + c:\inetpub\wwwroot\openfirst\config\footers.php or /home/site/public_html/openfirst/config/footers.php</font></td> + <td><input type="text" name="footer" value="<?php + echo($syscfg->footer); ?>" /></td> + </tr> + <tr> + <td>The base path to the openFIRST software<br> <font size="1">ie. example: + http://openfirst.sourceforge.net<strong>/openfirst</strong>) this should + always have a beginning slash but no ending slash.</font></td> + <td><input type="text" name="basepath" value="<?php echo($syscfg->basepath); ?>"></td> + </tr> + <tr> + <td>The file system path to the basepath<br> <font size="1">(example: <strong>/home/openfirst/htdocs/openfirst</strong> + or c:\inetpub\wwwroot\openfirst) this should not have a ending slash.</font></td> + <td><input type="text" name="fbasepath" value="<?php $syscfg->fbasepath; ?>"></td> + </tr> + <tr> + <td class="sub"><div align="center">Security Options</div></td> + <td class="sub"> </td> + </tr> + <tr> + <td>Type of encryption to use on database passwords?<br> + <font size="1">If you are migrating from an existing system, this should be the same encryption + style that system uses, otherwise all users will have to reset their password; otherwise, in + most cases the default option is fine.</font></td> + <td> + <select name="encryption"> + <option value='md5' + <?php if($syscfg->encryption == "md5") { ?> selected='selected' <?php } ?> + + >MD5 Message-Digest Algorithm</option> + <option value='crypt' + <?php if($syscfg->encryption == "crypt") { ?> selected='selected' <?php } ?> + + >Standard Unix DES-based encryption algorthm</option> + <option value='crc32' + <?php if($syscfg->encryption == "crc32") { ?> selected='selected' <?php } ?> + + >crc32 Polynomial</option> + <option value='sha1' + <?php if($syscfg->encryption == "sha1") { ?> selected='selected' <?php } ?> + + >US Secure Hash Algorithm 1 (sha1)</option> + </select> + </td></tr> + <td>Allow openFIRST users to save their passwords?<br> <font size="1">This feature uses cookies to + automatically log in users into the openFIRST portal.</font></td> + <td><input type="checkbox" name="cookielogins" id="cookielogins" value="yes" checked> + <label for="cookielogins">Allowed</label></td> + </tr> + <tr> + <td>Allow users to register on the portal?<br> <font size="1">Enabling this option will + allow users to register on the website and log in to access the members area. Be careful when + using this option.</font></td> + <td><input type="checkbox" name="allowreg" id="allowreg" value="yes" + <?php if($syscfg->regenabled == "true") { echo "checked='checked'"; } ?>> + <label for="allowreg">Allowed</label></td> + </tr> + <tr> + <td class="sub"><div align="center">Mailing Options</div></td> + <td class="sub"> </td> + </tr> + <tr> + <td>Mail Notification<br> <font size="1">(the e-mail address used to notify + you when significant events occur)</font></td> + <td><input type="text" name="mailnotify" value="<?php echo + $syscfg->mailnotify; ?>"></td> + </tr> + <tr> + <td>Mail From<br> <font size="1">(the e-mail address that mail from the + openFIRST site should appear to be from)</font></td> + <td><input type="text" name="mailfrom" value="<?php + echo $syscfg->mailfrom; + ?>"></td> + </tr> + <tr> + <td></td> + <td><input type="submit" value="Set up OpenFIRST"></td> + </tr> + </table> + </form> + + + + + <?php + + + + + + + + + + + + + + + + + + + + + + include_once($footer); die(); |