PageRenderTime 56ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/core/web/modules/base/users/backup.php

https://github.com/vmasilva/mmc
PHP | 95 lines | 68 code | 4 blank | 23 comment | 1 complexity | 33f869621025b5e492114a5219d348c6 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * (c) 2004-2007 Linbox / Free&ALter Soft, http://linbox.com
  4. * (c) 2007-2008 Mandriva, http://www.mandriva.com
  5. *
  6. * $Id$
  7. *
  8. * This file is part of Mandriva Management Console (MMC).
  9. *
  10. * MMC is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * MMC is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with MMC; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. /* FIXME: this page needs to be cleaned up */
  25. function sched_backup($user, $media) {
  26. $param = array($user,$media,$_SESSION["login"]);
  27. return xmlCall("base.backupUser",$param);
  28. }
  29. if (isset($_POST["bback"])) {
  30. header("Location: main.php?module=base&submod=users&action=index");
  31. exit;
  32. }
  33. ?>
  34. <h2><?php echo _("Backup a user's folder") ?></h2>
  35. <?php
  36. if (isset($_GET["user"])) {
  37. $user = urldecode($_GET["user"]);
  38. }
  39. if (isset($_POST["user"])) {
  40. $user = $_POST["user"];
  41. }
  42. if (isset($_POST["bgo"])) {
  43. $backuppath = sched_backup($user, $_POST["media"]);
  44. if (!isXMLRPCError()) {
  45. $str = "<h2>"._("Backup a user's home directory")."</h2>";
  46. $str .= "<p>";
  47. $str .= sprintf(_("Backup of <b>%s</b> user's folder has been launched in background."), $user);
  48. $str .= "</p><p>";
  49. $str .= sprintf(_("The files will be stored in the directory %s of the server at the end of the backup."), $backuppath);
  50. $str .= "</p><p>";
  51. $str .= _("Please go to the status page to check the backup status.");
  52. $str .= "</p><p>";
  53. $str .= _("This operation will last according to the amount of data to backup.");
  54. $str .= "</p>";
  55. new NotifyWidgetSuccess($str);
  56. }
  57. header("Location: ".urlStrRedirect("base/users/index"));
  58. }
  59. else {
  60. ?>
  61. <form action="main.php?module=base&submod=users&action=backup" method="post">
  62. <p>
  63. <?php
  64. printf(_("%s home directory will be archived."),$user);
  65. ?>
  66. </p>
  67. <p>
  68. <?php
  69. printf(_("Please select media size. If your data exceeds the volume size, several files of your media size will be created."));
  70. ?>
  71. </p>
  72. <?php echo _("Media size"); ?>
  73. <select name="media" />
  74. <option value="600">CD (650 Mo)</option>
  75. <option value="4200">DVD (4.7 Go)</option>
  76. </select>
  77. <br><br>
  78. <input name="user" type="hidden" value="<?php echo $user; ?>" />
  79. <input name="bgo" type="submit" class="btnPrimary" value="<?php echo _("Launch backup"); ?>" />
  80. <input name="bback" type="submit" class="btnSecondary" value="<?php echo _("Cancel"); ?>" onclick="new Effect.Fade('popup'); return false;" />
  81. </form>
  82. <?php
  83. }
  84. ?>