install.php
changeset 272 27f5ac58992c
parent 269 4da2dfc28728
child 285 e72bf2c24875
equal deleted inserted replaced
271:4e26d6079910 272:27f5ac58992c
   493   
   493   
   494   $admin_user = $_POST['admin_user'];
   494   $admin_user = $_POST['admin_user'];
   495   $admin_user = str_replace('_', ' ', $admin_user);
   495   $admin_user = str_replace('_', ' ', $admin_user);
   496   $admin_user = $db->escape($admin_user);
   496   $admin_user = $db->escape($admin_user);
   497   
   497   
   498   switch ( $_POST['db_driver'] )
   498   $schema = file_get_contents('schema.sql');
   499   {
       
   500     case 'mysql':
       
   501       $schema_file = 'schema.sql';
       
   502       break;
       
   503     case 'postgresql':
       
   504       $schema_file = 'schema-pg.sql';
       
   505       break;
       
   506   }
       
   507   
       
   508   if ( !isset($schema_file) )
       
   509     die('insanity');
       
   510   
       
   511   $schema = file_get_contents($schema_file);
       
   512   $schema = str_replace('{{SITE_NAME}}',    $db->escape($_POST['sitename']   ), $schema);
   499   $schema = str_replace('{{SITE_NAME}}',    $db->escape($_POST['sitename']   ), $schema);
   513   $schema = str_replace('{{SITE_DESC}}',    $db->escape($_POST['sitedesc']   ), $schema);
   500   $schema = str_replace('{{SITE_DESC}}',    $db->escape($_POST['sitedesc']   ), $schema);
   514   $schema = str_replace('{{COPYRIGHT}}',    $db->escape($_POST['copyright']  ), $schema);
   501   $schema = str_replace('{{COPYRIGHT}}',    $db->escape($_POST['copyright']  ), $schema);
   515   $schema = str_replace('{{ADMIN_USER}}',   $admin_user                                    , $schema);
   502   $schema = str_replace('{{ADMIN_USER}}',   $admin_user                                    , $schema);
   516   $schema = str_replace('{{ADMIN_PASS}}',   $db->escape($admin_pass          ), $schema);
   503   $schema = str_replace('{{ADMIN_PASS}}',   $db->escape($admin_pass          ), $schema);
  1247     }
  1234     }
  1248     ?>
  1235     ?>
  1249     <?php
  1236     <?php
  1250     break;
  1237     break;
  1251   case "database":
  1238   case "database":
  1252     echo '<h3>Choose a database driver</h3>';
       
  1253     echo '<p>The next step is to choose the database driver that Enano will use. In most cases this is MySQL, but there are certain
       
  1254              advantages to PostgreSQL, which is made available only experimentally.</p>';
       
  1255     if ( @file_exists('/etc/enano-is-virt-appliance') )
       
  1256     {
       
  1257       echo '<p><b>You\'re using the Enano virtual appliance.</b><br />Unless you configured the appliance manually, PostgreSQL support is not available. In 99% of cases you\'ll want to click MySQL below.</p>';
       
  1258     }
       
  1259     
       
  1260     $mysql_disable_reason = '';
       
  1261     $pgsql_disable_reason = '';
       
  1262     $mysql_disable = '';
       
  1263     $pgsql_disable = '';
       
  1264     if ( !function_exists('mysql_connect') )
       
  1265     {
       
  1266       $mysql_disable = ' disabled="disabled"';
       
  1267       $mysql_disable_reason = 'You don\'t have the MySQL PHP extension installed.';
       
  1268     }
       
  1269     if ( !function_exists('pg_connect') )
       
  1270     {
       
  1271       $pgsql_disable = ' disabled="disabled"';
       
  1272       $pgsql_disable_reason = 'You don\'t have the PostgreSQL PHP extensnion installed.';
       
  1273     }
       
  1274     if ( function_exists('pg_connect') && version_compare(PHP_VERSION, '5.0.0', '<') )
       
  1275     {
       
  1276       $pgsql_disable = ' disabled="disabled"';
       
  1277       $pgsql_disable_reason = 'You need to have at least PHP 5 to use the PostgreSQL database driver.';
       
  1278     }
       
  1279     
       
  1280     echo '<form action="install.php" method="get">';
       
  1281     ?>
       
  1282     <table border="0" cellspacing="5">
       
  1283       <tr>
       
  1284         <td>
       
  1285           <input type="image" name="mode" value="database_mysql" src="images/about-powered-mysql.png"<?php echo $mysql_disable; ?>/>
       
  1286         </td>
       
  1287         <td<?php if ( $mysql_disable ) echo ' style="opacity: 0.5; filter: alpha(opacity=50);"'; ?>>
       
  1288           <b>MySQL</b><br />
       
  1289           Click this button to use MySQL as the database backend for your site. Most web hosts support MySQL, and if you have
       
  1290           administrative access to your MySQL server, you can create a new database and user during this installation process if you
       
  1291           haven't done so already.
       
  1292           <?php
       
  1293           if ( $mysql_disable )
       
  1294           {
       
  1295             echo "<br /><br /><b>$mysql_disable_reason</b>";
       
  1296           }
       
  1297           ?>
       
  1298         </td>
       
  1299       </tr>
       
  1300       <tr>
       
  1301         <td>
       
  1302           <input type="image" name="mode" value="database_pgsql" src="images/about-powered-pgsql.png"<?php echo $pgsql_disable; ?> />
       
  1303         </td>
       
  1304         <td<?php if ( $pgsql_disable ) echo ' style="opacity: 0.5; filter: alpha(opacity=50);"'; ?>>
       
  1305           <b>PostgreSQL</b><br />
       
  1306           Click this button to use PostgreSQL as the database backend for your site. While not as widely supported, PostgreSQL has more
       
  1307           liberal licensing conditions and when properly configured is faster than MySQL. Some plugins may not work with the PostgreSQL
       
  1308           driver.
       
  1309           <?php
       
  1310           if ( $pgsql_disable )
       
  1311           {
       
  1312             echo "<br /><br /><b>$pgsql_disable_reason</b>";
       
  1313           }
       
  1314           ?>
       
  1315         </td>
       
  1316       </tr>
       
  1317     </table>
       
  1318     <?php
       
  1319     echo '</form>';
       
  1320     break;
       
  1321   case "database_mysql":
       
  1322     ?>
  1239     ?>
  1323     <script type="text/javascript">
  1240     <script type="text/javascript">
  1324       function ajaxGet(uri, f) {
  1241       function ajaxGet(uri, f) {
  1325         if (window.XMLHttpRequest) {
  1242         if (window.XMLHttpRequest) {
  1326           ajax = new XMLHttpRequest();
  1243           ajax = new XMLHttpRequest();
  1524     {
  1441     {
  1525       echo '<p><b>MySQL login information for this virtual appliance:</b><br /><br />Database hostname: localhost<br />Database login: username "enano", password: "clurichaun" (without quotes)<br />Database name: enano_www1</p>';
  1442       echo '<p><b>MySQL login information for this virtual appliance:</b><br /><br />Database hostname: localhost<br />Database login: username "enano", password: "clurichaun" (without quotes)<br />Database name: enano_www1</p>';
  1526     }
  1443     }
  1527     ?>
  1444     ?>
  1528     <form name="dbinfo" action="install.php?mode=website" method="post">
  1445     <form name="dbinfo" action="install.php?mode=website" method="post">
  1529       <input type="hidden" name="db_driver" value="mysql" />
       
  1530       <table border="0">
  1446       <table border="0">
  1531         <tr><td colspan="3" style="text-align: center"><h3>Database information</h3></td></tr>
  1447         <tr><td colspan="3" style="text-align: center"><h3>Database information</h3></td></tr>
  1532         <tr><td><b>Database hostname</b><br />This is the hostname (or sometimes the IP address) of your MySQL server. In many cases, this is "localhost".<br /><span style="color: #993300" id="e_db_host"></span></td><td><input onkeyup="verify();" name="db_host" size="30" type="text" /></td><td><img id="s_db_host" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
  1448         <tr><td><b>Database hostname</b><br />This is the hostname (or sometimes the IP address) of your MySQL server. In many cases, this is "localhost".<br /><span style="color: #993300" id="e_db_host"></span></td><td><input onkeyup="verify();" name="db_host" size="30" type="text" /></td><td><img id="s_db_host" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
  1533         <tr><td><b>Database name</b><br />The name of the actual database. If you don't already have a database, you can create one here, if you have the username and password of a MySQL user with administrative rights.<br /><span style="color: #993300" id="e_db_name"></span></td><td><input onkeyup="verify();" name="db_name" size="30" type="text" /></td><td><img id="s_db_name" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
  1449         <tr><td><b>Database name</b><br />The name of the actual database. If you don't already have a database, you can create one here, if you have the username and password of a MySQL user with administrative rights.<br /><span style="color: #993300" id="e_db_name"></span></td><td><input onkeyup="verify();" name="db_name" size="30" type="text" /></td><td><img id="s_db_name" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
  1534         <tr><td rowspan="2"><b>Database login</b><br />These fields should be the username and password of a user with "select", "insert", "update", "delete", "create table", and "replace" privileges for your database.<br /><span style="color: #993300" id="e_db_auth"></span></td><td><input onkeyup="verify();" name="db_user" size="30" type="text" /></td><td rowspan="2"><img id="s_db_auth" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
  1450         <tr><td rowspan="2"><b>Database login</b><br />These fields should be the username and password of a user with "select", "insert", "update", "delete", "create table", and "replace" privileges for your database.<br /><span style="color: #993300" id="e_db_auth"></span></td><td><input onkeyup="verify();" name="db_user" size="30" type="text" /></td><td rowspan="2"><img id="s_db_auth" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
  1543       </table>
  1459       </table>
  1544       <div class="pagenav">
  1460       <div class="pagenav">
  1545        <table border="0">
  1461        <table border="0">
  1546        <tr>
  1462        <tr>
  1547        <td><input type="submit" value="Continue" onclick="return verify();" name="_cont" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Check your MySQL connection using the "Test Connection" button.<br />&bull; Be aware that your database information will be transmitted unencrypted several times.</p></td>
  1463        <td><input type="submit" value="Continue" onclick="return verify();" name="_cont" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Check your MySQL connection using the "Test Connection" button.<br />&bull; Be aware that your database information will be transmitted unencrypted several times.</p></td>
  1548        </tr>
       
  1549        </table>
       
  1550      </div>
       
  1551     </form>
       
  1552     <?php
       
  1553     break;
       
  1554   case "database_pgsql":
       
  1555     ?>
       
  1556     <script type="text/javascript">
       
  1557       function ajaxGet(uri, f) {
       
  1558         if (window.XMLHttpRequest) {
       
  1559           ajax = new XMLHttpRequest();
       
  1560         } else {
       
  1561           if (window.ActiveXObject) {           
       
  1562             ajax = new ActiveXObject("Microsoft.XMLHTTP");
       
  1563           } else {
       
  1564             alert('Enano client-side runtime error: No AJAX support, unable to continue');
       
  1565             return;
       
  1566           }
       
  1567         }
       
  1568         ajax.onreadystatechange = f;
       
  1569         ajax.open('GET', uri, true);
       
  1570         ajax.send(null);
       
  1571       }
       
  1572       
       
  1573       function ajaxPost(uri, parms, f) {
       
  1574         if (window.XMLHttpRequest) {
       
  1575           ajax = new XMLHttpRequest();
       
  1576         } else {
       
  1577           if (window.ActiveXObject) {           
       
  1578             ajax = new ActiveXObject("Microsoft.XMLHTTP");
       
  1579           } else {
       
  1580             alert('Enano client-side runtime error: No AJAX support, unable to continue');
       
  1581             return;
       
  1582           }
       
  1583         }
       
  1584         ajax.onreadystatechange = f;
       
  1585         ajax.open('POST', uri, true);
       
  1586         ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
       
  1587         ajax.setRequestHeader("Content-length", parms.length);
       
  1588         ajax.setRequestHeader("Connection", "close");
       
  1589         ajax.send(parms);
       
  1590       }
       
  1591       function ajaxTestConnection()
       
  1592       {
       
  1593         v = verify();
       
  1594         if(!v)
       
  1595         {
       
  1596           alert('One or more of the form fields is incorrect. Please correct any information in the form that has an "X" next to it.');
       
  1597           return false;
       
  1598         }
       
  1599         var frm = document.forms.dbinfo;
       
  1600         db_host      = escape(frm.db_host.value.replace('+', '%2B'));
       
  1601         db_name      = escape(frm.db_name.value.replace('+', '%2B'));
       
  1602         db_user      = escape(frm.db_user.value.replace('+', '%2B'));
       
  1603         db_pass      = escape(frm.db_pass.value.replace('+', '%2B'));
       
  1604         db_root_user = escape(frm.db_root_user.value.replace('+', '%2B'));
       
  1605         db_root_pass = escape(frm.db_root_pass.value.replace('+', '%2B'));
       
  1606         
       
  1607         parms = 'host='+db_host+'&name='+db_name+'&user='+db_user+'&pass='+db_pass+'&root_user='+db_root_user+'&root_pass='+db_root_pass;
       
  1608         ajaxPost('<?php echo scriptPath; ?>/install.php?mode=pgsql_test', parms, function() {
       
  1609             if(ajax.readyState==4)
       
  1610             {
       
  1611               s = ajax.responseText.substr(0, 4);
       
  1612               t = ajax.responseText.substr(4, ajax.responseText.length);
       
  1613               if(s.substr(0, 4)=='good')
       
  1614               {
       
  1615                 document.getElementById('s_db_host').src='images/good.gif';
       
  1616                 document.getElementById('s_db_name').src='images/good.gif';
       
  1617                 document.getElementById('s_db_auth').src='images/good.gif';
       
  1618                 document.getElementById('s_db_root').src='images/good.gif';
       
  1619                 if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = '<b>Warning:<\/b> The database you specified does not exist. It will be created during installation.';
       
  1620                 if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = '<b>Warning:<\/b> The specified regular user does not exist or the password is incorrect. The user will be created during installation. If the user already exists, the password will be reset.';
       
  1621                 document.getElementById('s_mysql_version').src='images/good.gif';
       
  1622                 document.getElementById('e_mysql_version').innerHTML = 'Your version of PostgreSQL meets Enano requirements.';
       
  1623               }
       
  1624               else
       
  1625               {
       
  1626                 switch(s)
       
  1627                 {
       
  1628                 case 'host':
       
  1629                   document.getElementById('s_db_host').src='images/bad.gif';
       
  1630                   document.getElementById('s_db_name').src='images/unknown.gif';
       
  1631                   document.getElementById('s_db_auth').src='images/unknown.gif';
       
  1632                   document.getElementById('s_db_root').src='images/unknown.gif';
       
  1633                   document.getElementById('e_db_host').innerHTML = '<b>Error:<\/b> The database server "'+document.forms.dbinfo.db_host.value+'" couldn\'t be contacted.<br \/>'+t;
       
  1634                   document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
       
  1635                   break;
       
  1636                 case 'auth':
       
  1637                   document.getElementById('s_db_host').src='images/good.gif';
       
  1638                   document.getElementById('s_db_name').src='images/unknown.gif';
       
  1639                   document.getElementById('s_db_auth').src='images/bad.gif';
       
  1640                   document.getElementById('s_db_root').src='images/unknown.gif';
       
  1641                   document.getElementById('e_db_auth').innerHTML = '<b>Error:<\/b> Access to MySQL under the specified credentials was denied.<br \/>'+t;
       
  1642                   document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
       
  1643                   break;
       
  1644                 case 'perm':
       
  1645                   document.getElementById('s_db_host').src='images/good.gif';
       
  1646                   document.getElementById('s_db_name').src='images/bad.gif';
       
  1647                   document.getElementById('s_db_auth').src='images/good.gif';
       
  1648                   document.getElementById('s_db_root').src='images/unknown.gif';
       
  1649                   document.getElementById('e_db_name').innerHTML = '<b>Error:<\/b> Access to the specified database using those login credentials was denied.<br \/>'+t;
       
  1650                   document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
       
  1651                   break;
       
  1652                 case 'name':
       
  1653                   document.getElementById('s_db_host').src='images/good.gif';
       
  1654                   document.getElementById('s_db_name').src='images/bad.gif';
       
  1655                   document.getElementById('s_db_auth').src='images/good.gif';
       
  1656                   document.getElementById('s_db_root').src='images/unknown.gif';
       
  1657                   document.getElementById('e_db_name').innerHTML = '<b>Error:<\/b> The specified database does not exist<br \/>'+t;
       
  1658                   document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
       
  1659                   break;
       
  1660                 case 'root':
       
  1661                   document.getElementById('s_db_host').src='images/good.gif';
       
  1662                   document.getElementById('s_db_name').src='images/unknown.gif';
       
  1663                   document.getElementById('s_db_auth').src='images/unknown.gif';
       
  1664                   document.getElementById('s_db_root').src='images/bad.gif';
       
  1665                   document.getElementById('e_db_root').innerHTML = '<b>Error:<\/b> Access to MySQL under the specified credentials was denied.<br \/>'+t;
       
  1666                   document.getElementById('e_mysql_version').innerHTML = 'The MySQL version that your server is running could not be determined.';
       
  1667                   break;
       
  1668                 case 'vers':
       
  1669                   document.getElementById('s_db_host').src='images/good.gif';
       
  1670                   document.getElementById('s_db_name').src='images/good.gif';
       
  1671                   document.getElementById('s_db_auth').src='images/good.gif';
       
  1672                   document.getElementById('s_db_root').src='images/good.gif';
       
  1673                   if(t.match(/_creating_db/)) document.getElementById('e_db_name').innerHTML = '<b>Warning:<\/b> The database you specified does not exist. It will be created during installation.';
       
  1674                   if(t.match(/_creating_user/)) document.getElementById('e_db_auth').innerHTML = '<b>Warning:<\/b> The specified regular user does not exist or the password is incorrect. The user will be created during installation. If the user already exists, the password will be reset.';
       
  1675                   
       
  1676                   document.getElementById('e_mysql_version').innerHTML = '<b>Error:<\/b> Your version of MySQL ('+t+') is older than 4.1.17. Enano will still work, but there is a known bug with the comment system and MySQL 4.1.11 that involves some comments not being displayed, due to an issue with the PHP function mysql_fetch_row().';
       
  1677                   document.getElementById('s_mysql_version').src='images/bad.gif';
       
  1678                 default:
       
  1679                   alert(t);
       
  1680                   break;
       
  1681                 }
       
  1682               }
       
  1683             }
       
  1684           });
       
  1685       }
       
  1686       function verify()
       
  1687       {
       
  1688         document.getElementById('e_db_host').innerHTML = '';
       
  1689         document.getElementById('e_db_auth').innerHTML = '';
       
  1690         document.getElementById('e_db_name').innerHTML = '';
       
  1691         document.getElementById('e_db_root').innerHTML = '';
       
  1692         var frm = document.forms.dbinfo;
       
  1693         ret = true;
       
  1694         if(frm.db_host.value != '')
       
  1695         {
       
  1696           document.getElementById('s_db_host').src='images/unknown.gif';
       
  1697         }
       
  1698         else
       
  1699         {
       
  1700           document.getElementById('s_db_host').src='images/bad.gif';
       
  1701           ret = false;
       
  1702         }
       
  1703         if(frm.db_name.value.match(/^([a-z0-9_-]+)$/g))
       
  1704         {
       
  1705           document.getElementById('s_db_name').src='images/unknown.gif';
       
  1706         }
       
  1707         else
       
  1708         {
       
  1709           document.getElementById('s_db_name').src='images/bad.gif';
       
  1710           ret = false;
       
  1711         }
       
  1712         if(frm.db_user.value != '')
       
  1713         {
       
  1714           document.getElementById('s_db_auth').src='images/unknown.gif';
       
  1715         }
       
  1716         else
       
  1717         {
       
  1718           document.getElementById('s_db_auth').src='images/bad.gif';
       
  1719           ret = false;
       
  1720         }
       
  1721         if(frm.table_prefix.value.match(/^([a-z0-9_]*)$/g))
       
  1722         {
       
  1723           document.getElementById('s_table_prefix').src='images/good.gif';
       
  1724         }
       
  1725         else
       
  1726         {
       
  1727           document.getElementById('s_table_prefix').src='images/bad.gif';
       
  1728           ret = false;
       
  1729         }
       
  1730         if(frm.db_root_user.value == '')
       
  1731         {
       
  1732           document.getElementById('s_db_root').src='images/good.gif';
       
  1733         }
       
  1734         else if(frm.db_root_user.value != '' && frm.db_root_pass.value == '')
       
  1735         {
       
  1736           document.getElementById('s_db_root').src='images/bad.gif';
       
  1737           ret = false;
       
  1738         }
       
  1739         else
       
  1740         {
       
  1741           document.getElementById('s_db_root').src='images/unknown.gif';
       
  1742         }
       
  1743         if(ret) frm._cont.disabled = false;
       
  1744         else    frm._cont.disabled = true;
       
  1745         return ret;
       
  1746       }
       
  1747       window.onload = verify;
       
  1748     </script>
       
  1749     <p>Now we need some information that will allow Enano to contact your database server. Enano uses PostgreSQL as a data storage backend,
       
  1750        and we need to have access to a PostgreSQL server in order to continue.</p>
       
  1751     <p>If you do not have access to a PostgreSQL server, and you are using your own server, you can download PostgreSQL for free from
       
  1752        <a href="http://www.postgresql.org/">PostgreSQL.org</a>.</p>
       
  1753     <form name="dbinfo" action="install.php?mode=website" method="post">
       
  1754       <input type="hidden" name="db_driver" value="postgresql" />
       
  1755       <table border="0">
       
  1756         <tr><td colspan="3" style="text-align: center"><h3>Database information</h3></td></tr>
       
  1757         <tr><td><b>Database hostname</b><br />This is the hostname (or sometimes the IP address) of your Postgres server. In many cases, this is "localhost".<br /><span style="color: #993300" id="e_db_host"></span></td><td><input onkeyup="verify();" name="db_host" size="30" type="text" /></td><td><img id="s_db_host" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
       
  1758         <tr><td><b>Database name</b><br />The name of the actual database. If you don't already have a database, you can create one here, if you have the username and password of a PostgreSQL superuser.<br /><span style="color: #993300" id="e_db_name"></span></td><td><input onkeyup="verify();" name="db_name" size="30" type="text" /></td><td><img id="s_db_name" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
       
  1759         <tr><td rowspan="2"><b>Database login</b><br />These fields should be the username and password for a role that has permission to create and alter tables, select data, insert data, update data, and delete data. You may or may not choose to allow dropping tables.<br /><span style="color: #993300" id="e_db_auth"></span></td><td><input onkeyup="verify();" name="db_user" size="30" type="text" /></td><td rowspan="2"><img id="s_db_auth" alt="Good/bad icon" src="images/bad.gif" /></td></tr>
       
  1760         <tr><td><input name="db_pass" size="30" type="password" /></td></tr>
       
  1761         <tr><td colspan="3" style="text-align: center"><h3>Optional information</h3></td></tr>
       
  1762         <tr><td><b>Table prefix</b><br />The value that you enter here will be added to the beginning of the name of each Enano table. You may use lowercase letters (a-z), numbers (0-9), and underscores (_).</td><td><input onkeyup="verify();" name="table_prefix" size="30" type="text" /></td><td><img id="s_table_prefix" alt="Good/bad icon" src="images/good.gif" /></td></tr>
       
  1763         <tr><td rowspan="2"><b>Database administrative login</b><br />If the Postgres database or role that you entered above does not exist yet, you can create them here, assuming that you have the login information for a PostgreSQL superuser. Leave these fields blank unless you need to use them.<br /><span style="color: #993300" id="e_db_root"></span></td><td><input onkeyup="verify();" name="db_root_user" size="30" type="text" /></td><td rowspan="2"><img id="s_db_root" alt="Good/bad icon" src="images/good.gif" /></td></tr>
       
  1764         <tr><td><input onkeyup="verify();" name="db_root_pass" size="30" type="password" /></td></tr>
       
  1765         <tr><td><b>PostgreSQL version</b></td><td id="e_mysql_version">PostgreSQL version information will<br />be checked when you click "Test<br />Connection". You need to have at<br />least PostgreSQL 8.2.0 to install Enano.</td><td><img id="s_mysql_version" alt="Good/bad icon" src="images/unknown.gif" /></td></tr>
       
  1766         <tr><td><b>Delete existing tables?</b><br />If this option is checked, all the tables that will be used by Enano will be dropped (deleted) before the schema is executed. Do NOT use this option unless specifically instructed to.</td><td><input type="checkbox" name="drop_tables" id="dtcheck" />  <label for="dtcheck">Drop existing tables</label></td></tr>
       
  1767         <tr><td colspan="3" style="text-align: center"><input type="button" value="Test connection" onclick="ajaxTestConnection();" /></td></tr>
       
  1768       </table>
       
  1769       <div class="pagenav">
       
  1770        <table border="0">
       
  1771        <tr>
       
  1772        <td><input type="submit" value="Continue" onclick="return verify();" name="_cont" /></td><td><p><span style="font-weight: bold;">Before clicking continue:</span><br />&bull; Check your PostgreSQL connection using the "Test Connection" button.<br />&bull; Be aware that your database information will be transmitted unencrypted several times.</p></td>
       
  1773        </tr>
  1464        </tr>
  1774        </table>
  1465        </table>
  1775      </div>
  1466      </div>
  1776     </form>
  1467     </form>
  1777     <?php
  1468     <?php
  2076   case "install":
  1767   case "install":
  2077     if(!isset($_POST['db_host']) ||
  1768     if(!isset($_POST['db_host']) ||
  2078        !isset($_POST['db_name']) ||
  1769        !isset($_POST['db_name']) ||
  2079        !isset($_POST['db_user']) ||
  1770        !isset($_POST['db_user']) ||
  2080        !isset($_POST['db_pass']) ||
  1771        !isset($_POST['db_pass']) ||
  2081        !isset($_POST['db_driver']) ||
       
  2082        !isset($_POST['sitename']) ||
  1772        !isset($_POST['sitename']) ||
  2083        !isset($_POST['sitedesc']) ||
  1773        !isset($_POST['sitedesc']) ||
  2084        !isset($_POST['copyright']) ||
  1774        !isset($_POST['copyright']) ||
  2085        !isset($_POST['admin_user']) ||
  1775        !isset($_POST['admin_user']) ||
  2086        !isset($_POST['admin_pass']) ||
  1776        !isset($_POST['admin_pass']) ||
  2087        !isset($_POST['admin_embed_php']) || ( isset($_POST['admin_embed_php']) && !in_array($_POST['admin_embed_php'], array('2', '4')) ) ||
  1777        !isset($_POST['admin_embed_php']) || ( isset($_POST['admin_embed_php']) && !in_array($_POST['admin_embed_php'], array('2', '4')) ) ||
  2088        !isset($_POST['urlscheme'])
  1778        !isset($_POST['urlscheme'])
  2089        )
  1779        )
  2090     {
  1780     {
  2091       echo 'The installer has detected that one or more required form values is not set. Please <a href="install.php?mode=sysreqs">restart the installation</a>.';
  1781       echo 'The installer has detected that one or more required form values is not set. Please <a href="install.php?mode=sysreqs">restart the installation</a>.';
  2092       $template->footer();
       
  2093       exit;
       
  2094     }
       
  2095     if ( !in_array($_POST['db_driver'], array('mysql', 'postgresql')) )
       
  2096     {
       
  2097       echo 'Invalid database driver.';
       
  2098       $template->footer();
  1782       $template->footer();
  2099       exit;
  1783       exit;
  2100     }
  1784     }
  2101     switch($_POST['urlscheme'])
  1785     switch($_POST['urlscheme'])
  2102     {
  1786     {