[fix] not using debug_backtrace, please, [doc] doc to english
This commit is contained in:
parent
1f4ea5d132
commit
cc64e7745f
|
@ -38,8 +38,8 @@ $r=$mysql->get_userslist();
|
|||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php
|
||||
// On regarde d'abord si on a une db existante. Sioui, on regarde si on a des utilisateurs existants
|
||||
if(!$rdb || empty($rdb)){
|
||||
// If the db exists, we look at users
|
||||
if (!$rdb || empty($rdb)) {
|
||||
$msg->raise("INFO", "mysql", _("You have no database at the moment."));
|
||||
} else if(!$r || empty($r)){
|
||||
$msg->raise("INFO", "mysql", _("You have no sql user at the moment."));
|
||||
|
@ -54,7 +54,7 @@ if($rdb){
|
|||
<form method="post" action="sql_del.php" name="main" id="main">
|
||||
<?php csrf_get(); ?>
|
||||
<table class="tlist">
|
||||
<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>
|
||||
<tr><th> </th><th><?php __("Database"); ?></th><?php if ( variable_get('sql_allow_users_backups') ) { ?><th><?php __("Backup"); ?></th><?php } ?><th><?php __("Restore"); ?></th><th><?php __("Show Settings"); ?></th><th><?php __("Size"); ?></th></tr>
|
||||
|
||||
<?php
|
||||
for($i=0;$i<count($rdb);$i++) {
|
||||
|
|
|
@ -62,8 +62,8 @@ if (isset($fatal) && $fatal) {
|
|||
<table class="tedit">
|
||||
<tr>
|
||||
<?php
|
||||
// On récupère la taille max d'un nom d'utilisateur mysql (définit dans les variables globales d'AlternC
|
||||
// et on l'utilise pour mettre la propriété maxlength de l'Input du nom
|
||||
// We check the max length of a mysql user (defined in the variables of AlternC)
|
||||
// we use that for the maxlenght of the Input
|
||||
$len=variable_get('sql_max_username_length', NULL)-strlen($mem->user["login"]."_");
|
||||
?>
|
||||
<th><label for="usern"><?php __("Username"); ?></label></th>
|
||||
|
|
|
@ -52,7 +52,7 @@ include_once("head.php");
|
|||
?>
|
||||
<h3><?php __("MySQL users"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<BR />
|
||||
<br />
|
||||
<p class="alert alert-warning"><?php __("WARNING"); ?></big><br /><?php __("Confirm the deletion of the following MySQL users"); ?><br />
|
||||
</p>
|
||||
<form method="post" action="sql_users_del.php" id="main">
|
||||
|
|
|
@ -36,7 +36,7 @@ $fields = array (
|
|||
getFields($fields);
|
||||
|
||||
if ($mysql->change_user_password($id,$password,$passwordconf))
|
||||
$msg->raise("INFO", "mysql", _("Mot de passe changé pour l'utilisateur '%s'."), $id);
|
||||
$msg->raise("INFO", "mysql", _("Password changed for user '%s'."), $id);
|
||||
|
||||
include("sql_users_list.php");
|
||||
?>
|
||||
|
|
|
@ -259,12 +259,12 @@ class m_mysql {
|
|||
return false;
|
||||
}
|
||||
|
||||
// On empèche la création auto d'utilisateurs si la taille du nom de la db est plus grand que la taille max du nom d'utilisateur
|
||||
// We prevent the automatic creation of user account longer than the max allowed lenght of a MySQL username
|
||||
$len=variable_get('sql_max_username_length', NULL);
|
||||
if (strlen($dbname) <= $len) {
|
||||
$db->query("SELECT name from dbusers where name= ? and enable='ACTIVATED' ;", array($dbname));
|
||||
if (!$db->num_rows()) {
|
||||
// On récupère la complexité du mdp qu'on doit générer que l'on va passer en paramètre de la fonction create_pass
|
||||
// We get the password complexity set in the policy and ensure we have that complexity in the create_pass() call
|
||||
$c=$admin->listPasswordPolicies();
|
||||
$passwd_classcount = $c['mysql']['classcount'];
|
||||
|
||||
|
@ -279,7 +279,7 @@ class m_mysql {
|
|||
$msg->raise("ALERT", "mysql", "L'utilisateur '$dbname' n'a pas été automatiquement créé car il dépasse la limite de taille pour les utilisateurs qui est à $len<br>Allez à la page 'Utilisateurs Mysql' pour en créer un avec le nom que vous voulez.<br>Et n'oubliez pas de lui donner les droits sur la base de données.");
|
||||
}
|
||||
|
||||
//checking for the phpmyadmin user
|
||||
// checking for the phpmyadmin user
|
||||
$db->query("SELECT * FROM dbusers WHERE uid= ? AND enable='ADMIN';", array($cuid));
|
||||
if ($db->num_rows()) {
|
||||
$db->next_record();
|
||||
|
@ -290,7 +290,7 @@ class m_mysql {
|
|||
return false;
|
||||
}
|
||||
|
||||
//Grant the special user every rights.
|
||||
// Grant the special user every rights.
|
||||
if ($this->dbus->exec("CREATE DATABASE $dbname;")) { // secured: dbname is checked against ^[0-9a-z]*$
|
||||
$msg->log("mysql", "add_db_succes", $dbn);
|
||||
// Ok, database does not exist, quota is ok and dbname is compliant. Let's proceed
|
||||
|
@ -334,11 +334,11 @@ class m_mysql {
|
|||
$db_esc = str_replace('_', '\_', $dbname);
|
||||
$this->dbus->query("DELETE FROM mysql.db WHERE Db= ? ;", array($db_esc));
|
||||
|
||||
#We test if the user created with the database is associated with more than 1 database.
|
||||
// We test if the user created with the database is associated with more than 1 database.
|
||||
$this->dbus->query("select User from mysql.db where User= ? ;", array($dbname));
|
||||
if (($this->dbus->num_rows()) == 0) {
|
||||
#If not we can delete it.
|
||||
$this->del_user($dbname);
|
||||
// If not we can delete it.
|
||||
$this->del_user($dbname, false, true );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ class m_mysql {
|
|||
|
||||
$listRights = array('Select', 'Insert', 'Update', 'Delete', 'Create', 'Drop', 'References', 'Index', 'Alter', 'Create_tmp_table', 'Lock_tables', 'Create_view', 'Show_view', 'Create_routine', 'Alter_routine', 'Execute', 'Event', 'Trigger');
|
||||
while ($this->dbus->next_record()) {
|
||||
// rTmp est l'array dans lequel on met les infos recupérées à chaque tour de boucle et est ajouté à l'array $r
|
||||
// rTmp is the array where we put the informations from each loop, added to array $r
|
||||
$rTmp = array();
|
||||
$variable = $this->dbus->Record;
|
||||
|
||||
|
@ -641,7 +641,7 @@ class m_mysql {
|
|||
|
||||
$r[] = $rTmp;
|
||||
|
||||
} //endwhile
|
||||
} // endwhile
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
@ -746,7 +746,7 @@ class m_mysql {
|
|||
* @param integer $all
|
||||
* @return boolean if the user has been deleted in MySQL or FALSE if an error occurred
|
||||
* */
|
||||
function del_user($user, $all = false) {
|
||||
function del_user($user, $all = false, $caller_is_deldb = false) {
|
||||
global $db, $msg, $cuid;
|
||||
$msg->log("mysql", "del_user", $user);
|
||||
if (!preg_match("#^[0-9a-z]#", $user)) {
|
||||
|
@ -759,9 +759,8 @@ class m_mysql {
|
|||
$db->query("SELECT name FROM dbusers WHERE uid= ? ;", array($cuid));
|
||||
}
|
||||
|
||||
$backtrace = debug_backtrace();
|
||||
if (!$db->num_rows()) {
|
||||
if ($backtrace[1]["function"] != "del_db")
|
||||
if (! $caller_is_deldb )
|
||||
$msg->raise("ERROR", "mysql", _("The username was not found"));
|
||||
|
||||
return false;
|
||||
|
@ -777,8 +776,8 @@ class m_mysql {
|
|||
|
||||
$db->query("DELETE FROM dbusers WHERE uid= ? AND name= ? ;", array($cuid, $user));
|
||||
|
||||
if ($backtrace[1]["function"] == "del_db")
|
||||
$msg->raise('info', "mysql", _("The user '%s' has been successfully deleted"), $user);
|
||||
if ( $caller_is_deldb )
|
||||
$msg->raise("INFO", "mysql", _("The user '%s' has been successfully deleted"), $user);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -995,7 +994,7 @@ class m_mysql {
|
|||
$d = $this->get_userslist(1);
|
||||
if (!empty($d)) {
|
||||
for ($i = 0; $i < count($d); $i++) {
|
||||
$this->del_user($d[$i]["name"], 1);
|
||||
$this->del_user($d[$i]["name"], 1,true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue