Revert initial commit
[phpmyadmin/blinky.git] / libraries / display_create_table.lib.php
blob19512b108366fbb12acdff0ec320a7c18f43a82e
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Displays form for creating a table (if user has privileges for that)
6 * for MySQL >= 4.1.0, we should be able to detect if user has a CREATE
7 * privilege by looking at SHOW GRANTS output;
8 * for < 4.1.0, it could be more difficult because the logic tries to
9 * detect the current host and it might be expressed in many ways; also
10 * on a shared server, the user might be unable to define a controluser
11 * that has the proper rights to the "mysql" db;
12 * so we give up and assume that user has the right to create a table
14 * Note: in this case we could even skip the following "foreach" logic
16 * Addendum, 2006-01-19: ok, I give up. We got some reports about servers
17 * where the hostname field in mysql.user is not the same as the one
18 * in mysql.db for a user. In this case, SHOW GRANTS does not return
19 * the db-specific privileges. And probably, those users are on a shared
20 * server, so can't set up a control user with rights to the "mysql" db.
21 * We cannot reliably detect the db-specific privileges, so no more
22 * warnings about the lack of privileges for CREATE TABLE. Tested
23 * on MySQL 5.0.18.
25 * @version $Id$
26 * @package phpMyAdmin
28 if (! defined('PHPMYADMIN')) {
29 exit;
32 /**
35 require_once './libraries/check_user_privileges.lib.php';
37 $is_create_table_priv = true;
40 <form method="post" action="tbl_create.php"
41 onsubmit="return (emptyFormElements(this, 'table') &amp;&amp; checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', __('Table must have at least one field.')); ?>', 1))">
42 <fieldset>
43 <legend>
44 <?php
45 if ($GLOBALS['cfg']['PropertiesIconic']) {
46 echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />';
48 echo sprintf(__('Create table on database %s'), PMA_getDbLink());
50 </legend>
51 <?php echo PMA_generate_common_hidden_inputs($db); ?>
52 <div class="formelement">
53 <?php echo __('Name'); ?>:
54 <input type="text" name="table" maxlength="64" size="30" />
55 </div>
56 <div class="formelement">
57 <?php echo __('Number of fields'); ?>:
58 <input type="text" name="num_fields" size="2" />
59 </div>
60 <div class="clearfloat"></div>
61 </fieldset>
62 <fieldset class="tblFooters">
63 <input type="submit" value="<?php echo __('Go'); ?>" />
64 </fieldset>
65 </form>