Alternc  latest
Alternc logiel libre pour l'hébergement
sql_bck.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Form to manage MySQL database backup for an account
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 include_once("head.php");
28 
29 ?>
30 <h3 class="backup"><?php __("MySQL Databases - Configure backups"); ?></h3>
31 <hr id="topbar"/>
32 <br />
33 <?php
34 
35 if ( ! variable_get('sql_allow_users_backups') ) {
36  echo "<p class=\"alert alert-danger\">"._("You aren't allowed to access this page. Contact your administrator if you want to.")."</p>";
37  include_once('foot.php');
38  exit;
39 }
40 
41 $fields = array (
42  "id" => array ("request", "string", ""),
43  "bck_mode" => array ("post", "integer", 0),
44  "bck_history" => array ("post", "integer", 7),
45  "bck_gzip" => array ("post", "integer", 0),
46  "bck_dir" => array ("post", "string", "/"),
47 
48 );
50 
51 $r=$mysql->get_mysql_details($id);
52 
53 echo $msg->msg_html_all();
54 
55 if (is_array($r)) {
56 ?>
57 <h3><?php printf(_("Manage the SQL backup for database %s"),$r["db"]); ?></h3>
58 
59 <form action="sql_dobck.php" method="post" id="main" name="main">
60  <?php csrf_get(); ?>
61 <table class="tedit">
62 <tr>
63  <th><label><?php __("Do MySQL backup?"); ?></label></th>
64  <td>
65  <input type="hidden" name="id" value="<?php ehe($id); ?>" />
66  <input type="radio" class="inc" id="bck_mode0" name="bck_mode" value="0"<?php cbox($r["bck"]==0); ?>/><label for="bck_mode0"><?php __("No backup"); ?></label><br />
67  <input type="radio" class="inc" id="bck_mode1" name="bck_mode" value="1"<?php cbox($r["bck"]==1); ?>/><label for="bck_mode1"><?php __("Weekly backup"); ?></label><br />
68  <input type="radio" class="inc" id="bck_mode2" name="bck_mode" value="2"<?php cbox($r["bck"]==2); ?>/><label for="bck_mode2"><?php __("Daily backup"); ?></label><br />
69  </td>
70 </tr>
71 <tr>
72  <th><label for="bck_history"><?php __("How many backups should be kept?"); ?></label></th>
73  <td><select class="inl" name="bck_history" id="bck_history">
74  <?php
75  for($i=1;$i<20;$i++) {
76  echo "<option";
77  if ($r["history"]==$i) echo " selected=\"selected\"";
78  echo ">$i</option>";
79  }
80  ?>
81  </select></td>
82 </tr>
83 <tr>
84  <th><label><?php __("Compress the backups? (gzip)"); ?></label></th>
85  <td>
86 
87  <input type="radio" class="inc" id="bck_gzip0" name="bck_gzip" value="0"<?php cbox($r["gzip"]==0); ?>/><label for="bck_gzip0"><?php __("No"); ?></label><br />
88  <input type="radio" class="inc" id="bck_gzip1" name="bck_gzip" value="1"<?php cbox($r["gzip"]==1); ?>/><label for="bck_gzip1"><?php __("Yes"); ?></label><br />
89 
90 </td>
91 </tr>
92 <tr>
93  <th><label for="bck_dir"><?php __("In which folder do you want to store the backups?"); ?></label></th>
94  <td><input type="text" class="int" name="bck_dir" id="bck_dir" size="30" maxlength="255" value="<?php ehe($r["dir"]); ?>" />
95  <?php display_browser( isset($r["dir"])?$r["dir"]:"" , "bck_dir" ); ?>
96 </td>
97 </tr>
98 
99 <tr class="trbtn"><td colspan="2">
100  <input class="inb ok" type="submit" name="submit" value="<?php __("Change the MySQL backup parameters"); ?>" />
101  <input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='sql_list.php'"/>
102 </td></tr>
103 </table>
104 </form>
105 <?php
106  $mem->show_help("sql_bck");
107 } else {
108  echo "<p>";
109  __("You currently have no database defined");
110  echo "</p>";
111 }
112 ?>
113 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
$mem
Definition: bootstrap.php:71
$msg
Definition: bootstrap.php:75
variable_get($name, $default=null, $createit_comment=null)
Return a persistent variable.
Definition: variables.php:85
__($str)
Definition: functions.php:404
display_browser($dir="", $caller="main.dir", $width=350, $height=450)
Show a button to select a folder on the server.
Definition: functions.php:941
cbox($test, $echo=true)
ECHOes checked="checked" only if the parameter is true useful for checkboxes and radio buttons.
Definition: functions.php:345
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
Definition: functions.php:1159
$r
Definition: sql_bck.php:51
if(! variable_get('sql_allow_users_backups')) $fields
Definition: sql_bck.php:41
$i
if(!isset($is_include)) if(! $key &&! $crt) $id