From: <lin...@us...> - 2010-05-01 07:23:53
|
Revision: 3436 http://web-erp.svn.sourceforge.net/web-erp/?rev=3436&view=rev Author: lindsayh Date: 2010-05-01 07:23:47 +0000 (Sat, 01 May 2010) Log Message: ----------- Can now upload a logo image file during install. Changed email address validation to more sophisticated/accurate one. Modified Paths: -------------- trunk/doc/Change.log.html trunk/install/index.php trunk/install/save.php Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-04-30 10:57:35 UTC (rev 3435) +++ trunk/doc/Change.log.html 2010-05-01 07:23:47 UTC (rev 3436) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>01/05/10 Lindsay: Install now includes an option to install a logo.jpg file <p>30/04/10 Lindsay: Make installation operation functional again <p>29/04/10 Tim Schofield: SelectOrderItems.php : Ensure PO line number is carried through from quck entry screen.</p> <p>29/04/10 Tim Schofield: SelectOrderItems.php : LastCustomer was not being initialised.</p> Modified: trunk/install/index.php =================================================================== --- trunk/install/index.php 2010-04-30 10:57:35 UTC (rev 3435) +++ trunk/install/index.php 2010-05-01 07:23:47 UTC (rev 3436) @@ -72,7 +72,7 @@ </tr> </table> -<form name="weberp_installation_wizard" action="save.php" method="post"> +<form name="weberp_installation_wizard" action="save.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="url" value="" /> <input type="hidden" name="password_fieldname" value="admin_password" /> <input type="hidden" name="remember" id="remember" value="true" /> @@ -164,7 +164,7 @@ $guessed_url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]; $guessed_url = rtrim(dirname($guessed_url), 'install'); ?> - <input type="text" tabindex="1" name="ba_url" style="width: 99%;" value="<?php if(isset($_SESSION['ba_url'])) { echo $_SESSION['ba_url']; } else { echo $guessed_url; } ?>" /> + <input type="text" tabindex="30" name="ba_url" style="width: 99%;" value="<?php if(isset($_SESSION['ba_url'])) { echo $_SESSION['ba_url']; } else { echo $guessed_url; } ?>" /> </td> </tr> </table> @@ -177,10 +177,10 @@ Server Operating System: </td> <td width="180"> - <input type="radio" tabindex="4" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux"<?php if(!isset($_SESSION['operating_system']) OR $_SESSION['operating_system'] == 'linux') { echo ' checked'; } ?> /> + <input type="radio" tabindex="40" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux"<?php if(!isset($_SESSION['operating_system']) OR $_SESSION['operating_system'] == 'linux') { echo ' checked'; } ?> /> <font style="cursor: pointer;" onclick="javascript: change_os('linux');">Linux/Unix based</font> <br /> - <input type="radio" tabindex="5" name="operating_system" id="operating_system_windows" onclick="document.getElementById('file_perms_box').style.display = 'none';" value="windows"<?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo ' checked'; } ?> /> + <input type="radio" tabindex="41" name="operating_system" id="operating_system_windows" onclick="document.getElementById('file_perms_box').style.display = 'none';" value="windows"<?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo ' checked'; } ?> /> <font style="cursor: pointer;" onclick="javascript: change_os('windows');">Windows</font> </td> <td> @@ -191,7 +191,7 @@ } ?> ;"> - <input type="checkbox" tabindex="6" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked'; } ?> /> + <input type="checkbox" tabindex="42" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked'; } ?> /> <label for="world_writeable"> World-writeable file permissions (777) </label> @@ -208,7 +208,7 @@ <tr> <td width="120" style="color: #666666;">Host Name:</td> <td width="230"> - <input type="text" tabindex="7" name="database_host" style="width: 98%;" value="<?php if(isset($_SESSION['database_host'])) { + <input type="text" tabindex="43" name="database_host" style="width: 98%;" value="<?php if(isset($_SESSION['database_host'])) { echo $_SESSION['database_host']; } else { echo 'localhost'; @@ -217,7 +217,7 @@ <td width="7"> </td> <td width="70" style="color: #666666;">Username:</td> <td> - <input type="text" tabindex="9" name="database_username" style="width: 98%;" value="<?php if(isset($_SESSION['database_username'])) { + <input type="text" tabindex="44" name="database_username" style="width: 98%;" value="<?php if(isset($_SESSION['database_username'])) { echo $_SESSION['database_username']; } else { echo 'root'; @@ -231,7 +231,7 @@ <td> </td> <td style="color: #666666;">Password:</td> <td> - <input type="password" tabindex="10" name="database_password" style="width: 98%;"<?php if(isset($_SESSION['database_password'])) { + <input type="password" tabindex="45" name="database_password" style="width: 98%;"<?php if(isset($_SESSION['database_password'])) { echo ' value = "'.$_SESSION['database_password'].'"'; } ?> /> </td> @@ -239,7 +239,7 @@ <tr> <td colspan="2"> - <input type="checkbox" tabindex="12" name="install_tables" id="install_tables" value="true"<?php if(!isset($_SESSION['install_tables'])) { + <input type="checkbox" tabindex="46" name="install_tables" id="install_tables" value="true"<?php if(!isset($_SESSION['install_tables'])) { echo ' checked'; } elseif($_SESSION['install_tables'] == 'true') { echo ' checked'; @@ -255,7 +255,7 @@ <tr> <td style="color: #666666;" colspan="1">Company Name:</td> <td colspan="4"> - <input type="text" tabindex="13" name="company_name" style="width: 99%;" value="<?php if(isset($_SESSION['company_name'])) { echo $_SESSION['company_name']; } else { echo 'weberpdemo'; } ?>" /> + <input type="text" tabindex="50" name="company_name" style="width: 99%;" value="<?php if(isset($_SESSION['company_name'])) { echo $_SESSION['company_name']; } else { echo 'weberpdemo'; } ?>" /> </td> </tr> <tr> @@ -264,7 +264,7 @@ </td> <td width="180"> - <input type="checkbox" tabindex="14" name="DemoData" id="db_file_demo" value="demo"<?php if(!isset($_SESSION['db_file']) OR $_SESSION['db_file'] == 'demo') { echo ' checked'; } ?> /> + <input type="checkbox" tabindex="51" name="DemoData" id="db_file_demo" value="demo"<?php if(!isset($_SESSION['db_file']) OR $_SESSION['db_file'] == 'demo') { echo ' checked'; } ?> /> <font style="cursor: pointer;" onclick="javascript: change_data('demo');">weberpdemo company</font> </td> </tr> @@ -274,7 +274,7 @@ </td> <td width="180"> - <SELECT name='timezone'> + <SELECT name='timezone' tabindex="52"> <?php include('timezone.php'); ?> @@ -283,29 +283,38 @@ </td> </tr> <tr> + <td width="170"> + Logo Image File (.jpg) + </td> + + <td width="180"> + <input type="FILE" size="50" ID="LogoFile" name="LogoFile" tabindex="53"> + </td> + </tr> + <tr> <td colspan="5"><h1>Step 6</h1>Please enter your Administrator account details below...</td> </tr> <tr> <td style="color: #666666;">Username:</td> <td> admin - <!--<input type="text" tabindex="14" name="admin_username" style="width: 98%;" value="<?php if(isset($_SESSION['admin_username'])) { echo $_SESSION['admin_username']; } else { echo 'admin'; } ?>" />--> + <!--<input type="text" tabindex="60" name="admin_username" style="width: 98%;" value="<?php if(isset($_SESSION['admin_username'])) { echo $_SESSION['admin_username']; } else { echo 'admin'; } ?>" />--> </td> <td> </td> <td style="color: #666666;">Password:</td> <td> - <input type="password" tabindex="16" name="admin_password" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> /> + <input type="password" tabindex="62" name="admin_password" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> /> </td> </tr> <tr> <td style="color: #666666;">Email:</td> <td> - <input type="text" tabindex="15" name="admin_email" style="width: 98%;"<?php if(isset($_SESSION['admin_email'])) { echo ' value = "'.$_SESSION['admin_email'].'"'; } ?> /> + <input type="text" tabindex="61" name="admin_email" style="width: 98%;"<?php if(isset($_SESSION['admin_email'])) { echo ' value = "'.$_SESSION['admin_email'].'"'; } ?> /> </td> <td> </td> <td style="color: #666666;">Re-Password:</td> <td> - <input type="password" tabindex="17" name="admin_repassword" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> /> + <input type="password" tabindex="63" name="admin_repassword" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> /> </td> </tr> @@ -319,7 +328,7 @@ <td>Please note: </td> <td> WebERP is released under the - <a href="http://www.gnu.org/licenses/gpl.html" target="_blank" tabindex="19">GNU General Public License</a> + <a href="http://www.gnu.org/licenses/gpl.html" target="_blank" tabindex="64">GNU General Public License</a> <br /> By clicking install, you are accepting the license. </td> Modified: trunk/install/save.php =================================================================== --- trunk/install/save.php 2010-04-30 10:57:35 UTC (rev 3435) +++ trunk/install/save.php 2010-05-01 07:23:47 UTC (rev 3436) @@ -104,7 +104,61 @@ } function is_valid_email($email) { - return preg_match("/[a-zA-Z0-9_.+-]+@[a-zA-Z0-9_.-]+.[a-zA-Z]+/", $email) > 0; + $atIndex = strrpos ($email, "@"); + if ($atIndex === false) + { + return false; // No @ sign is not acceptable. + } + + if (preg_match('/\\.\\./', $email)) + return false; // > 1 consecutive dot is not allowed. + + // Check component length limits + $domain = substr ($email, $atIndex+1); + $local = substr ($email, 0, $atIndex); + $localLen = strlen ($local); + $domainLen = strlen ($domain); + if ($localLen < 1 || $localLen > 64) + { + // local part length exceeded + return false; + } + if ($domainLen < 1 || $domainLen > 255) + { + // domain part length exceeded + return false; + } + + if ($local[0] == '.' || $local[$localLen-1] == '.') + { + // local part starts or ends with '.' + return false; + } + if (!preg_match ('/^[A-Za-z0-9\\-\\.]+$/', $domain )) + { + // character not valid in domain part + return false; + } + if (!preg_match ('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', + str_replace ("\\\\", "" ,$local ) )) + { + // character not valid in local part unless local part is quoted + if (!preg_match ('/^"(\\\\"|[^"])+"$/', + str_replace("\\\\", "", $local) )) + { + return false; + } + } + + // Check for a DNS 'MX' or 'A' record. + // Windows supported from PHP 5.3.0 on - so check. + $ret = true; + if (version_compare(PHP_VERSION, '5.3.0') >= 0 + || strtoupper(substr(PHP_OS, 0, 3) !== 'WIN')) { + $ret = checkdnsrr( $domain, "MX" ) || checkdnsrr( $domain, "A" ); + } + + return $ret; } if (isset($_POST['path_to_root'])) { @@ -188,6 +242,8 @@ set_error('Please enter timezone'); } +// Use webERP logo if none supplied. + // Check if the user has entered a correct path if (!file_exists($path_to_root.'/sql/mysql/weberp-demo.sql')){ set_error('It appears the Absolute path that you entered is incorrect'); @@ -216,15 +272,26 @@ $config_filename = $path_to_root . '/config.php'; // only make a new company directory structure if we are kicking off a new company // no need to bother if just setting up the demo data +$CompanyDir = $path_to_root . '/companies/' . $_POST['company_name']; if ($_POST['DemoData']==false){ - $Result = mkdir($path_to_root . '/companies/' . $_POST['company_name']); - $Result = mkdir($path_to_root . '/companies/' . $_POST['company_name'] . '/part_pics'); - $Result = mkdir($path_to_root . '/companies/' . $_POST['company_name'] . '/EDI_Incoming_Orders'); - $Result = mkdir($path_to_root . '/companies/' . $_POST['company_name'] . '/reports'); - $Result = mkdir($path_to_root . '/companies/' . $_POST['company_name'] . '/EDI_Sent'); - $Result = mkdir($path_to_root . '/companies/' . $_POST['company_name'] . '/EDI_Pending'); - $Result = mkdir($path_to_root . '/companies/' . $_POST['company_name'] . '/reportwriter'); - $Result = mkdir($path_to_root . '/companies/' . $_POST['company_name'] . '/pdf_append'); + $Result = mkdir($CompanyDir ); + $Result = mkdir($CompanyDir . '/part_pics'); + $Result = mkdir($CompanyDir . '/EDI_Incoming_Orders'); + $Result = mkdir($CompanyDir . '/reports'); + $Result = mkdir($CompanyDir . '/EDI_Sent'); + $Result = mkdir($CompanyDir . '/EDI_Pending'); + $Result = mkdir($CompanyDir . '/reportwriter'); + $Result = mkdir($CompanyDir . '/pdf_append'); + + // Now have a destination to place the logo image. + if (isset($_FILES['LogoFile']) && + $_FILES['LogoFile']['error'] == UPLOAD_ERR_OK) { + $result = move_uploaded_file($_FILES['LogoFile']['tmp_name'], + $CompanyDir . '/logo.jpg'); + } else { + // No logo file, so use the default. + copy( $path_to_root . '/logo_server.jpg', $CompanyDir . '/logo.jpg'); + } } //Need to get the new version number This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |