Rev 150 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
150 | daniel-mar | 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><?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><?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 | |||
236 | daniel-mar | 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); |
||
150 | daniel-mar | 45 | |
46 | return !error; |
||
47 | }); |
||
48 | rebuild_config_callbacks.push(function() { |
||
49 | var e = document.getElementById("db_plugin"); |
||
50 | var strPlugin = e.options[e.selectedIndex].value; |
||
51 | if (strPlugin != 'PDO') return ''; |
||
52 | |||
53 | return '<b>define</b>(\'OIDPLUS_PDO_DSN\', \''+document.getElementById('pdo_dsn').value+'\');<br>' + |
||
54 | '<b>define</b>(\'OIDPLUS_PDO_USERNAME\', \''+document.getElementById('pdo_username').value+'\');<br>' + |
||
55 | '<b>define</b>(\'OIDPLUS_PDO_PASSWORD\', \''+b64EncodeUnicode(document.getElementById('pdo_password').value)+'\'); // base64 encoded<br>'; |
||
56 | }); |
||
57 | </script> |