2006-04-26 12:28:53 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
$Id: sql_list.php,v 1.8 2006/02/16 16:26:28 benjamin Exp $
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
AlternC - Web Hosting System
|
|
|
|
Copyright (C) 2002 by the AlternC Development Team.
|
|
|
|
http://alternc.org/
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Based on:
|
|
|
|
Valentin Lacambre's web hosting softwares: http://altern.org/
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
LICENSE
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License (GPL)
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Original Author of file: Benjamin Sonntag
|
|
|
|
Purpose of file: Manage the MySQL database of a member
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
require_once("../class/config.php");
|
2009-09-08 05:29:38 +00:00
|
|
|
include_once("head.php");
|
2006-04-26 12:28:53 +00:00
|
|
|
|
2012-08-10 17:18:34 +00:00
|
|
|
$rdb=$mysql->get_dblist();
|
|
|
|
$r=$mysql->get_userslist();
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
<h3><?php __("MySQL Databases"); ?></h3>
|
2010-05-27 15:10:45 +00:00
|
|
|
<hr id="topbar"/>
|
|
|
|
<br />
|
2006-04-26 12:28:53 +00:00
|
|
|
<?php
|
2011-03-06 21:28:14 +00:00
|
|
|
if (isset($error) && $error) {
|
2013-10-18 09:59:03 +00:00
|
|
|
echo "<p class=\"alert alert-danger\">$error</p>";
|
2006-04-26 12:28:53 +00:00
|
|
|
}
|
2012-08-10 17:18:34 +00:00
|
|
|
if(!$r || empty($r)){
|
2013-10-18 12:07:49 +00:00
|
|
|
echo "<p class=\"alert alert-info\">"._("You have no sql user at the moment.")."</p>";
|
2012-08-10 17:18:34 +00:00
|
|
|
}
|
2006-04-26 12:28:53 +00:00
|
|
|
?>
|
|
|
|
|
2012-08-10 17:18:34 +00:00
|
|
|
<?php
|
|
|
|
if($rdb){
|
|
|
|
?>
|
2009-09-08 05:29:38 +00:00
|
|
|
<form method="post" action="sql_del.php" name="main" id="main">
|
2016-05-20 12:21:47 +00:00
|
|
|
<?php csrf_get(); ?>
|
2010-04-06 20:29:08 +00:00
|
|
|
<table class="tlist">
|
2013-03-04 16:28:19 +00:00
|
|
|
<tr><th> </th><th><?php __("Database"); ?></th><?php if ( variable_get('sql_allow_users_backups') ) { ?><th><?php __("Backup"); ?></th><?php } // sql_allow_users_backups ?><th><?php __("Restore"); ?></th><th><?php __("Show Settings"); ?></th><th><?php __("Size"); ?></th></tr>
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
|
|
<?php
|
2012-08-10 17:18:34 +00:00
|
|
|
for($i=0;$i<count($rdb);$i++) {
|
|
|
|
$val=$rdb[$i];
|
2009-02-27 00:31:59 +00:00
|
|
|
$val['size'] = $mysql->get_db_size($val['db']);
|
2006-04-26 12:28:53 +00:00
|
|
|
?>
|
2013-05-23 16:18:56 +00:00
|
|
|
<tr class="lst">
|
2012-08-25 17:05:38 +00:00
|
|
|
<td align="center"><input type="checkbox" class="inc" id="del_<?php echo $val["db"]; ?>" name="del_<?php echo $val["db"]; ?>" value="<?php echo ($val["db"]); ?>" /></td>
|
|
|
|
<td><label for="del_<?php echo $val["db"]; ?>"><?php echo $val["db"]; ?></label></td>
|
2013-03-04 16:28:19 +00:00
|
|
|
<?php if ( variable_get('sql_allow_users_backups') ) { ?>
|
2013-04-25 16:06:50 +00:00
|
|
|
<td><div class="ina down"><a href="sql_bck.php?id=<?php echo $val["db"] ?>"><?php __("Backup"); ?></a></div></td>
|
2013-03-04 16:28:19 +00:00
|
|
|
<?php } // sql_allow_users_backups ?>
|
2013-04-25 16:06:50 +00:00
|
|
|
<td><div class="ina up"><a href="sql_restore.php?id=<?php echo $val["db"] ?>"><?php __("Restore"); ?></a></div></td>
|
|
|
|
<td><div class="ina configure"><a href="sql_getparam.php?dbname=<?php echo $val["db"] ?>"><?php __("Show Settings"); ?></a></div></td>
|
2006-04-26 12:28:53 +00:00
|
|
|
<td><code><?php echo format_size($val["size"]); ?></code></td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<tr><td colspan="5">
|
2013-04-25 16:06:50 +00:00
|
|
|
<input type="submit" name="sub" value="<?php __("Delete the checked databases"); ?>" class="inb delete" />
|
2006-04-26 12:28:53 +00:00
|
|
|
</td></tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
2012-08-10 17:18:34 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2006-04-26 12:28:53 +00:00
|
|
|
<p> </p>
|
2010-04-29 08:31:15 +00:00
|
|
|
|
2012-08-26 11:07:32 +00:00
|
|
|
<?php if ($quota->cancreate("mysql")) {
|
|
|
|
$q=$quota->getquota("mysql");
|
|
|
|
if($q['u'] == 0 ){
|
|
|
|
?>
|
2012-08-26 15:50:59 +00:00
|
|
|
<p> <span class="ina"><a href="sql_doadd.php"><?php __("Create a new MySQL database"); ?></a></span> </p>
|
2012-08-26 11:07:32 +00:00
|
|
|
<?php }else{
|
|
|
|
?>
|
2013-04-19 07:18:25 +00:00
|
|
|
<form method="post" action="sql_doadd.php" id="main2" name="main2">
|
2016-05-20 12:21:47 +00:00
|
|
|
<?php csrf_get(); ?>
|
2012-08-26 11:07:32 +00:00
|
|
|
<table class="tedit">
|
|
|
|
<tr>
|
|
|
|
<th><label for="dbn"><?php __("MySQL Database"); ?></label></th>
|
|
|
|
<td>
|
2014-03-20 10:13:54 +00:00
|
|
|
<?php
|
2016-04-27 17:04:49 +00:00
|
|
|
// Set a maximum length for the database name if we want the mysql user to be automatically created.
|
|
|
|
$max_dbsufix_size=(variable_get("sql_max_database_length", 16)-strlen($mem->user["login"].'_'));
|
2014-03-20 10:13:54 +00:00
|
|
|
?>
|
|
|
|
<span class="int" id="dbnpfx"><?php echo $mem->user["login"]; ?>_</span><input type="text" class="int" name="dbn" id="dbn" value="" size="20" maxlength="<?php echo $max_dbsufix_size ;?>" />
|
2013-04-19 07:18:25 +00:00
|
|
|
</td>
|
2012-08-26 11:07:32 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<br />
|
2013-04-25 16:06:50 +00:00
|
|
|
<input type="submit" class="inb add" name="submit" value="<?php __("Create this new MySQL database."); ?>" onClick="return false_if_empty('dbn', '<?php echo addslashes(_("Can't have empty MySQL suffix"));?>');" />
|
2012-08-26 11:07:32 +00:00
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
2006-04-26 12:28:53 +00:00
|
|
|
?>
|
2009-09-08 05:29:38 +00:00
|
|
|
<?php include_once("foot.php"); ?>
|