[Openfirst-cvscommit] base/config first.php,1.44,1.45
Brought to you by:
xtimg
From: Astronouth7303 <ast...@us...> - 2005-01-06 23:25:22
|
Update of /cvsroot/openfirst/base/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16882/config Modified Files: first.php Log Message: Fixed syntax errors. WON'T WRITE GLOBALS.PHP!!! Index: first.php =================================================================== RCS file: /cvsroot/openfirst/base/config/first.php,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** first.php 29 Dec 2004 22:00:38 -0000 1.44 --- first.php 6 Jan 2005 23:25:06 -0000 1.45 *************** *** 37,40 **** --- 37,42 ---- } + var_export(isset($_POST['ostype'])); + if(isset($_POST["ostype"])) { include_once("./dbase.php"); *************** *** 53,117 **** ofirst_select_db($sqldatabase); ! function GetVarValue($var) { ! ob_Start(); ! var_export($var); $Value = ob_Get_Contents(); ! ob_End_Clean(); ! return $Value; ! } ! // They have submitted the form, write a new globals.php file and test // options. ! if(is_writable("./globals.php")) { ! $file = file_get_contents('./globals.tpl'); $cookielogins = ((isset($_POST["cookielogins"]) && $_POST["cookielogins"]=="yes") ? true : false); ! $allowreg = ((isset($_POST["allowreg"]) && $_POST["allowreg"]=="yes") ? true : false); if(! isset($_POST["peardb"])) { $_POST["peardb"] = false; } ! $find = array('%DBTYPE%', ! '%PEAR%', ! '%OS%', ! '%ENCRYPT%', ! '%TITLE%', ! '%VER%', ! '%DBSERVER%', ! '%DBUSER%', ! '%DBPASS%', ! '%DBNAME%' ! '%COOKIE%', ! '%REG%', ! '%HOME%', ! '%HEADER%', ! '%FOOTER%', ! '%MASTERMAIL%', ! '%BOTMAIL%', ! '%BASEPATH%', ! '%FBASEPATH%'); ! ! $replace = array(GetVarValue($_POST['dbasetype']), ! GetVarValue($_POST['peardb']), ! GetVarValue($_POST['ostype']), ! GetVarValue($_POST['encryption']), ! GetVarValue($_POST['title']), ! GetVarValue($_POST['version']), ! GetVarValue($_POST['sqlserver']), ! GetVarValue($_POST['sqluser']), ! GetVarValue($_POST['sqlpassword']), ! GetVarValue($_POST['sqldatabase']), ! GetVarValue($cookielogins), ! GetVarValue($allowreg), ! GetVarValue($_POST['home']), ! GetVarValue($_POST['header']), ! GetVarValue($_POST['footer']), ! GetVarValue($_POST['mailnotify']), ! GetVarValue($_POST['mailfrom']), ! GetVarValue($_POST['basepath']), ! GetVarValue($_POST['fbasepath'])); ! ! str_replace($find, $replace, $file); ! file_put_contents('./globals.php', $file); ! include("../config/globals.php"); ! include("$header"); ! echo("<h1>openFIRST Software Configured</h1> <p>If this page does not display errors elsewhere, then your openFIRST has now been successfully configured. If there are errors, check your configuration options and try again. You may now --- 55,121 ---- ofirst_select_db($sqldatabase); ! function GetVarValue($var) { ! ob_Start(); ! var_export($var); $Value = ob_Get_Contents(); ! ob_End_Clean(); ! return $Value; ! } ! // They have submitted the form, write a new globals.php file and test // options. ! if (is_writable("./globals.php")) { ! $file = file_get_contents('./globals.tpl'); $cookielogins = ((isset($_POST["cookielogins"]) && $_POST["cookielogins"]=="yes") ? true : false); ! $allowreg = ((isset($_POST["allowreg"]) && $_POST["allowreg"]=="yes") ? true : false); if(! isset($_POST["peardb"])) { $_POST["peardb"] = false; } ! $find = array('%DBTYPE%', ! '%PEAR%', ! '%OS%', ! '%ENCRYPT%', ! '%TITLE%', ! '%VER%', ! '%DBSERVER%', ! '%DBUSER%', ! '%DBPASS%', ! '%DBNAME%', ! '%COOKIE%', ! '%REG%', ! '%HOME%', ! '%HEADER%', ! '%FOOTER%', ! '%MASTERMAIL%', ! '%BOTMAIL%', ! '%BASEPATH%', ! '%FBASEPATH%'); ! ! $replace = array(GetVarValue($_POST['dbasetype']), ! GetVarValue($_POST['peardb']), ! GetVarValue($_POST['ostype']), ! GetVarValue($_POST['encryption']), ! GetVarValue($_POST['title']), ! GetVarValue($_POST['version']), ! GetVarValue($_POST['sqlserver']), ! GetVarValue($_POST['sqluser']), ! GetVarValue($_POST['sqlpassword']), ! GetVarValue($_POST['sqldatabase']), ! GetVarValue($cookielogins), ! GetVarValue($allowreg), ! GetVarValue($_POST['home']), ! GetVarValue($_POST['header']), ! GetVarValue($_POST['footer']), ! GetVarValue($_POST['mailnotify']), ! GetVarValue($_POST['mailfrom']), ! GetVarValue($_POST['basepath']), ! GetVarValue($_POST['fbasepath'])); ! ! str_replace($find, $replace, $file); ! $hfile = fopen('./globals.php'); ! fwrite($hfile, $file); ! fclose($hfile); ! include("../config/globals.php"); ! include("$header"); ! echo("<h1>openFIRST Software Configured</h1> <p>If this page does not display errors elsewhere, then your openFIRST has now been successfully configured. If there are errors, check your configuration options and try again. You may now *************** *** 120,124 **** <b>openfirst</b>, if not, then either the password for that account has been changed, or the MySQL settings are incorrect.</p>"); ! showlogin(); die(include("$footer")); } else { --- 124,128 ---- <b>openfirst</b>, if not, then either the password for that account has been changed, or the MySQL settings are incorrect.</p>"); ! showlogin(); die(include("$footer")); } else { *************** *** 138,143 **** <br />chmod 666 globals.php </code></p>"); ! } ! } else { if(is_readable("config/headers.php")) { include("config/headers.php"); --- 142,147 ---- <br />chmod 666 globals.php </code></p>"); ! } ! } else { if(is_readable("config/headers.php")) { include("config/headers.php"); *************** *** 145,227 **** include("../config/headers.php"); } ! ! // Detect default options ! $basepath = substr($_SERVER["SCRIPT_NAME"], 0, -17)); ! $server = $_SERVER["SERVER_NAME"]; ! $basepath = str_replace("\\", '/', getcwd()); ! chdir('..'); ! $fbasepath = str_replace("\\", '/', getcwd()); $windows = (isset($_ENV['OS']) && strpos(' ' . $_ENV['OS'], 'Windows')) ? true : false; ! $fd = explode(($windows ? ';' : ':'), ini_get('include_path')); ! ! $peardb = false; ! foreach($fd as $d) { ! if(file_exists("$d/DB.php")) { ! $peardb = true; ! } ! } ! ! $sqlhost = 'localhost'; ! if(ini_get('mysql.default_host') != '') { ! $sqlhost = ini_get('mysql.default_host'); ! } ! ! $sqluser = 'sqluser'; ! if(ini_get('mysql.default_user') != '') { ! $sqluser = ini_get('mysql.default_user'); ! } ! ! $sqlpass = ''; ! if(ini_get('mysql.default_password') != '') { ! $sqlpass = ini_get('mysql.default_password'); ! } ! ! $mailto = $_SERVER['SERVER_ADMIN']; ! $mailfrom = "openfirst@$server"; ! // User is visiting the configuration page, present them with a form // of options to fill out. ! ?> <h1>Base Configuration</h1> ! <p><form action="<?php echo htmlentities($_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 ($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 ($peardb) { ! echo ("<br />The PEAR Database Abstraction layer exists and will be used."); ! } ?> </td> ! <td><?php if(! $peardb) { ?> --- 149,248 ---- include("../config/headers.php"); } ! ! // Detect default options ! $basepath = substr($_SERVER["SCRIPT_NAME"], 0, -17); ! $server = 'http://'.$_SERVER["SERVER_NAME"]; ! chdir('..'); ! $fbasepath = str_replace("\\", '/', getcwd()); $windows = (isset($_ENV['OS']) && strpos(' ' . $_ENV['OS'], 'Windows')) ? true : false; ! ! if (!$windows) { ! $windows = (strstr(getcwd(), "\\")) ? true : false; ! } ! if (!$windows && isset($_SERVER['SERVER_SIGNATURE'])) { ! $windows = (strstr($_SERVER['SERVER_SIGNATURE'], '(win32)')) ? true : false; ! } ! if (!$windows && isset($_SERVER['PATH'])) { ! $windows = (strstr($_SERVER['PATH'], "\\")) ? true : false; ! } ! if (!$windows && isset($_SERVER['SystemRoot'])) { ! $windows = (strstr($_SERVER['SystemRoot'], "\\")) ? true : false; ! } ! if (!$windows && isset($_SERVER['SystemRoot'])) { ! $windows = (substr($_SERVER['SystemRoot'], 0, 1) == "C:") ? true : false; ! } ! ! $fd = explode(($windows ? ';' : ':'), ini_get('include_path')); ! ! $peardb = false; ! foreach($fd as $d) { ! if(file_exists("$d/DB.php")) { ! $peardb = true; ! } ! } ! ! $sqlhost = 'localhost'; ! if(ini_get('mysql.default_host') != '') { ! $sqlhost = ini_get('mysql.default_host'); ! } ! ! $sqluser = 'sqluser'; ! if(ini_get('mysql.default_user') != '') { ! $sqluser = ini_get('mysql.default_user'); ! } ! ! $sqlpass = ''; ! if(ini_get('mysql.default_password') != '') { ! $sqlpass = ini_get('mysql.default_password'); ! } ! ! $mailto = $_SERVER['SERVER_ADMIN']; ! $mailfrom = "openfirst@$server"; ! // User is visiting the configuration page, present them with a form // of options to fill out. ! ?> <h1>Base Configuration</h1> ! <p><form action="<?php echo htmlentities("$server$basepath"); ?>" method="post"> ! <!--form action="/globals.php" 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 ($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 ($peardb) { ! echo ("<br />The PEAR Database Abstraction layer exists and will be used."); ! } ?> </td> ! <td><?php if(! $peardb) { ?> *************** *** 231,239 **** <option value="mssql">Microsoft SQL</option> <option value="odbc">ODBC</option> ! </select> ! ! <?php } else { ! ?> <input type='hidden' name='peardb' value='true'> <select name="dbasetype"> --- 252,260 ---- <option value="mssql">Microsoft SQL</option> <option value="odbc">ODBC</option> ! </select> ! ! <?php } else { ! ?> <input type='hidden' name='peardb' value='true'> <select name="dbasetype"> *************** *** 253,311 **** </select> <?php ! } ?> ! <tr> <td>Title of Website</td> <td><input type="text" name="title" value="openFIRST" /></td> </tr> ! <tr> <td>Version of Website</td> <td><input type="text" name="version" value="1.0" /></td> </tr> ! <tr> <td>Database Server Address</td> <td><input type="text" name="sqlserver" value="<?php echo htmlentities($sqlhost); ?>" /></td> </tr> ! <tr> <td>Database User Name</td> <td><input type="text" name="sqluser" value="<?php echo htmlentities($sqluser); ?>" /></td> </tr> ! <tr> <td>Database User Password</td> <td><input type="password" name="sqlpassword" value="<?php echo htmlentities($sqlpass); ?>" /></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="openfirst" /></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 htmlentities("http://$server$basepath"); ?>" ></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 htmlentities($basepath); ?>/headers.php" /></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 htmlentities($basepath); ?>/footers.php" /></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 htmlentities($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 echo htmlentities($fbasepath); ?>"></td> --- 274,332 ---- </select> <?php ! } ?> ! <tr> <td>Title of Website</td> <td><input type="text" name="title" value="openFIRST" /></td> </tr> ! <tr> <td>Version of Website</td> <td><input type="text" name="version" value="1.0" /></td> </tr> ! <tr> <td>Database Server Address</td> <td><input type="text" name="sqlserver" value="<?php echo htmlentities($sqlhost); ?>" /></td> </tr> ! <tr> <td>Database User Name</td> <td><input type="text" name="sqluser" value="<?php echo htmlentities($sqluser); ?>" /></td> </tr> ! <tr> <td>Database User Password</td> <td><input type="password" name="sqlpassword" value="<?php echo htmlentities($sqlpass); ?>" /></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="openfirst" /></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 htmlentities("http://$server$basepath"); ?>" ></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 htmlentities($fbasepath); ?>/config/headers.php" /></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 htmlentities($fbasepath); ?>/config/footers.php" /></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 htmlentities($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 echo htmlentities($fbasepath); ?>"></td> *************** *** 315,322 **** <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> --- 336,343 ---- <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> *************** *** 330,334 **** <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> --- 351,355 ---- <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> *************** *** 340,358 **** <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 htmlentities($mailto); ?>"></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 htmlentities($mailfrom); ?>"></td> </tr> ! <tr> <td></td> <td><input type="submit" value="Set up OpenFIRST"></td> --- 361,379 ---- <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 htmlentities($mailto); ?>"></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 htmlentities($mailfrom); ?>"></td> </tr> ! <tr> <td></td> <td><input type="submit" value="Set up OpenFIRST"></td> |