Subversion Repositories oidplus

Rev

Rev 236 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. <div id="DBPLUGIN_PARAMS_PDO">
  2.         <p>PDO DSN (<a href="https://www.php.net/manual/de/pdo.drivers.php" target="_blank">more information</a>):<br><input id="pdo_dsn" type="text" value="mysql:dbname=oidplus;host=localhost" onkeypress="rebuild()" onkeyup="rebuild()" style="width:600px">  <span id="pdo_dsn_warn"></p>
  3.         <p>PDO Username:<br><input id="pdo_username" type="text" value="root" onkeypress="rebuild()" onkeyup="rebuild()">  <span id="pdo_username_warn"></p>
  4.         <p>PDO Password:<br><input id="pdo_password" type="password" value="" onkeypress="rebuild()" onkeyup="rebuild()">  <span id="pdo_password_warn"></p>
  5.         <p><i>Attention: OIDplus currently only implements the SQL dialect of MySQL. Other DBMS might not work.</i></p>
  6. </div>
  7. <script>
  8. plugin_combobox_change_callbacks.push(function(strPlugin) {
  9.         document.getElementById('DBPLUGIN_PARAMS_PDO').style.display = (strPlugin == 'PDO') ? "Block" : "None";
  10. });
  11. rebuild_callbacks.push(function() {
  12.         var e = document.getElementById("db_plugin");
  13.         var strPlugin = e.options[e.selectedIndex].value;
  14.         if (strPlugin != 'PDO') return true;
  15.  
  16.         document.getElementById('struct_cli_1').innerHTML = '';
  17.         document.getElementById('struct_cli_2').innerHTML = '';
  18.         document.getElementById('struct_1').href = 'struct_empty.sql.php';
  19.         document.getElementById('struct_2').href = 'struct_with_examples.sql.php';
  20.  
  21.         error = false;
  22.  
  23.         // Check 1: dsn must not be empty
  24.         if (document.getElementById('pdo_dsn').value.length == 0)
  25.         {
  26.                 document.getElementById('pdo_dsn_warn').innerHTML = '<font color="red">Please specify a DSN!</font>';
  27.                 document.getElementById('config').innerHTML = '<b>&lt?php</b><br><br><i>// ERROR: Please specify a DSN!</i>';
  28.                 error = true;
  29.         } else {
  30.                 document.getElementById('pdo_dsn_warn').innerHTML = '';
  31.         }
  32.  
  33.         // Check 2: Username must not be empty
  34.         if (document.getElementById('pdo_username').value.length == 0)
  35.         {
  36.                 document.getElementById('pdo_username_warn').innerHTML = '<font color="red">Please specify a username!</font>';
  37.                 document.getElementById('config').innerHTML = '<b>&lt?php</b><br><br><i>// ERROR: Please specify a username!</i>';
  38.                 error = true;
  39.         } else {
  40.                 document.getElementById('pdo_username_warn').innerHTML = '';
  41.         }
  42.  
  43.         document.getElementById('struct_1').href = setupdir+'struct_empty.sql.php?plugin=pdo&prefix='+encodeURI(document.getElementById('tablename_prefix').value);
  44.         document.getElementById('struct_2').href = setupdir+'struct_with_examples.sql.php?plugin=pdo&prefix='+encodeURI(document.getElementById('tablename_prefix').value);
  45.         document.getElementById('struct_cli_1').innerHTML = '<br>or via command line:<br><code>curl -s "'+document.getElementById('struct_1').href+'" | mysql -u '+document.getElementById('mysql_username').value+' -p</code>';
  46.         document.getElementById('struct_cli_2').innerHTML = '<br>or via command line:<br><code>curl -s "'+document.getElementById('struct_2').href+'" | mysql -u '+document.getElementById('mysql_username').value+' -p</code>';
  47.  
  48.         return !error;
  49. });
  50. rebuild_config_callbacks.push(function() {
  51.         var e = document.getElementById("db_plugin");
  52.         var strPlugin = e.options[e.selectedIndex].value;
  53.         if (strPlugin != 'PDO') return '';
  54.  
  55.         return '<b>define</b>(\'OIDPLUS_PDO_DSN\',          \''+document.getElementById('pdo_dsn').value+'\');<br>' +
  56.                '<b>define</b>(\'OIDPLUS_PDO_USERNAME\',     \''+document.getElementById('pdo_username').value+'\');<br>' +
  57.                '<b>define</b>(\'OIDPLUS_PDO_PASSWORD\',     \''+b64EncodeUnicode(document.getElementById('pdo_password').value)+'\'); // base64 encoded<br>';
  58. });
  59. </script>
  60.