/phpini/save_dirs.cgi

http://github.com/webmin/webmin · Perl · 36 lines · 24 code · 9 blank · 3 comment · 9 complexity · eed64308e6b4142f8fa6101f2211d954 MD5 · raw file

  1. #!/usr/local/bin/perl
  2. # Update options related to PHP directories
  3. require './phpini-lib.pl';
  4. &error_setup($text{'dirs_err'});
  5. &ReadParse();
  6. &can_php_config($in{'file'}) || &error($text{'list_ecannot'});
  7. &lock_file($in{'file'});
  8. $conf = &get_config($in{'file'});
  9. # Validate and save inputs
  10. if ($in{'include_def'}) {
  11. &save_directive($conf, "include_path", undef);
  12. }
  13. else {
  14. @incs = split(/\r?\n/, $in{'include'});
  15. @incs || &error($text{'dirs_eincs'});
  16. &save_directive($conf, "include_path", join(":", @incs));
  17. }
  18. $in{'ext_def'} || $in{'ext'} =~ /\S/ || &error($text{'dirs_eext'});
  19. &save_directive($conf, "extension_dir", $in{'ext_def'} ? undef : $in{'ext'});
  20. &save_directive($conf, "file_uploads", $in{'file_uploads'} || undef);
  21. $in{'utmp_def'} || -d $in{'utmp'} || &error($text{'dirs_eutmp'});
  22. &save_directive($conf, "upload_tmp_dir", $in{'utmp_def'} ? undef : $in{'utmp'});
  23. &flush_file_lines_as_user($in{'file'});
  24. &unlock_file($in{'file'});
  25. &graceful_apache_restart();
  26. &webmin_log("dirs", undef, $in{'file'});
  27. &redirect("list_ini.cgi?file=".&urlize($in{'file'}));