PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/admin/tools/update.php

https://github.com/asterix14/dolibarr
PHP | 145 lines | 91 code | 25 blank | 29 comment | 9 complexity | d4802736f90450b976d0d0b70853e099 MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/admin/tools/update.php
  20. * \brief Page to make a Dolibarr online upgrade
  21. */
  22. require("../../main.inc.php");
  23. include_once $dolibarr_main_document_root."/core/lib/files.lib.php";
  24. $langs->load("admin");
  25. $langs->load("other");
  26. if (! $user->admin)
  27. accessforbidden();
  28. if ($_GET["msg"]) $message='<div class="error">'.$_GET["msg"].'</div>';
  29. $urldolibarr='http://www.dolibarr.org/downloads/';
  30. //$urldolibarrmodules='http://www.dolibarr.org/downloads/cat_view/65-modulesaddon';
  31. $urldolibarrmodules='http://www.dolistore.com/';
  32. //$urldolibarrthemes='http://www.dolibarr.org/';
  33. $urldolibarrthemes='http://www.dolistore.com/';
  34. $dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT);
  35. $dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot);
  36. /*
  37. * Actions
  38. */
  39. if ($_POST["action"]=='install')
  40. {
  41. $error=0;
  42. $original_file=basename($_FILES["fileinstall"]["name"]);
  43. $newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
  44. if (! $original_file)
  45. {
  46. $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("File"));
  47. $error++;
  48. }
  49. else
  50. {
  51. if (! preg_match('/\.tgz/i',$original_file))
  52. {
  53. $mesg=$langs->trans("ErrorFileMustBeADolibarrPackage");
  54. $error++;
  55. }
  56. }
  57. if (! $error)
  58. {
  59. @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
  60. create_exdir($conf->admin->dir_temp.'/'.$original_file);
  61. $result=dol_move_uploaded_file($_FILES["fileinstall"]["tmp_name"],$newfile,1,0,$_FILES['fileinstall']['error']);
  62. if ($result > 0)
  63. {
  64. //dol_uncompress($newfile);
  65. }
  66. }
  67. }
  68. /*
  69. * View
  70. */
  71. $wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_Ă _jour|ES:Instalaci&omodulon_-_Actualizaci&omodulon';
  72. llxHeader('',$langs->trans("Upgrade"),$wikihelp);
  73. print_fiche_titre($langs->trans("Upgrade"),'','setup');
  74. print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
  75. print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>';
  76. print '<br>';
  77. if ($mesg)
  78. {
  79. print '<div class="error">'.$mesg.'</div><br>';
  80. }
  81. print $langs->trans("Upgrade").'<br>';
  82. print '<hr>';
  83. print $langs->trans("ThisIsProcessToFollow").'<br>';
  84. print '<b>'.$langs->trans("StepNb",1).'</b>: ';
  85. $fullurl='<a href="'.$urldolibarr.'" target="_blank">'.$urldolibarr.'</a>';
  86. print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
  87. print '<b>'.$langs->trans("StepNb",2).'</b>: ';
  88. print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
  89. print '<b>'.$langs->trans("StepNb",3).'</b>: ';
  90. print $langs->trans("RemoveLock",$dolibarrroot.'install.lock').'<br>';
  91. print '<b>'.$langs->trans("StepNb",4).'</b>: ';
  92. $fullurl='<a href="'.DOL_URL_ROOT.'/install/" target="_blank">'.DOL_URL_ROOT.'/install/</a>';
  93. print $langs->trans("CallUpdatePage",$fullurl).'<br>';
  94. print '<b>'.$langs->trans("StepNb",5).'</b>: ';
  95. print $langs->trans("RestoreLock",$dolibarrroot.'install.lock').'<br>';
  96. print '<br>';
  97. print '<br>';
  98. $fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
  99. print $langs->trans("AddExtensionThemeModuleOrOther").'<br>';
  100. print '<hr>';
  101. print $langs->trans("ThisIsProcessToFollow").'<br>';
  102. print '<b>'.$langs->trans("StepNb",1).'</b>: ';
  103. print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
  104. print '<b>'.$langs->trans("StepNb",2).'</b>: ';
  105. print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
  106. print '<b>'.$langs->trans("StepNb",3).'</b>: ';
  107. print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
  108. if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
  109. {
  110. print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
  111. print '<input type="hidden" name="action" value="install">';
  112. print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
  113. print '<input type="submit" name="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
  114. print '</form>';
  115. }
  116. print '<b>'.$langs->trans("StepNb",4).'</b>: ';
  117. print $langs->trans("SetupIsReadyForUse").'<br>';
  118. print '</form>';
  119. llxFooter();
  120. ?>