📄 display_create_table.lib.php
字号:
<?php/* $Id: display_create_table.lib.php,v 1.5 2005/11/09 10:38:33 cybot_tm Exp $ */// vim: expandtab sw=4 ts=4 sts=4:// Displays form for creating a table (if user has privileges for that)require_once('./libraries/check_user_privileges.lib.php');$is_create_table_priv = FALSE;foreach( $dbs_where_create_table_allowed as $allowed_db ) { // if we find the exact db name, we stop here if ($allowed_db == $db) { $is_create_table_priv = TRUE; break; } // '*' indicates a global CREATE priv if ($allowed_db == '*') { $is_create_table_priv = TRUE; break; } if (ereg('%|_', $allowed_db)) { // take care of wildcards and escaped wildcards, // transforming them into regexp patterns $max_position = strlen($allowed_db) - 1; $i = 0; $pattern = ''; while ($i <= $max_position) { if ($allowed_db[$i] == '\\'){ if ($i < $max_position - 1 && $allowed_db[$i+1] == '_'){ $chunk = '_'; $i++; } elseif ($i < $max_position - 1 && $allowed_db[$i+1] == '%'){ $chunk = '%'; $i++; } else { $chunk = $allowed_db[$i]; } } elseif ($allowed_db[$i] == '_'){ $chunk = '.'; } elseif ($allowed_db[$i] == '%'){ $chunk = '(.)*'; } else { $chunk = $allowed_db[$i]; } $pattern .= $chunk; $i++; } // end while unset($i, $max_position, $chunk); $matches = ''; if (preg_match('@' .$pattern . '@i', $db, $matches)) { if ($matches[0] == $db) { $is_create_table_priv = TRUE; break; //TODO: maybe receive in $allowed_db also the db names // on which we cannot CREATE, and check them // in this foreach, because if a user is allowed to CREATE // on db foo% but forbidden on db foobar, he should not // see the Create table dialog } } }} // end foreachunset($i, $max_position, $chunk, $pattern);?><form method="post" action="tbl_create.php" onsubmit="return (emptyFormElements(this, 'table') && checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldCount']); ?>', 1))"><fieldset> <legend><?phpif ( $GLOBALS['cfg']['PropertiesIconic'] ) { echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />';}echo sprintf( $strCreateNewTable, PMA_getDbLink() );?> </legend><?php if ( $is_create_table_priv ) { ?> <?php echo PMA_generate_common_hidden_inputs( $db ); ?> <div class="formelement"> <?php echo $strName; ?>: <input type="text" name="table" maxlength="64" size="30" /> </div> <div class="formelement"> <?php echo $strNumberOfFields; ?>: <input type="text" name="num_fields" size="2" /> </div></fieldset><fieldset class="tblFooters"> <input type="submit" value="<?php echo $strGo; ?>" /><?php } else { ?> <div class="error"><?php echo $strNoPrivileges; ?></div><?php } // end if else ?></fieldset></form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -