index.php 668 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. // Init
  4. ob_start();
  5. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  6. // Check token
  7. verify_csrf($_GET);
  8. if ($_SESSION['userContext'] === 'admin') {
  9. if (!empty($_GET['pkg'])) {
  10. $v_pkg = quoteshellarg($_GET['pkg']);
  11. exec(HESTIA_CMD."v-update-sys-hestia ".$v_pkg, $output, $return_var);
  12. }
  13. if ($return_var != 0) {
  14. $error = implode('<br>', $output);
  15. if (empty($error)) {
  16. $error = sprintf(_('Error: %s update failed', $v_pkg));
  17. $_SESSION['error_msg'] = $error;
  18. }
  19. }
  20. unset($output);
  21. }
  22. header("Location: /list/updates/");
  23. exit;