Modification m_mysql

This commit is contained in:
Steven Mondji-Lerider 2012-08-26 11:07:32 +00:00
parent 31936d58bb
commit dc7998c689
4 changed files with 64 additions and 43 deletions

View File

@ -49,7 +49,6 @@ if (!$r=$mysql->get_dblist()) {
echo "<p class=\"error\">$error</p><p>&nbsp;</p>";
}
$r=$mysql->get_defaultsparam($dbname);
if(!empty($r)){
?>
<p><?php __("Your current connection settings are"); ?> : </p>
<table class="tedit">
@ -78,13 +77,12 @@ if(isset($r['user'])){
</table>
<?php
if(!isset($r['user'])){
echo "<p class=\"error\">";__("You changed the MySQL User base configuration. Please refer to your configuration");echo"</p><p>&nbsp;</p>";
echo "<p class=\"error\">";__("You changed the MySQL User base configuration. Please reffer to your configuration");echo"</p><p>&nbsp;</p>";
}
?>
<p><span class="ina"><a href="sql_list.php"><?php __("Back to the MySQL database list"); ?></a></span></p>
<?php
} //empty $r
include_once("foot.php"); ?>

View File

@ -59,7 +59,7 @@ if($rdb){
?>
<form method="post" action="sql_del.php" name="main" id="main">
<table class="tlist">
<tr><th>&nbsp;</th><th><?php __("Database"); ?></th><th><?php __("Backup"); ?></th><th><?php __("Restore"); ?></th><th><?php __("Settings"); ?></th><th><?php __("Size"); ?></th></tr>
<tr><th>&nbsp;</th><th><?php __("Database"); ?></th><th><?php __("Backup"); ?></th><th><?php __("Restore"); ?></th><th><?php __("Show Settings"); ?></th><th><?php __("Size"); ?></th></tr>
<?php
$col=1;
@ -73,7 +73,7 @@ for($i=0;$i<count($rdb);$i++) {
<td><label for="del_<?php echo $val["db"]; ?>"><?php echo $val["db"]; ?></label></td>
<td><div class="ina"><a href="sql_bck.php?id=<?php echo $val["db"] ?>"><?php __("Backup"); ?></a></div></td>
<td><div class="ina"><a href="sql_restore.php?id=<?php echo $val["db"] ?>"><?php __("Restore"); ?></a></div></td>
<td><div class="ina"><a href="sql_getparam.php?dbname=<?php echo $val["db"] ?>"><?php __("Settings"); ?></a></div></td>
<td><div class="ina"><a href="sql_getparam.php?dbname=<?php echo $val["db"] ?>"><?php __("Show Settings"); ?></a></div></td>
<td><code><?php echo format_size($val["size"]); ?></code></td>
</tr>
<?php
@ -91,9 +91,27 @@ for($i=0;$i<count($rdb);$i++) {
?>
<p>&nbsp;</p>
<?php if ($quota->cancreate("mysql")) { ?>
<?php if ($quota->cancreate("mysql")) {
$q=$quota->getquota("mysql");
if($q['u'] == 0 ){
?>
<p> <span class="ina"><a href="sql_add.php"><?php __("Create a new MySQL database"); ?></a></span> </p>
<?php }
<?php }else{
?>
<form method="post" action="sql_doadd.php" id="main" name="main">
<table class="tedit">
<tr>
<th><label for="dbn"><?php __("MySQL Database"); ?></label></th>
<td>
<span class="int" id="dbnpfx"><?php echo $mem->user["login"]; ?>_</span><input type="text" class="int" name="dbn" id="dbn" value="" size="20" maxlength="30" />
</tr>
</table>
<br />
<input type="submit" class="inb" name="submit" value="<?php __("Create this new MySQL database."); ?>" />
</form>
<?php
}
}
?>
<script type="text/javascript">
document.forms['main'].pass.focus();

View File

@ -91,6 +91,7 @@ for($i=0;$i<count($r);$i++) {
?>
<tr><td colspan="5">
<input type="submit" value="<?php __("Apply"); ?>" class="inb" />
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='sql_users_list.php'"/>
</td></tr>
</table>
</form>

View File

@ -544,47 +544,51 @@ class m_mysql {
$dbu=$dbn;
$r=array();
$dbn=str_replace('_','\_',$dbn);
$db->query("Select Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,References_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv from mysql.db where Db='".$dbn."' and User='".$dbu."';");
$q=$db->query("Select Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,References_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv from mysql.db where Db='".$dbn."' and User!='".$cuid."_myadm';");
if(!$db->num_rows()){
return $r;
}
$db->next_record();
$r['Host']=$db->f('Host');
if($db->f('Select_priv') !== "Y"){
return $r;
}
if($db->f('Insert_priv') !== "Y"){
return $r;
}
if($db->f('Update_priv') !== "Y"){
return $r;
}
if($db->f('Delete_priv') !== "Y"){
return $r;
}
if($db->f('Create_priv') !== "Y"){
return $r;
}
if($db->f('Drop_priv') !== "Y"){
return $r;
}
if($db->f('References_priv') !== "Y"){
return $r;
}
if($db->f('Index_priv') !== "Y"){
return $r;
}
if($db->f('Alter_priv') !== "Y"){
return $r;
}
if($db->f('Create_tmp_table_priv') !== "Y"){
return $r;
}
if($db->f('Lock_tables_priv') !== "Y"){
return $r;
}
while ($db->next_record()) {
$variable = $db->Record;
if($variable['User'] == $dbu){
$r['Host']=$db->f('Host');
if($db->f('Select_priv') !== "Y"){
return $r;
}
if($db->f('Insert_priv') !== "Y"){
return $r;
}
if($db->f('Update_priv') !== "Y"){
return $r;
}
if($db->f('Delete_priv') !== "Y"){
return $r;
}
if($db->f('Create_priv') !== "Y"){
return $r;
}
if($db->f('Drop_priv') !== "Y"){
return $r;
}
if($db->f('References_priv') !== "Y"){
return $r;
}
if($db->f('Index_priv') !== "Y"){
return $r;
}
if($db->f('Alter_priv') !== "Y"){
return $r;
}
if($db->f('Create_tmp_table_priv') !== "Y"){
return $r;
}
if($db->f('Lock_tables_priv') !== "Y"){
return $r;
}
}
}//endwhile
if(!$db->query("SELECT name,password from dbusers where name='".$dbu."';")){
return $r;
}