21if ( !defined (
'ALLOWED')) die(
'Forbidden');
29 if ( defined (
'PG_PATH') )
30 putenv(
"PATH=".PG_PATH);
32 $cmd=escapeshellcmd (PG_RESTORE);
33 if (defined(
"noalyss_user"))
35 putenv(
"PGPASSWORD=" . noalyss_password);
36 putenv(
"PGUSER=" . noalyss_user);
37 putenv(
"PGHOST=" . noalyss_psql_host);
38 putenv(
"PGPORT=" . noalyss_psql_port);
39 }
else if (defined(
"phpcompta_user"))
41 putenv(
"PGPASSWORD=" . phpcompta_password);
42 putenv(
"PGUSER=" . phpcompta_user);
43 putenv(
"PGHOST=" . phpcompta_psql_host);
44 putenv(
"PGPORT=" . phpcompta_psql_port);
46 die (
'Aucune connection');
49 $retour=
'<hr>'.HtmlInput::button_anchor(_(
"Retour"),
"?action=restore",
"",
"smallbutton");
52 echo
'<div class="content">';
53 echo (
"<span class=\"error\">"._(
"Vous devez préciser s'il s'agit d'un modèle ou d'un dossier").
"</span>");
58 if ( empty ($_FILES[
'file'][
'name']) ||
62 echo
'<div class="content">';
64 echo (
"<span class=\"error\">"._(
'Vous devez donner un fichier').
" </span>");
73 echo
'<div class="content">';
76 $id=
$cn->get_next_seq(
'dossier_id');
80 $lname=
$id.
" Restauration :".
sql_string($_FILES[
'file'][
'name']);
96 $sql=
"insert into ac_dossier (dos_id,dos_name,dos_description) values ($1,$2,$3)";
100 $cn->get_value(
$sql,array(
$id,$lname,$ldesc));
104 catch ( Exception
$e)
106 echo
'<span class="error">'._(
"Echec de la restauration ").
'</span>';
113 $cn->exec_sql(
"create database ".
$name.
" encoding='utf8'");
114 $args=
" --no-owner -d $name ".$_FILES[
'file'][
'tmp_name'];
115 $cmd= escapeshellcmd(PG_RESTORE);
118 if ( $test->exist_table(
'version') )
120 echo
'<h2 class="info"> '._(
'Restauration réussie du dossier ').$lname.
'</h2>';
126 echo
'<h2 class="error"> '._(
'Problème lors de la restauration ').$lname.
'</h2>';
127 $cn->exec_sql(
'delete from ac_dossier where dos_id=$1',array(
$id));
128 $cn->exec_sql(
'drop database '.
$name);
133 $new_cn->apply_patch(
$name);
134 echo
'<span class="error">'._(
'Ne pas recharger la page, sinon votre base de données sera restaurée une fois de plus').
'</span>';
136 Noalyss_user::remove_inexistant_user(
$id);
137 $new_cn->clean_orphan_lob();
147 echo
'<div class="content">';
150 $id=
$cn->get_next_seq(
's_modid');
153 $lname=
$id.
" Restauration :".$_FILES[
'file'][
'name'];
157 $ldesc=
$http->post(
"desc");
158 $sql=
"insert into modeledef (mod_id,mod_name,mod_desc) values ($1,$2,$3)";
165 catch ( Exception
$e)
167 echo
'<span class="error">'._(
"Echec de la restauration ").
'</span>';
174 $cn->exec_sql(
"create database ".
$name.
" encoding='utf8'");
175 $args=
" -d $name ".$_FILES[
'file'][
'tmp_name'];
176 $status=exec(PG_RESTORE.$args);
179 if ( $test->exist_table(
'version') )
181 echo
'<h2 class="info"> '._(
'Restauration réussie du dossier ').$lname.
'</h2>';
187 echo
'<h2 class="error"> '._(
'Problème lors de la restauration ').$lname.
'</h2>';
188 $cn->exec_sql(
'delete from modeledef where mod_id=$1',array(
$id));
189 $cn->exec_sql(
'drop database '.
$name);
195 $new_cn->apply_patch(
$name);
196 $new_cn->clean_orphan_lob();
197 echo
'<span class="error">'._(
'Ne pas recharger la page, sinon votre base de données sera restaurée une fois de plus').
'</span>';
205 echo
'<div class="content" style="width:80%;margin-left:10%">';
206 printf(
'<form method="POST" action="admin-noalyss.php" enctype="multipart/form-data" onsubmit="return check_file_size(this,%s) " >',MAX_FILE_SIZE);
210 echo
'<tr><td>'._(
"Nom de la base de donnée").Icon_Action::infobulle(29)
216 echo
'<td>'.$wNom->input().
'</td></tr>';
217 echo
'<tr><td>'._(
"Type de backup").
" :".
'</td>';
221 echo
'<td> '.$chk->input()._(
"Dossier").
'</td>';
222 echo
'</tr><tr><td></td>';
225 echo
'<td>'.$chk->input()._(
"Modele").
'</td>';
230 echo
td(_(
'Fichier ')).
235 echo
"<p>Description </p>";
noalyss_strlentrim($p_string)
sql_string($p_string)
Fix the problem with the quote char for the database.
td($p_string='', $p_extra='')
surround the string with td
contains the class for connecting to Noalyss
static synchro_admin($p_id)
connect to folder and give to admin.
Html Input for uploading file, must be in a form with enctype="multipart/form-data".
Manage the TEXTAREA html element.
static echo_file($msg, $print=true)
display the file
for($e=0; $e< count($afiche); $e++) exit